Bug 1134293. Report the bounds of a tree body as needing component alpha and support disable component alpha in the text it might draw if asked. r=roc

This commit is contained in:
Timothy Nikkel 2015-02-24 17:51:25 -06:00
parent 204b5160b6
commit d8485e122e

View File

@ -2773,12 +2773,40 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext,
return NS_OK;
}
static void
PaintTreeBody(nsIFrame* aFrame, nsRenderingContext* aCtx,
const nsRect& aDirtyRect, nsPoint aPt)
{
static_cast<nsTreeBodyFrame*>(aFrame)->PaintTreeBody(*aCtx, aDirtyRect, aPt);
}
class nsDisplayTreeBody MOZ_FINAL : public nsDisplayItem {
public:
nsDisplayTreeBody(nsDisplayListBuilder* aBuilder, nsFrame* aFrame) :
nsDisplayItem(aBuilder, aFrame),
mDisableSubpixelAA(false) {
MOZ_COUNT_CTOR(nsDisplayTreeBody);
}
#ifdef NS_BUILD_REFCNT_LOGGING
virtual ~nsDisplayTreeBody() {
MOZ_COUNT_DTOR(nsDisplayTreeBody);
}
#endif
virtual void Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx) MOZ_OVERRIDE
{
gfxContext* ctx = aCtx->ThebesContext();
gfxContextAutoDisableSubpixelAntialiasing disable(ctx, mDisableSubpixelAA);
static_cast<nsTreeBodyFrame*>(mFrame)->
PaintTreeBody(*aCtx, mVisibleRect, ToReferenceFrame());
}
NS_DISPLAY_DECL_NAME("XULTreeBody", TYPE_XUL_TREE_BODY)
virtual nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder) MOZ_OVERRIDE
{
bool snap;
return GetBounds(aBuilder, &snap);
}
virtual void DisableComponentAlpha() MOZ_OVERRIDE {
mDisableSubpixelAA = true;
}
bool mDisableSubpixelAA;
};
// Painting routines
void
@ -2799,8 +2827,7 @@ nsTreeBodyFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
return;
aLists.Content()->AppendNewToTop(new (aBuilder)
nsDisplayGeneric(aBuilder, this, ::PaintTreeBody, "XULTreeBody",
nsDisplayItem::TYPE_XUL_TREE_BODY));
nsDisplayTreeBody(aBuilder, this));
}
void