tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 9aa23feec43b4c12497432a3f8edd31e9e70a727
parent 37912600c566f976bfe8ee98ae362e241e5eaf0e
Author: Ting-Yu Lin <tlin@mozilla.com>
Date:   Fri, 19 Dec 2025 19:35:21 +0000

Bug 2007058 Part 2 - Paint pushed abspos frames with NS_FRAME_IS_PUSHED_OUT_OF_FLOW bit in DisplayPushedAbsoluteFrames(). r=layout-reviewers,dholbert

Mark abspos next-in-flows with the `NS_FRAME_IS_PUSHED_OUT_OF_FLOW` bit, and
adjust the display item generation code accordingly.

In Bug 1994346, pushed abspos first-in-flow will get the bit as well.

Differential Revision: https://phabricator.services.mozilla.com/D277138

Diffstat:
Mlayout/forms/nsFieldSetFrame.cpp | 2+-
Mlayout/generic/AbsoluteContainingBlock.cpp | 1+
Mlayout/generic/nsBlockFrame.cpp | 2+-
Mlayout/generic/nsCanvasFrame.cpp | 2+-
Mlayout/generic/nsContainerFrame.cpp | 4++--
Mlayout/generic/nsContainerFrame.h | 9+++++----
Mlayout/generic/nsFlexContainerFrame.cpp | 2+-
Mlayout/generic/nsGridContainerFrame.cpp | 2+-
8 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/layout/forms/nsFieldSetFrame.cpp b/layout/forms/nsFieldSetFrame.cpp @@ -231,7 +231,7 @@ void nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, if (GetPrevInFlow()) { DisplayOverflowContainers(aBuilder, aLists); - DisplayAbsoluteContinuations(aBuilder, aLists); + DisplayPushedAbsoluteFrames(aBuilder, aLists); } nsDisplayListCollection contentDisplayItems(aBuilder); diff --git a/layout/generic/AbsoluteContainingBlock.cpp b/layout/generic/AbsoluteContainingBlock.cpp @@ -342,6 +342,7 @@ void AbsoluteContainingBlock::Reflow(nsContainerFrame* aDelegatingFrame, nextFrame = aPresContext->PresShell() ->FrameConstructor() ->CreateContinuingFrame(kidFrame, aDelegatingFrame); + nextFrame->AddStateBits(NS_FRAME_IS_PUSHED_OUT_OF_FLOW); mPushedAbsoluteFrames.AppendFrame(nullptr, nextFrame); } else if (nextFrame->GetParent() != aDelegatingFrame->GetNextInFlow()) { diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp @@ -7759,7 +7759,7 @@ void nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, if (GetPrevInFlow()) { DisplayOverflowContainers(aBuilder, aLists); - DisplayAbsoluteContinuations(aBuilder, aLists); + DisplayPushedAbsoluteFrames(aBuilder, aLists); for (nsIFrame* f : GetChildList(FrameChildListID::Float)) { if (f->HasAnyStateBits(NS_FRAME_IS_PUSHED_OUT_OF_FLOW)) { BuildDisplayListForChild(aBuilder, f, aLists); diff --git a/layout/generic/nsCanvasFrame.cpp b/layout/generic/nsCanvasFrame.cpp @@ -219,7 +219,7 @@ void nsCanvasFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, "::-moz-{scrolled-,}canvas doesn't have native appearance"); if (GetPrevInFlow()) { DisplayOverflowContainers(aBuilder, aLists); - DisplayAbsoluteContinuations(aBuilder, aLists); + DisplayPushedAbsoluteFrames(aBuilder, aLists); } // Force a background to be shown. We may have a background propagated to us, diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp @@ -982,10 +982,10 @@ void nsContainerFrame::DisplayOverflowContainers( } } -void nsContainerFrame::DisplayAbsoluteContinuations( +void nsContainerFrame::DisplayPushedAbsoluteFrames( nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) { for (nsIFrame* frame : GetChildList(FrameChildListID::Absolute)) { - if (frame->GetPrevInFlow()) { + if (frame->HasAnyStateBits(NS_FRAME_IS_PUSHED_OUT_OF_FLOW)) { BuildDisplayListForChild(aBuilder, frame, aLists); } } diff --git a/layout/generic/nsContainerFrame.h b/layout/generic/nsContainerFrame.h @@ -437,13 +437,14 @@ class nsContainerFrame : public nsSplittableFrame { const nsDisplayListSet& aLists); /** - * Add absolute frame continuations to the display list. + * Add pushed absolute frames to the display list. * - * Note: for absolute frame's first-in-flow, it will be painted through its + * Note: for an absolute frame's first-in-flow without the + * NS_FRAME_IS_PUSHED_OUT_OF_FLOW bit, it will be painted through its * placeholder frame. */ - void DisplayAbsoluteContinuations(nsDisplayListBuilder* aBuilder, - const nsDisplayListSet& aLists); + void DisplayPushedAbsoluteFrames(nsDisplayListBuilder* aBuilder, + const nsDisplayListSet& aLists); /** * Builds display lists for the children. The background diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp @@ -2982,7 +2982,7 @@ void nsFlexContainerFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, if (GetPrevInFlow()) { DisplayOverflowContainers(aBuilder, tempLists); - DisplayAbsoluteContinuations(aBuilder, tempLists); + DisplayPushedAbsoluteFrames(aBuilder, tempLists); } // Our children are all block-level, so their borders/backgrounds all go on diff --git a/layout/generic/nsGridContainerFrame.cpp b/layout/generic/nsGridContainerFrame.cpp @@ -10272,7 +10272,7 @@ void nsGridContainerFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, if (GetPrevInFlow()) { DisplayOverflowContainers(aBuilder, aLists); - DisplayAbsoluteContinuations(aBuilder, aLists); + DisplayPushedAbsoluteFrames(aBuilder, aLists); } // Our children are all grid-level boxes, which behave the same as