Bug 1158546 - Remove nsDisplayHeaderFooter::mFrame in favor of nsDisplayItem::mFrame; r=roc

There is no need to have two separate variables for the same thing
in the same object.
This commit is contained in:
Ehsan Akhgari 2015-04-25 11:43:02 -04:00
parent f9a2ed34d6
commit 65709fa8ac
2 changed files with 13 additions and 3 deletions

View File

@ -40,6 +40,10 @@ NS_NewPageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
NS_IMPL_FRAMEARENA_HELPERS(nsPageFrame) NS_IMPL_FRAMEARENA_HELPERS(nsPageFrame)
NS_QUERYFRAME_HEAD(nsPageFrame)
NS_QUERYFRAME_ENTRY(nsPageFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
nsPageFrame::nsPageFrame(nsStyleContext* aContext) nsPageFrame::nsPageFrame(nsStyleContext* aContext)
: nsContainerFrame(aContext) : nsContainerFrame(aContext)
{ {
@ -480,7 +484,7 @@ static gfx::Matrix4x4 ComputePageTransform(nsIFrame* aFrame, float aAppUnitsPerP
class nsDisplayHeaderFooter : public nsDisplayItem { class nsDisplayHeaderFooter : public nsDisplayItem {
public: public:
nsDisplayHeaderFooter(nsDisplayListBuilder* aBuilder, nsPageFrame *aFrame) nsDisplayHeaderFooter(nsDisplayListBuilder* aBuilder, nsPageFrame *aFrame)
: nsDisplayItem(aBuilder, aFrame), mFrame(aFrame) : nsDisplayItem(aBuilder, aFrame)
, mDisableSubpixelAA(false) , mDisableSubpixelAA(false)
{ {
MOZ_COUNT_CTOR(nsDisplayHeaderFooter); MOZ_COUNT_CTOR(nsDisplayHeaderFooter);
@ -493,7 +497,12 @@ public:
virtual void Paint(nsDisplayListBuilder* aBuilder, virtual void Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx) override { nsRenderingContext* aCtx) override {
mFrame->PaintHeaderFooter(*aCtx, ToReferenceFrame(), mDisableSubpixelAA); #ifdef DEBUG
nsPageFrame* pageFrame = do_QueryFrame(mFrame);
MOZ_ASSERT(pageFrame, "We should have an nsPageFrame");
#endif
static_cast<nsPageFrame*>(mFrame)->
PaintHeaderFooter(*aCtx, ToReferenceFrame(), mDisableSubpixelAA);
} }
NS_DISPLAY_DECL_NAME("HeaderFooter", nsDisplayItem::TYPE_HEADER_FOOTER) NS_DISPLAY_DECL_NAME("HeaderFooter", nsDisplayItem::TYPE_HEADER_FOOTER)
@ -506,7 +515,6 @@ public:
mDisableSubpixelAA = true; mDisableSubpixelAA = true;
} }
protected: protected:
nsPageFrame* mFrame;
bool mDisableSubpixelAA; bool mDisableSubpixelAA;
}; };

View File

@ -16,6 +16,8 @@ class nsSharedPageData;
class nsPageFrame final : public nsContainerFrame { class nsPageFrame final : public nsContainerFrame {
public: public:
NS_DECL_QUERYFRAME_TARGET(nsPageFrame)
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS NS_DECL_FRAMEARENA_HELPERS
friend nsPageFrame* NS_NewPageFrame(nsIPresShell* aPresShell, friend nsPageFrame* NS_NewPageFrame(nsIPresShell* aPresShell,