commit 5f4e0ab4bf4d6712103ffb3dd67525f4869349ca
parent ebad30b3999db38ee5e2c9b535c5ed53e499331a
Author: Timothy Nikkel <tnikkel@gmail.com>
Date: Wed, 26 Nov 2025 13:55:43 +0000
Bug 1988032. Tweak ASR assert to handle unusual native anonymous content in the custom content container in view transition case. r=emilio,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D273939
Diffstat:
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/layout/generic/nsIFrame.cpp b/layout/generic/nsIFrame.cpp
@@ -4450,13 +4450,33 @@ void nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
#ifdef DEBUG
if (aBuilder->IsPaintingToWindow()) {
+ // Assert that the asr is as expected.
if (savedOutOfFlowData->mContainingBlockInViewTransitionCapture) {
MOZ_ASSERT(asr == nullptr);
MOZ_ASSERT(aBuilder->IsInViewTransitionCapture());
- } else {
+ } else if ((asr ? asr->mFrame : nullptr) !=
+ nsLayoutUtils::GetASRAncestorFrame(child->GetParent(),
+ aBuilder)) {
+ // A weird case for native anonymous content in the custom content
+ // container when the root is captured by a view transition. This
+ // content is built outside of the view transition capture but the
+ // containing block (the canvas frame) was built inside the capture, so
+ // savedOutOfFlowData is saved as if we are inside the capture while we
+ // are outside it (bug 2002160).
+ MOZ_ASSERT(asr == nullptr);
+ MOZ_ASSERT(PresContext()->Document()->GetActiveViewTransition());
MOZ_ASSERT(
- (asr ? asr->mFrame : nullptr) ==
- nsLayoutUtils::GetASRAncestorFrame(child->GetParent(), aBuilder));
+ child->GetParent()->GetContent()->IsInNativeAnonymousSubtree());
+ bool inTopLayer = false;
+ nsIFrame* curr = child->GetParent();
+ while (curr) {
+ if (curr->StyleDisplay()->mTopLayer == StyleTopLayer::Auto) {
+ inTopLayer = true;
+ break;
+ }
+ curr = curr->GetParent();
+ }
+ MOZ_ASSERT(inTopLayer);
}
}
#endif