commit 1da35cc35d48f8552e80a045109f99840ef6e292
parent 643eec99211ba30e588908baaf8e73c52caba369
Author: Ting-Yu Lin <tlin@mozilla.com>
Date: Sat, 22 Nov 2025 23:32:00 +0000
Bug 1994083 - Generate display items for frames in absolute child list. r=dholbert,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D272401
Diffstat:
7 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/layout/forms/nsFieldSetFrame.cpp b/layout/forms/nsFieldSetFrame.cpp
@@ -229,6 +229,7 @@ void nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (GetPrevInFlow()) {
DisplayOverflowContainers(aBuilder, aLists);
+ DisplayAbsoluteContinuations(aBuilder, aLists);
}
nsDisplayListCollection contentDisplayItems(aBuilder);
diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp
@@ -7764,6 +7764,7 @@ void nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (GetPrevInFlow()) {
DisplayOverflowContainers(aBuilder, aLists);
+ DisplayAbsoluteContinuations(aBuilder, aLists);
for (nsIFrame* f : GetChildList(FrameChildListID::Float)) {
if (f->HasAnyStateBits(NS_FRAME_IS_PUSHED_FLOAT)) {
BuildDisplayListForChild(aBuilder, f, aLists);
diff --git a/layout/generic/nsCanvasFrame.cpp b/layout/generic/nsCanvasFrame.cpp
@@ -219,6 +219,7 @@ void nsCanvasFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
"::-moz-{scrolled-,}canvas doesn't have native appearance");
if (GetPrevInFlow()) {
DisplayOverflowContainers(aBuilder, aLists);
+ DisplayAbsoluteContinuations(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
@@ -1018,6 +1018,15 @@ void nsContainerFrame::DisplayOverflowContainers(
}
}
+void nsContainerFrame::DisplayAbsoluteContinuations(
+ nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) {
+ for (nsIFrame* frame : GetChildList(FrameChildListID::Absolute)) {
+ if (frame->GetPrevInFlow()) {
+ BuildDisplayListForChild(aBuilder, frame, aLists);
+ }
+ }
+}
+
bool nsContainerFrame::TryRemoveFrame(FrameListPropertyDescriptor aProp,
nsIFrame* aChildToRemove) {
nsFrameList* list = GetProperty(aProp);
diff --git a/layout/generic/nsContainerFrame.h b/layout/generic/nsContainerFrame.h
@@ -437,6 +437,15 @@ class nsContainerFrame : public nsSplittableFrame {
const nsDisplayListSet& aLists);
/**
+ * Add absolute frame continuations to the display list.
+ *
+ * Note: for absolute frame's first-in-flow, it will be painted through its
+ * placeholder frame.
+ */
+ void DisplayAbsoluteContinuations(nsDisplayListBuilder* aBuilder,
+ const nsDisplayListSet& aLists);
+
+ /**
* Builds display lists for the children. The background
* of each child is placed in the Content() list (suitable for inline
* children and other elements that behave like inlines,
diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp
@@ -2987,6 +2987,7 @@ void nsFlexContainerFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (GetPrevInFlow()) {
DisplayOverflowContainers(aBuilder, tempLists);
+ DisplayAbsoluteContinuations(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,6 +10272,7 @@ void nsGridContainerFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (GetPrevInFlow()) {
DisplayOverflowContainers(aBuilder, aLists);
+ DisplayAbsoluteContinuations(aBuilder, aLists);
}
// Our children are all grid-level boxes, which behave the same as