Skip to content

Commit dff3cfb

Browse files
committed
[css-view-transitions] Rename UpdateCallback to something more specific.
The WebIDL namespace is global, it's a bit better if we call this something a bit more view-transitions-specific so that other specs don't rely on it, since UpdateCallback is otherwise very generic. I don't think this would be a normative change since the name of a callback isn't exposed anywhere author visible.
1 parent 0fa7654 commit dff3cfb

File tree

2 files changed

+22
-23
lines changed

2 files changed

+22
-23
lines changed

css-view-transitions-1/Overview.bs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,14 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
171171

172172
A successful [=view transition=] goes through the following phases:
173173

174-
1. Developer calls <code>document.{{Document/startViewTransition}}({{UpdateCallback|updateCallback}})</code>,
174+
1. Developer calls <code>document.{{Document/startViewTransition}}({{ViewTransitionUpdateCallback|updateCallback}})</code>,
175175
which returns a {{ViewTransition}}, <var>viewTransition</var>.
176176

177177
1. Current state captured as the “old” state.
178178

179179
1. Rendering paused.
180180

181-
1. Developer's {{UpdateCallback|updateCallback}} function, if provided, is called,
181+
1. Developer's {{ViewTransitionUpdateCallback|updateCallback}} function, if provided, is called,
182182
which updates the document state.
183183

184184
1. <code><var>viewTransition</var>.{{ViewTransition/updateCallbackDone}}</code> fulfills.
@@ -237,22 +237,22 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
237237
to an underlying document state change.
238238
That means a failure to create a visual transition,
239239
which can happen due to misconfiguration or device constraints,
240-
will not prevent the developer's {{UpdateCallback}} being called,
240+
will not prevent the developer's {{ViewTransitionUpdateCallback}} being called,
241241
even if it's known in advance that the transition animations cannot happen.
242242

243243
For example, if the developer calls {{ViewTransition/skipTransition()}} at the start of the [[#lifecycle|view transition lifecycle]],
244244
the steps relating to the animated transition,
245245
such as creating the [=view transition tree=],
246246
will not happen.
247-
However, the {{UpdateCallback}} will still be called.
247+
However, the {{ViewTransitionUpdateCallback}} will still be called.
248248
It's only the visual transition that's skipped,
249249
not the underlying state change.
250250

251251
Note: If the DOM change should also be skipped,
252252
then that needs to be handled by another feature.
253253
<code>{{NavigateEvent|navigateEvent}}.{{NavigateEvent/signal}}</code> is an example of a feature developers could use to handle this.
254254

255-
Although the View Transition API allows DOM changes to be asynchronous via the {{UpdateCallback}},
255+
Although the View Transition API allows DOM changes to be asynchronous via the {{ViewTransitionUpdateCallback}},
256256
the API is not responsible for queuing or otherwise scheduling DOM changes
257257
beyond any scheduling needed for the transition itself.
258258
Some asynchronous DOM changes can happen concurrently (e.g if they're happening within independent components),
@@ -935,29 +935,29 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
935935

936936
<xmp class=idl>
937937
partial interface Document {
938-
ViewTransition startViewTransition(optional UpdateCallback updateCallback);
938+
ViewTransition startViewTransition(optional ViewTransitionUpdateCallback updateCallback);
939939
};
940940

941-
callback UpdateCallback = Promise<any> ();
941+
callback ViewTransitionUpdateCallback = Promise<any> ();
942942
</xmp>
943943

944944
<dl class="domintro non-normative">
945-
: <code>{{ViewTransition|viewTransition}} = {{Document|document}}.{{startViewTransition}}({{UpdateCallback|updateCallback}})</code>
945+
: <code>{{ViewTransition|viewTransition}} = {{Document|document}}.{{startViewTransition}}({{ViewTransitionUpdateCallback|updateCallback}})</code>
946946
:: Starts a new [=view transition=]
947947
(canceling the {{Document|document}}’s existing [=active view transition=], if any).
948948

949-
{{UpdateCallback|updateCallback}}, if provided, is called asynchronously, once the current state of the document is captured.
950-
Then, when the promise returned by {{UpdateCallback|updateCallback}} fulfills,
949+
{{ViewTransitionUpdateCallback|updateCallback}}, if provided, is called asynchronously, once the current state of the document is captured.
950+
Then, when the promise returned by {{ViewTransitionUpdateCallback|updateCallback}} fulfills,
951951
the new state of the document is captured
952952
and the transition is initiated.
953953

954-
Note that {{UpdateCallback|updateCallback}}, if provided, is *always* called,
954+
Note that {{ViewTransitionUpdateCallback|updateCallback}}, if provided, is *always* called,
955955
even if the transition cannot happen
956956
(e.g. due to duplicate `view-transition-name` values).
957957
The transition is an enhancement around the state change, so a failure to create a transition never prevents the state change.
958958
See [[#transitions-as-enhancements]] for more details on this principle.
959959

960-
If the promise returned by {{UpdateCallback|updateCallback}} rejects, the transition is skipped.
960+
If the promise returned by {{ViewTransitionUpdateCallback|updateCallback}} rejects, the transition is skipped.
961961
</dl>
962962

963963
### {{Document/startViewTransition()}} Method Steps ### {#ViewTransition-prepare}
@@ -1010,7 +1010,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
10101010

10111011
<dl class="domintro non-normative">
10121012
: <code>{{ViewTransition|viewTransition}}.{{ViewTransition/updateCallbackDone}}</code>
1013-
:: A promise that fulfills when the promise returned by {{UpdateCallback|updateCallback}} fulfills, or rejects when it rejects.
1013+
:: A promise that fulfills when the promise returned by {{ViewTransitionUpdateCallback|updateCallback}} fulfills, or rejects when it rejects.
10141014

10151015
Note: The View Transition API wraps a DOM change and creates a visual transition.
10161016
However, sometimes you don't care about the success/failure of the transition animation,
@@ -1032,7 +1032,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
10321032
: <code>{{ViewTransition|viewTransition}}.{{ViewTransition/finished}}</code>
10331033
:: A promise that fulfills once the end state is fully visible and interactive to the user.
10341034

1035-
It only rejects if {{UpdateCallback|updateCallback}} returns a rejected promise,
1035+
It only rejects if {{ViewTransitionUpdateCallback|updateCallback}} returns a rejected promise,
10361036
as this indicates the end state wasn't created.
10371037

10381038
Otherwise, if a transition fails to begin,
@@ -1043,7 +1043,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
10431043
: <code>{{ViewTransition|viewTransition}}.{{ViewTransition/skipTransition}}()</code>
10441044
:: Immediately finish the transition, or prevent it starting.
10451045

1046-
This never prevents {{UpdateCallback|updateCallback}} being called,
1046+
This never prevents {{ViewTransitionUpdateCallback|updateCallback}} being called,
10471047
as the DOM change is independent of the transition.
10481048
See [[#transitions-as-enhancements]] for more details on this principle.
10491049

@@ -1073,7 +1073,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
10731073
The description of the phases below tries to be as precise as possible, with an intent to provide an unambiguous set of steps for implementors to follow in order to produce a spec-compliant implementation.
10741074

10751075
: <dfn>update callback</dfn>
1076-
:: an {{UpdateCallback}} or null. Initially null.
1076+
:: a {{ViewTransitionUpdateCallback}} or null. Initially null.
10771077

10781078
: <dfn>ready promise</dfn>
10791079
:: a {{Promise}}.
@@ -1248,7 +1248,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
12481248
perform the following steps:
12491249

12501250
Note: This algorithm captures the current state of the document,
1251-
calls the transition's {{UpdateCallback}},
1251+
calls the transition's {{ViewTransitionUpdateCallback}},
12521252
then captures the new state of the document.
12531253

12541254
1. Let |document| be |transition|'s [=relevant global object's=] [=associated document=].
@@ -1999,12 +1999,12 @@ Changes from <a href="https://www.w3.org/TR/2022/WD-css-view-transitions-1-20221
19991999
* Pointer events resolve to the documentElement when rendering is suppressed. See <a href="https://github.com/w3c/csswg-drafts/issues/7797">issue 7797</a>.
20002000
* Add rendering constraints to elements participating in a transition. See <a href="https://github.com/w3c/csswg-drafts/issues/8139">issue 8139</a> and <a href="https://github.com/w3c/csswg-drafts/issues/7882">issue 7882</a>.
20012001
* Remove html specifics from UA stylesheet to support ViewTransitions on SVG Documents.
2002-
* Rename updateDOMCallback to {{UpdateCallback}}. See <a href="https://github.com/w3c/csswg-drafts/issues/8144">issue 8144</a>.
2002+
* Rename updateDOMCallback to {{ViewTransitionUpdateCallback}}. See <a href="https://github.com/w3c/csswg-drafts/issues/8144">issue 8144</a>.
20032003
* Rename snapshot viewport to [=snapshot containing block=].
20042004
* Skip the transition if viewport size changes. See <a href="https://github.com/w3c/csswg-drafts/issues/8045">issue 8045</a>.
20052005
* Add support for :only-child. See <a href="https://github.com/w3c/csswg-drafts/issues/8057">issue 8057</a>.
20062006
* Add concept of a tree of pseudo-elements under [=pseudo-element root=]. See <a href="https://github.com/w3c/csswg-drafts/issues/8113">issue 8113</a>.
2007-
* When skipping a transition, the {{UpdateCallback}} is called in own task rather than synchronously. See <a href="https://github.com/w3c/csswg-drafts/issues/7904">issue 7904</a>
2007+
* When skipping a transition, the {{ViewTransitionUpdateCallback}} is called in own task rather than synchronously. See <a href="https://github.com/w3c/csswg-drafts/issues/7904">issue 7904</a>
20082008
* When capturing images, at least the in-viewport part of the image should be captured, downscale if needed. See <a href="https://github.com/w3c/csswg-drafts/issues/8561">issue 8561</a>.
20092009
* Applying the [=ink overflow=] to the captured image is implementation defined, and doesn't affect the image's [=natural size=]. See <a href="https://github.com/w3c/csswg-drafts/issues/8597">issue 8597</a>.
20102010
* Fragmented elements don't participate in view transitions. See <a href="https://github.com/w3c/csswg-drafts/issues/8339">issue 8339</a>.

css-view-transitions-2/Overview.bs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -714,13 +714,12 @@ div.box {
714714
# Extending {{Document/startViewTransition|document.startViewTransition()}} # {#extend-document-types}
715715
<xmp class=idl>
716716
dictionary StartViewTransitionOptions {
717-
UpdateCallback? update = null;
717+
ViewTransitionUpdateCallback? update = null;
718718
sequence<DOMString>? types = null;
719719
};
720720

721721
partial interface Document {
722-
723-
ViewTransition startViewTransition(optional (UpdateCallback or StartViewTransitionOptions) callbackOptions = {});
722+
ViewTransition startViewTransition(optional (ViewTransitionUpdateCallback or StartViewTransitionOptions) callbackOptions = {});
724723
};
725724
</xmp>
726725

@@ -730,7 +729,7 @@ div.box {
730729

731730
1. Let |updateCallback| be null.
732731

733-
1. If |callbackOptions| is an an {{UpdateCallback}}, set |updateCallback| to |callbackOptions|.
732+
1. If |callbackOptions| is a {{ViewTransitionUpdateCallback}}, set |updateCallback| to |callbackOptions|.
734733

735734
1. Otherwise, if |callbackOptions| is a {{StartViewTransitionOptions}}, then set |updateCallback| to |callbackOptions|'s {{StartViewTransitionOptions/update}}.
736735

0 commit comments

Comments
 (0)