From e117bf1de74c3f0006d9e444a229b7ca68d4a8e5 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Mon, 8 Jan 2024 16:23:45 +0000 Subject: [PATCH 1/4] [css-view-transitions-1] Fix timings --- css-view-transitions-1/Overview.bs | 74 ++++++++++++++---------------- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/css-view-transitions-1/Overview.bs b/css-view-transitions-1/Overview.bs index 061334f6c02..c8b121810c9 100644 --- a/css-view-transitions-1/Overview.bs +++ b/css-view-transitions-1/Overview.bs @@ -1262,43 +1262,10 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; 1. [=Queue a global task=] on the [=DOM manipulation task source=], given |transition|'s [=relevant global object=], - to execute the following steps: + to [=call the update callback=]. Note: A task is queued here because the texture read back in [=capturing the image=] may be async, although the render steps in the HTML spec act as if it's synchronous. - - 1. If |transition|'s [=ViewTransition/phase=] is "`done`", then abort these steps. - - Note: This happens if |transition| was [=skip the view transition|skipped=] before this point. - The [=skip the view transition=] steps [=call the update callback=], - ensuring the |transition|'s [=ViewTransition/update callback=] is always called. - - 1. [=Call the update callback=] of |transition|. - - 1. [=promise/React=] to |transition|'s [=ViewTransition/update callback done promise=]: - - * If the promise does not settle within an implementation-defined timeout, then: - - 1. If |transition|'s [=ViewTransition/phase=] is "`done`", then return. - - Note: This happens if |transition| was [=skip the view transition|skipped=] before this point. - - 1. [=Skip the view transition=] |transition| with a "{{TimeoutError}}" {{DOMException}}. - - * If the promise was rejected with reason |reason|, then: - - 1. If |transition|'s [=ViewTransition/phase=] is "`done`", then return. - - Note: This happens if |transition| was [=skip the view transition|skipped=] before this point. - - 1. [=Mark as handled=] |transition|'s [=ViewTransition/ready promise=]. - - Note: |transition|'s [=ViewTransition/update callback done promise=] will provide the {{unhandledrejection}}. - This step avoids a duplicate. - - 1. [=Skip the view transition=] |transition| with |reason|. - - * If the promise was fulfilled, then [=activate view transition|activate=] |transition|.
@@ -1319,6 +1286,8 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; If failure is returned, then [=skip the view transition=] for |transition| with an "{{InvalidStateError}}" {{DOMException}} in |transition|'s [=relevant Realm=], and return. + 1. [=Resolve=] |transition|'s [=ViewTransition/update callback done promise=] with undefined. + 1. [=list/For each=] |capturedElement| of |transition|'s [=ViewTransition/named elements=]' [=map/values=]: 1. If |capturedElement|'s [=captured element/new element=] is not null, @@ -1633,13 +1602,39 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; 1. If |transition|'s [=ViewTransition/phase=] is not "`done`", then set |transition|'s [=ViewTransition/phase=] to "`update-callback-called`". - 1. [=Resolve=] |transition|'s [=ViewTransition/update callback done promise=] - with the result of [=reacting=] to |callbackPromise|: + 1. Let |fulfillSteps| be to following steps: + 1. [=Activate view transition|Activate=] |transition|. - - If the promise was fulfilled, then return undefined. + 1. If |transition|'s [=ViewTransition/phase=] is "`done`", then [=resolve=] |transition|'s [=ViewTransition/update callback done promise=] with undefined. + + 1. Let |rejectSteps| be the following steps given |reason|: + 1. [=Reject=] |transition|'s [=ViewTransition/update callback done promise=] with |reason|. + + 1. If |transition|'s [=ViewTransition/phase=] is "`done`", then return. + + Note: This happens if |transition| was [=skip the view transition|skipped=] before this point. + + 1. [=Mark as handled=] |transition|'s [=ViewTransition/ready promise=]. + + Note: |transition|'s [=ViewTransition/update callback done promise=] will provide the {{unhandledrejection}}. + This step avoids a duplicate. + + 1. [=Skip the view transition=] |transition| with |reason|. + + 1. [=React=] to |callbackPromise| with |fulfillSteps| and |rejectSteps|. + + 1. To skip a transition after a timeout, the user agent may perform the following steps [=in parallel=]: + 1. Wait for an implementation-defined [=duration=]. + + 1. [=Queue a global task=] on the [=DOM manipulation task source=], + given |transition|'s [=relevant global object=], to perform the following steps: + + 1. If |transition|'s [=ViewTransition/phase=] is "`done`", then return. + + Note: This happens if |transition| was [=skip the view transition|skipped=] before this point. + + 1. [=skip the view transition|Skip=] |transition| with a "{{TimeoutError}}" {{DOMException}}. - Note: Since the rejection of |callbackPromise| isn't explicitly handled here, - if |callbackPromise| rejects, then |transition|'s [=ViewTransition/update callback done promise=] will reject with the same reason.
## [=Skip the view transition=] ## {#skip-the-view-transition-algorithm} @@ -1951,6 +1946,7 @@ Changes from issue 9639. * Add note to explain paint order for entry animations. See issue 9672. * Add note to explain how the named elements are cleaned up. See issue 9669. +* Refactor algorithm to clarify timing, especially of `updateCallbackDone. See issue 9762.

Changes from 2022-05-25 Working Draft From f73bcd1fba07f351a933a1a3b89a43c9ef26ba9d Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Mon, 8 Jan 2024 20:40:53 +0000 Subject: [PATCH 2/4] Reinstate one of the done checks --- css-view-transitions-1/Overview.bs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/css-view-transitions-1/Overview.bs b/css-view-transitions-1/Overview.bs index c8b121810c9..68fadbb97e7 100644 --- a/css-view-transitions-1/Overview.bs +++ b/css-view-transitions-1/Overview.bs @@ -1262,7 +1262,13 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; 1. [=Queue a global task=] on the [=DOM manipulation task source=], given |transition|'s [=relevant global object=], - to [=call the update callback=]. + to perform the following steps: + + 1. If |transition|'s [=ViewTransition/phase=] is "`done`", then abort these steps. + + Note: This happens if |transition| was [=skip the view transition|skipped=] before this point. + + 1. [=call the update callback=]. Note: A task is queued here because the texture read back in [=capturing the image=] may be async, although the render steps in the HTML spec act as if it's synchronous. From d398eae20401989a905118c2b4dd36a025d4524f Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Mon, 8 Jan 2024 20:46:22 +0000 Subject: [PATCH 3/4] Add note about noop --- css-view-transitions-1/Overview.bs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/css-view-transitions-1/Overview.bs b/css-view-transitions-1/Overview.bs index 68fadbb97e7..951f0115e2c 100644 --- a/css-view-transitions-1/Overview.bs +++ b/css-view-transitions-1/Overview.bs @@ -1611,7 +1611,9 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; 1. Let |fulfillSteps| be to following steps: 1. [=Activate view transition|Activate=] |transition|. - 1. If |transition|'s [=ViewTransition/phase=] is "`done`", then [=resolve=] |transition|'s [=ViewTransition/update callback done promise=] with undefined. + 1. [=Resolve=] |transition|'s [=ViewTransition/update callback done promise=] with undefined. + + Note: This would be a no-op if the previous step already resolved the promise. 1. Let |rejectSteps| be the following steps given |reason|: 1. [=Reject=] |transition|'s [=ViewTransition/update callback done promise=] with |reason|. From 80850e55aa0465cd7c3206b934244cf248478733 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Tue, 9 Jan 2024 20:48:12 +0000 Subject: [PATCH 4/4] Reposition note --- css-view-transitions-1/Overview.bs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/css-view-transitions-1/Overview.bs b/css-view-transitions-1/Overview.bs index 951f0115e2c..bf0deba5f57 100644 --- a/css-view-transitions-1/Overview.bs +++ b/css-view-transitions-1/Overview.bs @@ -1264,14 +1264,14 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; given |transition|'s [=relevant global object=], to perform the following steps: + Note: A task is queued here because the texture read back in [=capturing the image=] may be async, + although the render steps in the HTML spec act as if it's synchronous. + 1. If |transition|'s [=ViewTransition/phase=] is "`done`", then abort these steps. Note: This happens if |transition| was [=skip the view transition|skipped=] before this point. 1. [=call the update callback=]. - - Note: A task is queued here because the texture read back in [=capturing the image=] may be async, - although the render steps in the HTML spec act as if it's synchronous.