Skip to content

Commit

Permalink
Fixes #9460 (#9493)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmpstr authored Oct 18, 2023
1 parent 0d9927d commit fae0709
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
11 changes: 6 additions & 5 deletions css-view-transitions-1/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;

1. Rendering paused.

1. Developer's {{UpdateCallback|updateCallback}} function is called,
1. Developer's {{UpdateCallback|updateCallback}} function, if provided, is called,
which updates the document state.

1. <code><var>viewTransition</var>.{{ViewTransition/updateCallbackDone}}</code> fulfills.
Expand Down Expand Up @@ -901,7 +901,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;

<xmp class=idl>
partial interface Document {
ViewTransition startViewTransition(optional UpdateCallback? updateCallback = null);
ViewTransition startViewTransition(optional UpdateCallback updateCallback);
};

callback UpdateCallback = Promise<any> ();
Expand All @@ -912,12 +912,12 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
:: Starts a new [=view transition=]
(canceling the {{Document|document}}’s existing [=active view transition=], if any).

{{UpdateCallback|updateCallback}} is called asynchronously, once the current state of the document is captured.
{{UpdateCallback|updateCallback}}, if provided, is called asynchronously, once the current state of the document is captured.
Then, when the promise returned by {{UpdateCallback|updateCallback}} fulfills,
the new state of the document is captured
and the transition is initiated.

Note that {{UpdateCallback|updateCallback}} is *always* called,
Note that {{UpdateCallback|updateCallback}}, if provided, is *always* called,
even if the transition cannot happen
(e.g. due to duplicate `view-transition-name` values).
The transition is an enhancement around the state change, so a failure to create a transition never prevents the state change.
Expand All @@ -933,7 +933,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;

1. Let |transition| be a new {{ViewTransition}} object in [=this's=] [=relevant Realm=].

1. Set |transition|'s [=ViewTransition/update callback=] to |updateCallback|.
1. If |updateCallback| is provided, set |transition|'s [=ViewTransition/update callback=] to |updateCallback|.

1. Let |document| be [=this's=] [=relevant global object's=] [=associated document=].

Expand Down Expand Up @@ -1884,6 +1884,7 @@ Changes from <a href="https://www.w3.org/TR/2023/WD-css-view-transitions-1-20230
* Add mix-blend-mode to list of properties copied over to the ''::view-transition-group''. See <a href="https://github.com/w3c/csswg-drafts/issues/8962">issue 8962</a>.
* Add text-orientation to list of properties copied over to the ''::view-transition-group''. See <a href="https://github.com/w3c/csswg-drafts/issues/8230">issue 8230</a>.
* Refactor the old capture algorithm to properly set [=captured in a view transition=] before reading the value.
* Make the {{Document/startViewTransition()}} parameter non-nullable. See <a href="https://github.com/w3c/csswg-drafts/issues/9460">issue 9460</a>.

<h3 id="changes-since-2022-05-25">
Changes from <a href="https://www.w3.org/TR/2023/WD-css-view-transitions-1-20230525/">2022-05-25 Working Draft</a>
Expand Down
12 changes: 7 additions & 5 deletions css-view-transitions-2/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -333,20 +333,22 @@ The <dfn attribute for=RevealEvent>viewTransition</dfn> [=getter steps=] are to

partial interface Document {

ViewTransition startViewTransition((UpdateCallback or StartViewTransitionOptions?) callbackOptionsOrNull);
ViewTransition startViewTransition(optional (UpdateCallback or StartViewTransitionOptions) callbackOptions);
};
</xmp>

### {{Document/startViewTransition(options)}} Method Steps ### {#ViewTransition-start-with-options}

<div algorithm="start-vt-with-options">
The [=method steps=] for <dfn method for=Document>startViewTransition(|callbackOptionsOrNull|)</dfn> are as follows:
The [=method steps=] for <dfn method for=Document>startViewTransition(|callbackOptions|)</dfn> are as follows:

1. If |callbackOptionsOrNull| is an {{UpdateCallback}} or null, then run the [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptionsOrNull| and return the result.
1. If |callbackOptions| is not provided, then run the [=method steps=] for {{Document/startViewTransition()}} and return the result.

1. Let |viewTransition| be the result of running [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptionsOrNull|'s {{StartViewTransitionOptions/update}}.
1. If |callbackOptions| is an {{UpdateCallback}}, then run the [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptions| and return the result.

1. Set |transition|'s [=ViewTransition/active types=] to |callbackOptionsOrNull|'s {{StartViewTransitionOptions/types}}.
1. Let |viewTransition| be the result of running [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptions|'s {{StartViewTransitionOptions/update}}.

1. Set |transition|'s [=ViewTransition/active types=] to |callbackOptions|'s {{StartViewTransitionOptions/types}}.

1. Return |viewTransition|.
</div>
Expand Down

0 comments on commit fae0709

Please sign in to comment.