commit 8244ecad8b53e9475d89f635869d12b714c62208
parent 9063b3c208f7f5cc99cf105a6df4d9911fb7d4f7
Author: Timothy Nikkel <tnikkel@gmail.com>
Date: Wed, 26 Nov 2025 13:04:54 +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