diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs index 24c8997a0b9..e6ffe241f71 100644 --- a/css-view-transitions-2/Overview.bs +++ b/css-view-transitions-2/Overview.bs @@ -450,6 +450,11 @@ Note: as per default behavior, the ''@view-transition'' rule can be nested insid Note: the [=@view-transition/type=] descriptor only applies to the {{Document}} in which it is defined. The author is responsible for using their chosen set of types in both documents. +## Responding to changes in the ''@view-transition'' rule ## {#respond-to-rule-changes} + +When the ''@view-transition'' rule changes for {{Document}} |document|, [=update the opt-in state for outbound transitions=] given |document|. + + # API # {#api} ## Additions to {{Document}} ## {#additions-to-document-api} @@ -527,6 +532,12 @@ The {{CSSViewTransitionRule}} represents a ''@view-transition'' rule. : inbound view transition params :: a [=view transition params=], or null. Initially null. + + : can initiate outbound view transition + :: a boolean. + Initially false. + + Note: this value can be read [=in parallel=] while navigating. ### The View transition params struct ### {#view-transition-params-struct} @@ -660,20 +671,24 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a
To check if a navigation can trigger a cross-document view-transition? given - an [=/origin=] |oldOrigin|, an [=/origin=] |newOrigin|, a boolean |navigationHasCrossOriginRedirects|, a {{NavigationType}} |navigationType|, and a boolean |isBrowserUINavigation|: + a {{Document}} |oldDocument|, a {{Document}} |newDocument|, a {{NavigationType}} |navigationType|, and a boolean |isBrowserUINavigation|: - Note: this is called during navigation, potentially [=in parallel=], for documents that have opted-in to view-transitions using the ''@view-transition'' rule. + Note: this is called during navigation, potentially [=in parallel=]. 1. If the user agent decides to display an [=implementation-defined=] navigation experience, e.g. a gesture-based transition for a back navigation, the user agent may ignore the author-defined view transition. If that is the case, return false. + 1. If |oldDocument|'s [=can initiate outbound view transition=] is false, then return false. + 1. If |navigationType| is {{NavigationType/reload}}, then return false. - 1. If |isBrowserUINavigation| is true, and |navigationType| is {{NavigationType/push}} or {{NavigationType/replace}}, then return false. + 1. If |oldDocument|'s [=Document/origin=] is not [=same origin=] as |newDocument|'s [=Document/origin=], then return false. - 1. If |oldOrigin| is not [=same origin=] as |newOrigin| then return false. + 1. If |navigationType| is {{NavigationType/traverse}}, then return true. - 1. If |navigationHasCrossOriginRedirects| is true, then return false. + 1. If |isBrowserUINavigation| is true, then return false. + + 1. If |newDocument| [=was created via cross-origin redirects=], then return false. 1. Return true.
@@ -683,11 +698,11 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a 1. [=Assert=]: These steps are running as part of a [=task=] queued on |oldDocument|. - 1. If |oldDocument|'s [=has been revealed=] is false, then return null. + 1. If |oldDocument|'s [=can initiate outbound view transition=] is false, then return null. - 1. Let |resolvedRule| be the result of [=Resolve @view-transition rule|resolving the @view-transition rule=] for |oldDocument|. + 1. Let |transitionTypesFromRule| be the result of [=Resolve @view-transition rule|resolving the @view-transition rule=] for |oldDocument|. - 1. If |resolvedRule| is "skip transition", then return null. + 1. [=Assert=]: |transitionTypesFromRule| is not "skip transition". Note: We don't know yet if |newDocument| has opted in, as it might not be parsed yet. We check the opt-in for |newDocument| when we fire the {{Window/pagereveal}} event. @@ -701,7 +716,7 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a 1. Let |outboundTransition| be a new {{ViewTransition}} object in |oldDocument|'s [=relevant Realm=]. - 1. Set |outboundTransition|'s [=ViewTransition/active types=]'s [=DOMTokenList/token set=] to |resolvedRule|. + 1. Set |outboundTransition|'s [=ViewTransition/active types=]'s [=DOMTokenList/token set=] to |transitionTypesFromRule|. Note: the [=ViewTransition/active types=] are not shared between documents. Manipulating the {{ViewTransition/typeList}} in the new document does not affect the types in the new document, @@ -732,10 +747,14 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a ### Accessing the view-transition in the new {{Document}} ### {#access-view-transition-in-new-doc}
- To resolve cross-document view-transition for {{Document}} |document|: + To resolve inbound cross-document view-transition for {{Document}} |document|: 1. [=Assert=]: |document| is [=fully active=]. + 1. [=Assert=]: |document| [=has been revealed=] is true. + + 1. [=Update the opt-in state for outbound transitions=] for |document|. + 1. Let |inboundViewTransitionParams| be |document|'s [=inbound view transition params=]. 1. If |inboundViewTransitionParams| is null, then return null. @@ -769,6 +788,14 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a 1. Return |transition|.
+### Updating the opt-in state for outbound view transitions ### {#update-opt-in-state-for-outbound} + +
+To update the opt-in state for outbound transitions for a {{Document}} |document|: + 1. If |document| [=has been revealed=], and the result of [=resolve @view-transition rule|resolving the @view-transition rule=] is not "skip transition", + then set |document|'s [=can initiate outbound view transition=] to true. + 1. Otherwise, set |document|'s [=can initiate outbound view transition=] to false. +

Privacy Considerations