author | Boris Zbarsky <bzbarsky@mit.edu> |
Wed, 21 Jun 2017 11:45:14 -0400 | |
changeset 365326 | 272a41ef0e3d64cc510424d0801142730302a0a4 |
parent 365325 | 74d8ec6397ee08180e001cc516b34a59e68bcd9c |
child 365327 | a2de41b74810e093e0517e83db7c297ec3663055 |
push id | 91734 |
push user | kwierso@gmail.com |
push date | Thu, 22 Jun 2017 01:05:37 +0000 |
treeherder | mozilla-inbound@2576a0695305 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | heycam |
bugs | 1374761 |
milestone | 56.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -2873,16 +2873,17 @@ nsCSSFrameConstructor::SetUpDocElementCo rootPseudo = nsCSSAnonBoxes::canvas; mDocElementContainingBlock = rootFrame; } else { // Create a page sequence frame rootFrame = NS_NewSimplePageSequenceFrame(mPresShell, viewportPseudoStyle); mPageSequenceFrame = rootFrame; rootPseudo = nsCSSAnonBoxes::pageSequence; + rootFrame->AddStateBits(NS_FRAME_OWNS_ANON_BOXES); } // --------- IF SCROLLABLE WRAP IN SCROLLFRAME -------- // If the device supports scrolling (e.g., in galley mode on the screen and // for print-preview, but not when printing), then create a scroll frame that // will act as the scrolling mechanism for the viewport. @@ -2966,16 +2967,17 @@ nsCSSFrameConstructor::SetUpDocElementCo } if (isPaginated) { // Create the first page // Set the initial child lists nsContainerFrame* canvasFrame; nsContainerFrame* pageFrame = ConstructPageFrame(mPresShell, rootFrame, nullptr, canvasFrame); + pageFrame->AddStateBits(NS_FRAME_OWNS_ANON_BOXES); SetInitialSingleChild(rootFrame, pageFrame); // The eventual parent of the document element frame. // XXX should this be set for every new page (in ConstructPageFrame)? mDocElementContainingBlock = canvasFrame; mHasRootAbsPosContainingBlock = true; } @@ -3040,16 +3042,19 @@ nsCSSFrameConstructor::ConstructPageFram // Initialize the page content frame and force it to have a view. Also make it the // containing block for fixed elements which are repeated on every page. nsIFrame* prevPageContentFrame = nullptr; if (aPrevPageFrame) { prevPageContentFrame = aPrevPageFrame->PrincipalChildList().FirstChild(); NS_ASSERTION(prevPageContentFrame, "missing page content frame"); } pageContentFrame->Init(nullptr, pageFrame, prevPageContentFrame); + if (!prevPageContentFrame) { + pageContentFrame->AddStateBits(NS_FRAME_OWNS_ANON_BOXES); + } SetInitialSingleChild(pageFrame, pageContentFrame); // Make it an absolute container for fixed-pos elements pageContentFrame->AddStateBits(NS_FRAME_CAN_HAVE_ABSPOS_CHILDREN); pageContentFrame->MarkAsAbsoluteContainingBlock(); RefPtr<nsStyleContext> canvasPseudoStyle; canvasPseudoStyle = styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::canvas,
--- a/layout/generic/nsPageContentFrame.cpp +++ b/layout/generic/nsPageContentFrame.cpp @@ -103,15 +103,24 @@ nsPageContentFrame::Reflow(nsPresContext if (aReflowInput.ComputedBSize() != NS_UNCONSTRAINEDSIZE) { aDesiredSize.BSize(wm) = aReflowInput.ComputedBSize(); } FinishAndStoreOverflow(&aDesiredSize); NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize); } +void +nsPageContentFrame::AppendDirectlyOwnedAnonBoxes( + nsTArray<OwnedAnonBox>& aResult) +{ + MOZ_ASSERT(mFrames.FirstChild(), + "pageContentFrame must have a canvasFrame child"); + aResult.AppendElement(mFrames.FirstChild()); +} + #ifdef DEBUG_FRAME_DUMP nsresult nsPageContentFrame::GetFrameName(nsAString& aResult) const { return MakeFrameName(NS_LITERAL_STRING("PageContent"), aResult); } #endif
--- a/layout/generic/nsPageContentFrame.h +++ b/layout/generic/nsPageContentFrame.h @@ -32,16 +32,21 @@ public: return ViewportFrame::IsFrameOfType(aFlags & ~(nsIFrame::eCanContainOverflowContainers)); } virtual void SetSharedPageData(nsSharedPageData* aPD) { mPD = aPD; } virtual bool HasTransformGetter() const override { return true; } + /** + * Return our canvas frame. + */ + void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override; + #ifdef DEBUG_FRAME_DUMP // Debugging virtual nsresult GetFrameName(nsAString& aResult) const override; #endif protected: explicit nsPageContentFrame(nsStyleContext* aContext) : ViewportFrame(aContext, kClassID)
--- a/layout/generic/nsPageFrame.cpp +++ b/layout/generic/nsPageFrame.cpp @@ -663,16 +663,25 @@ nsPageFrame::SetSharedPageData(nsSharedP // Set the shared data into the page frame before reflow nsPageContentFrame * pcf = static_cast<nsPageContentFrame*>(mFrames.FirstChild()); if (pcf) { pcf->SetSharedPageData(mPD); } } +void +nsPageFrame::AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) +{ + MOZ_ASSERT(mFrames.FirstChild() && + mFrames.FirstChild()->IsPageContentFrame(), + "pageFrame must have a pageContentFrame child"); + aResult.AppendElement(mFrames.FirstChild()); +} + nsIFrame* NS_NewPageBreakFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) { NS_PRECONDITION(aPresShell, "null PresShell"); //check that we are only creating page break frames when printing NS_ASSERTION(aPresShell->GetPresContext()->IsPaginated(), "created a page break frame while not printing"); return new (aPresShell) nsPageBreakFrame(aContext);
--- a/layout/generic/nsPageFrame.h +++ b/layout/generic/nsPageFrame.h @@ -46,16 +46,21 @@ public: // We must allow Print Preview UI to have a background, no matter what the // user's settings virtual bool HonorPrintBackgroundSettings() override { return false; } void PaintHeaderFooter(gfxContext& aRenderingContext, nsPoint aPt, bool aSubpixelAA); + /** + * Return our page content frame. + */ + void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override; + protected: explicit nsPageFrame(nsStyleContext* aContext); virtual ~nsPageFrame(); typedef enum { eHeader, eFooter } nsHeaderFooterEnum;
--- a/layout/generic/nsSimplePageSequenceFrame.cpp +++ b/layout/generic/nsSimplePageSequenceFrame.cpp @@ -890,8 +890,17 @@ nsSimplePageSequenceFrame::SetDateTimeSt // NS_IMETHODIMP nsSimplePageSequenceFrame::GetSTFPercent(float& aSTFPercent) { NS_ENSURE_TRUE(mPageData, NS_ERROR_UNEXPECTED); aSTFPercent = mPageData->mShrinkToFitRatio; return NS_OK; } + +void +nsSimplePageSequenceFrame::AppendDirectlyOwnedAnonBoxes( + nsTArray<OwnedAnonBox>& aResult) +{ + if (mFrames.NotEmpty()) { + aResult.AppendElement(mFrames.FirstChild()); + } +}
--- a/layout/generic/nsSimplePageSequenceFrame.h +++ b/layout/generic/nsSimplePageSequenceFrame.h @@ -95,16 +95,21 @@ public: NS_IMETHOD DoPageEnd() override; // We must allow Print Preview UI to have a background, no matter what the // user's settings bool HonorPrintBackgroundSettings() override { return false; } bool HasTransformGetter() const override { return true; } + /** + * Return our first page frame. + */ + void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override; + #ifdef DEBUG_FRAME_DUMP nsresult GetFrameName(nsAString& aResult) const override; #endif protected: explicit nsSimplePageSequenceFrame(nsStyleContext* aContext); virtual ~nsSimplePageSequenceFrame();