Skip to content

Commit 9d5ed6f

Browse files
authored
[css-view-transitions-1] Refactor timings of updateCallbackDone and related (w3c#9774)
* [css-view-transitions-1] Fix timings * Reinstate one of the done checks * Add note about noop * Reposition note
1 parent 1a415a2 commit 9d5ed6f

File tree

1 file changed

+38
-34
lines changed

1 file changed

+38
-34
lines changed

css-view-transitions-1/Overview.bs

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,43 +1262,16 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
12621262

12631263
1. [=Queue a global task=] on the [=DOM manipulation task source=],
12641264
given |transition|'s [=relevant global object=],
1265-
to execute the following steps:
1265+
to perform the following steps:
12661266

12671267
Note: A task is queued here because the texture read back in [=capturing the image=] may be async,
12681268
although the render steps in the HTML spec act as if it's synchronous.
12691269

12701270
1. If |transition|'s [=ViewTransition/phase=] is "`done`", then abort these steps.
12711271

12721272
Note: This happens if |transition| was [=skip the view transition|skipped=] before this point.
1273-
The [=skip the view transition=] steps [=call the update callback=],
1274-
ensuring the |transition|'s [=ViewTransition/update callback=] is always called.
12751273

1276-
1. [=Call the update callback=] of |transition|.
1277-
1278-
1. [=promise/React=] to |transition|'s [=ViewTransition/update callback done promise=]:
1279-
1280-
* If the promise does not settle within an implementation-defined timeout, then:
1281-
1282-
1. If |transition|'s [=ViewTransition/phase=] is "`done`", then return.
1283-
1284-
Note: This happens if |transition| was [=skip the view transition|skipped=] before this point.
1285-
1286-
1. [=Skip the view transition=] |transition| with a "{{TimeoutError}}" {{DOMException}}.
1287-
1288-
* If the promise was rejected with reason |reason|, then:
1289-
1290-
1. If |transition|'s [=ViewTransition/phase=] is "`done`", then return.
1291-
1292-
Note: This happens if |transition| was [=skip the view transition|skipped=] before this point.
1293-
1294-
1. [=Mark as handled=] |transition|'s [=ViewTransition/ready promise=].
1295-
1296-
Note: |transition|'s [=ViewTransition/update callback done promise=] will provide the {{unhandledrejection}}.
1297-
This step avoids a duplicate.
1298-
1299-
1. [=Skip the view transition=] |transition| with |reason|.
1300-
1301-
* If the promise was fulfilled, then [=activate view transition|activate=] |transition|.
1274+
1. [=call the update callback=].
13021275
</div>
13031276

13041277
<div algorithm>
@@ -1319,6 +1292,8 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
13191292
If failure is returned, then [=skip the view transition=] for |transition| with an "{{InvalidStateError}}" {{DOMException}} in |transition|'s [=relevant Realm=],
13201293
and return.
13211294

1295+
1. [=Resolve=] |transition|'s [=ViewTransition/update callback done promise=] with undefined.
1296+
13221297
1. [=list/For each=] |capturedElement| of |transition|'s [=ViewTransition/named elements=]' [=map/values=]:
13231298

13241299
1. If |capturedElement|'s [=captured element/new element=] is not null,
@@ -1633,13 +1608,41 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
16331608

16341609
1. If |transition|'s [=ViewTransition/phase=] is not "`done`", then set |transition|'s [=ViewTransition/phase=] to "`update-callback-called`".
16351610

1636-
1. [=Resolve=] |transition|'s [=ViewTransition/update callback done promise=]
1637-
with the result of [=reacting=] to |callbackPromise|:
1611+
1. Let |fulfillSteps| be to following steps:
1612+
1. [=Activate view transition|Activate=] |transition|.
16381613

1639-
- If the promise was fulfilled, then return undefined.
1614+
1. [=Resolve=] |transition|'s [=ViewTransition/update callback done promise=] with undefined.
1615+
1616+
Note: This would be a no-op if the previous step already resolved the promise.
1617+
1618+
1. Let |rejectSteps| be the following steps given |reason|:
1619+
1. [=Reject=] |transition|'s [=ViewTransition/update callback done promise=] with |reason|.
1620+
1621+
1. If |transition|'s [=ViewTransition/phase=] is "`done`", then return.
1622+
1623+
Note: This happens if |transition| was [=skip the view transition|skipped=] before this point.
1624+
1625+
1. [=Mark as handled=] |transition|'s [=ViewTransition/ready promise=].
1626+
1627+
Note: |transition|'s [=ViewTransition/update callback done promise=] will provide the {{unhandledrejection}}.
1628+
This step avoids a duplicate.
1629+
1630+
1. [=Skip the view transition=] |transition| with |reason|.
1631+
1632+
1. [=React=] to |callbackPromise| with |fulfillSteps| and |rejectSteps|.
1633+
1634+
1. To skip a transition after a timeout, the user agent may perform the following steps [=in parallel=]:
1635+
1. Wait for an implementation-defined [=duration=].
1636+
1637+
1. [=Queue a global task=] on the [=DOM manipulation task source=],
1638+
given |transition|'s [=relevant global object=], to perform the following steps:
1639+
1640+
1. If |transition|'s [=ViewTransition/phase=] is "`done`", then return.
1641+
1642+
Note: This happens if |transition| was [=skip the view transition|skipped=] before this point.
1643+
1644+
1. [=skip the view transition|Skip=] |transition| with a "{{TimeoutError}}" {{DOMException}}.
16401645

1641-
Note: Since the rejection of |callbackPromise| isn't explicitly handled here,
1642-
if |callbackPromise| rejects, then |transition|'s [=ViewTransition/update callback done promise=] will reject with the same reason.
16431646
</div>
16441647

16451648
## [=Skip the view transition=] ## {#skip-the-view-transition-algorithm}
@@ -1951,6 +1954,7 @@ Changes from <a href="https://www.w3.org/TR/2023/WD-css-view-transitions-1-20230
19511954
* `view-transition-name: auto` should be an invalid value. See <a href="https://github.com/w3c/csswg-drafts/issues/9639">issue 9639</a>.
19521955
* Add note to explain paint order for entry animations. See <a href="https://github.com/w3c/csswg-drafts/issues/9672">issue 9672</a>.
19531956
* Add note to explain how the named elements are cleaned up. See <a href="https://github.com/w3c/csswg-drafts/issues/9669">issue 9669</a>.
1957+
* Refactor algorithm to clarify timing, especially of `updateCallbackDone. See <a href="https://github.com/w3c/csswg-drafts/issues/9762">issue 9762</a>.
19541958

19551959
<h3 id="changes-since-2022-05-25">
19561960
Changes from <a href="https://www.w3.org/TR/2023/WD-css-view-transitions-1-20230525/">2022-05-25 Working Draft</a>

0 commit comments

Comments
 (0)