Skip to content

Commit 2a9e5d5

Browse files
committed
[css-view-transitions-2] Update the algorithm to check opt-in on outbound transition
Instead of relying on the source snapshot params in HTML, we update a flag every time something relevant changes, and HTML can read that flag.
1 parent 1b9e2a0 commit 2a9e5d5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

css-view-transitions-2/Overview.bs

+22
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,10 @@ Note: as per default behavior, the ''@view-transition'' rule can be nested insid
435435
The '<dfn for="@view-transition">type</dfn>' descriptor sets the [=ViewTransition/active types=] for the transition
436436
when capturing and performing the transition, equivalent to calling {{Document/startViewTransition(callbackOptions)}} with that {{StartViewTransitionOptions/type}}.
437437

438+
## Responding to changes in the ''@view-transition'' rule ## {#respond-to-rule-changes}
439+
440+
When the ''@view-transition'' rule changes for {{Document}} |document|, [=update the opt-in state for outbound transitions=] given |document|.
441+
438442
# API # {#api}
439443

440444
## Additions to {{Document}} ## {#additions-to-document-api}
@@ -512,6 +516,12 @@ The {{CSSViewTransitionRule}} represents a ''@view-transition'' rule.
512516
: <dfn>inbound view transition params</dfn>
513517
:: a [=view transition params=], or null.
514518
Initially null.
519+
520+
: <dfn export>can initiate outbound view transition</dfn>
521+
:: a boolean.
522+
Initially false.
523+
524+
Note: this value can be read [=in parallel=] while navigating.
515525
</dl>
516526

517527
### The View transition params struct ### {#view-transition-params-struct}
@@ -706,6 +716,10 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a
706716

707717
1. [=Assert=]: |document| is [=fully active=].
708718

719+
1. [=Assert=]: |document| [=has been revealed=] is true.
720+
721+
1. [=Update the opt-in state for outbound transitions=] for |document|.
722+
709723
1. Let |inboundViewTransitionParams| be |document|'s [=inbound view transition params=].
710724

711725
1. If |inboundViewTransitionParams| is null, then return null.
@@ -739,6 +753,14 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a
739753
1. Return |transition|.
740754
</div>
741755

756+
### Updating the opt-in state for outbound view transitions ### {#update-opt-in-state-for-outbound}
757+
758+
<div algorithm="update-opt-in-for-outbound">
759+
To <dfn>update the opt-in state for outbound transitions</dfn> for a {{Document}} |document|:
760+
1. If |document| [=has been revealed=], and the result of [=resolve @view-transition rule|resolving the @view-transition rule=] is not "<code>skip transition</code>",
761+
then set |document|'s [=can initiate outbound view transition=] to true.
762+
1. Otherwise, set |document|'s [=can initiate outbound view transition=] to false.
763+
742764

743765
<h2 id="priv" class="no-num">Privacy Considerations</h2>
744766

0 commit comments

Comments
 (0)