Bug 1922298 - Add a fast way of tagging frames as captured, and make that view-transition-name a stacking-context-creating property. r=view-transitions-reviewers,boris

Differential Revision: https://phabricator.services.mozilla.com/D239377
This commit is contained in:
Emilio Cobos Álvarez
2025-02-25 22:48:31 +00:00
parent 0bb8afd799
commit 90fa7916f7
6 changed files with 54 additions and 9 deletions

View File

@@ -59,6 +59,7 @@
#include "nsFlexContainerFrame.h"
#include "nsFocusManager.h"
#include "nsFrameList.h"
#include "nsFrameState.h"
#include "nsTextControlFrame.h"
#include "nsPlaceholderFrame.h"
#include "nsIBaseWindow.h"
@@ -1757,6 +1758,7 @@ bool nsIFrame::Extend3DContext(const nsStyleDisplay* aStyleDisplay,
!GetClipPropClipRect(disp, effects, GetSize()) &&
!SVGIntegrationUtils::UsingEffectsForFrame(this) &&
!effects->HasMixBlendMode() &&
!ForcesStackingContextForViewTransition() &&
disp->mIsolation != StyleIsolation::Isolate;
}
@@ -2738,6 +2740,19 @@ Maybe<nsRect> nsIFrame::GetClipPropClipRect(const nsStyleDisplay* aDisp,
return Some(rect);
}
// https://drafts.csswg.org/css-view-transitions-1/#named-and-transitioning
//
// Note https://github.com/w3c/csswg-drafts/issues/11772, however, for the root
// style check.
bool nsIFrame::ForcesStackingContextForViewTransition() const {
auto* style = Style();
return (style->StyleUIReset()->HasViewTransitionName() ||
HasAnyStateBits(NS_FRAME_CAPTURED_IN_VIEW_TRANSITION) ||
style->StyleDisplay()->mWillChange.bits &
mozilla::StyleWillChangeBits::VIEW_TRANSITION_NAME) &&
!style->IsRootElementStyle();
}
/**
* If the CSS 'overflow' property applies to this frame, and is not
* handled by constructing a dedicated nsHTML/XULScrollFrame, set up clipping
@@ -11566,6 +11581,11 @@ bool nsIFrame::IsStackingContext(const nsStyleDisplay* aStyleDisplay,
return true;
}
}
if (ForcesStackingContextForViewTransition()) {
return true;
}
// strictly speaking, 'perspective' doesn't require visual atomicity,
// but the spec says it acts like the rest of these
if (aStyleDisplay->HasPerspectiveStyle() ||
@@ -11580,6 +11600,9 @@ bool nsIFrame::IsStackingContext(const nsStyleDisplay* aStyleDisplay,
return true;
}
}
// Elements captured in a view transition during a view transition or whose
// view-transition-name computed value is not none (at any time) form a s
// https://drafts.csswg.org/css-view-transitions-1/#named-and-transitioning
return aStyleEffects->mMixBlendMode != StyleBlend::Normal ||
SVGIntegrationUtils::UsingEffectsForFrame(this) ||
aStyleDisplay->IsPositionForcingStackingContext() ||