commit 30b207a4d0008aa76afaf9cac865b01837471f0f
parent e21dcc7bb55b2c6b5e5e5229c7be48a80121314e
Author: Ting-Yu Lin <tlin@mozilla.com>
Date: Thu, 1 Jan 2026 00:19:34 +0000
Bug 2007602 Part 3 - Implement stealing frame from next-in-flows' absCB absolute child lists. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D277495
Diffstat:
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/layout/generic/AbsoluteContainingBlock.cpp b/layout/generic/AbsoluteContainingBlock.cpp
@@ -156,8 +156,26 @@ bool AbsoluteContainingBlock::PrepareAbsoluteFrames(
DrainPushedChildList(aDelegatingFrame);
- // TODO (Bug 1994346 or Bug 1997696): Consider stealing absolute frames from
- // our next-in-flow's absolute child list.
+ // Steal absolute frame's first-in-flow from our next-in-flow's child lists.
+ for (const nsIFrame* nextInFlow = aDelegatingFrame->GetNextInFlow();
+ nextInFlow; nextInFlow = nextInFlow->GetNextInFlow()) {
+ AbsoluteContainingBlock* nextAbsCB =
+ nextInFlow->GetAbsoluteContainingBlock();
+ MOZ_ASSERT(nextAbsCB,
+ "If this delegating frame has an absCB, its next-in-flow must "
+ "have one, too!");
+
+ nextAbsCB->DrainPushedChildList(nextInFlow);
+
+ for (auto iter = nextAbsCB->GetChildList().begin();
+ iter != nextAbsCB->GetChildList().end();) {
+ nsIFrame* const child = *iter++;
+ if (!child->GetPrevInFlow()) {
+ nextAbsCB->StealFrame(child);
+ mAbsoluteFrames.AppendFrame(aDelegatingFrame, child);
+ }
+ }
+ }
return HasAbsoluteFrames();
}
@@ -356,7 +374,7 @@ void AbsoluteContainingBlock::Reflow(nsContainerFrame* aDelegatingFrame,
aDelegatingFrame->GetNextInFlow()) {
nextFrame->GetParent()->GetAbsoluteContainingBlock()->StealFrame(
nextFrame);
- mPushedAbsoluteFrames.AppendFrame(nullptr, nextFrame);
+ mPushedAbsoluteFrames.AppendFrame(aDelegatingFrame, nextFrame);
}
reflowStatus.MergeCompletionStatusFrom(kidStatus);
} else if (nextFrame) {