From 75135b4a09506f2d69b42154958a372cb64cfbbc Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Sun, 2 Jul 2023 20:36:50 +0300 Subject: [PATCH 01/22] WIP css-view-transitions-2 --- css-view-transitions-2/Overview.bs | 247 +++++++++++++++++++++++++++++ 1 file changed, 247 insertions(+) create mode 100644 css-view-transitions-2/Overview.bs diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs new file mode 100644 index 00000000000..b505cef076c --- /dev/null +++ b/css-view-transitions-2/Overview.bs @@ -0,0 +1,247 @@ +
+Title: CSS View Transitions Module Level 2
+Shortname: css-view-transitions
+Level: 2
+Status: WD
+Group: csswg
+Date: 2023-05-30
+Prepare for TR: yes
+ED: https://drafts.csswg.org/css-view-transitions-2/
+TR: https://www.w3.org/TR/css-view-transitions-2/
+Work Status: exploring
+Editor: Noam Rosenthal, Google, w3cid 121539
+Editor: Khushal Sagar, Google, w3cid 122787
+Editor: Tab Atkins-Bittner, Google, http://xanthir.com/contact/, w3cid 42199
+Abstract: This module defines how the View Transition API works with cross-document navigations.
+Markup Shorthands: css yes, markdown yes
+
+ + + +
+urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
+	text: NavigateEvent
+	text: signal; for: NavigateEvent; url: #ref-for-dom-navigateevent-signalâ‘ 
+
+ + + +# Introduction # {#intro} + + *This section is non-normative.* + + View Transitions, as specified in [css-view-transitions-1], is a feature that allows developers + to create animated transitions between visual states of the [=/document=]. + + Level 2 extends that specification, by adding the necessary API and lifecycle to enable + transitions across a same-origin cross-document navigation. + + +## Lifecycle ## {#lifecycle} + + A successful cross-document view transition goes through the following phases: + + 1. The user navigates, by clicking a link, submitting a form, traversing history using the + browser API, etc. + + 1. Once it's time to [=unload=] the old document, if the navigation is [=same origin=] + and the old {{Document}} has opted in to cross-document view-transitions, the old state is captured. + + 1. Right before the new {{Document}} has a new [=rendering opportunity=], its state is captured as + the "new" state. + + 1. An event named `reveal` is fired on the new {{Document}}, with a `viewTransition` property, + which is a {{ViewTransition}} object. This {{ViewTransition}}'s {{ViewTransition/updateCallbackDone}} is already resolved, + and its [=captured elements=] are populated from the old {{Document}}. + + 1. From this point forward, the transition continues as if it was a same-document transition, as per [=activate view transition=]. + + +# CSS rules # {#css-rules} + +## The ''@auto-view-transition'' rule ## {#auto-view-transition-rule} +

@auto-view-transition rule grammar

+ +''@auto-view-transition'' rules are [=CSS/parsed=] according to the following grammar, +plus the additional rules noted below: + +
+	@auto-view-transition = @auto-view-transition { <> }
+
+ +## The [=@auto-view-transition/same-origin=] property ## {#view-transition-name-prop} + +
+	Name: same-origin
+	For: @auto-view-transition
+	Value: enabled | disabled
+	Initial: disabled
+	
+ + The 'same-origin' property opts in to automatically performing a view transition when performing a [=same origin=] navigation. + It needs to be enabled both in the old document (when unloading) and in the new document (when ready to render). + +
+ : disabled + :: There will be no transition. + + : enabled + :: The transition will be enabled if the navigation is same-origin, without cross-origin + redirects. +
+ +# API # {#api} + +## The `reveal` event ## {#reveal-document-algorithm} + +Note: this should go in the HTML spec. See [Issue 9315](https://github.com/whatwg/html/issues/9315). + + + [Exposed=Window] + interface PageRevealEvent : Event { + readonly attribute ViewTransition? viewTransition; + }; + + +The {{PageRevealEvent/viewTransition}} [=getter steps=] are to return the +[=inbound cross-document view-transition=] for [=this's=] [=relevant global object's=] [=associated document=]. + + + +# Algorithms # {#algorithms} + +## Additions to {{ViewTransition}} ## {#view-transitions-extension} + + A {{ViewTransition}} additionally has: +
+ : is cross-document + :: a boolean, initially false. +
+ +## Monkey patches to HTML ## {#monkey-patch-to-html} + +
+ Run the following step before updating the visibility state in the [=unload=] steps: + + 1. If |newDocument| is given, then [=setup outbound cross-document view transition=] given |oldDocument| and |newDocument|. +
+ +
+ Run the following step at the end of [=unblock rendering=]: + + 1. [=reveal document|reveal=] |document|. + + Reword the text in the [=render-blocked=] definition, to call [=reveal document=] |document| if the [=implementation-defined=] timeout value has been exceeded. +
+ +
+ Run the following step in [=Document/reactivate=], before step 4 (querying for [=page showing=]): + + 1. [=reveal document|reveal=] |document|. +
+ +
+ To reveal {{Document}} |document|: + 1. Assert: |document|'s [=page showing=] is false. + + 1. If |document| is [=render-blocked=] then return. + + 1. Fire a new {{PageRevealEvent}}. + + 1. Let |transition| be the result of getting the [=inbound cross-document view-transition=] for |document|. + + 1. If |transition| is not null, then [=activate view transition|activate=] |transition|. +
+ +## Setting up and activating the cross-document view transition + +
+ To setup outbound cross-document view transition given a {{Document}} |oldDocument| + and a {{Document}} |newDocument|: + + 1. Assert: this is called when |oldDocument| is [=unloading=]. + + 1. If |oldDocument|'s [=active view transition=] is not null, + then [=skip the view transition|skip=] |oldDocument|'s [=active view transition=] + with an "{{AbortError}}" {{DOMException}} in |oldDocument|'s [=relevant Realm=]. + + 1. If |oldDocument|'s [=environment settings object/origin=] is not [=same origin=] as + |newDocument|'s [=environment settings object/origin=] then return. + + 1. If |newDocument| [=was created via cross-origin redirects=] is true + and |newDocument|'s [=latest entry=] is null, then return. + + Note: A document with a non-null [=latest entry=] + is being [=Document/reactivated=], in which case we don't need to check for cross-origin redirects. + + 1. If |oldDocument| does not [=opt in to cross-document view transitions=], then return. + + Note: we don't know yet if |newDocument| has opted in. + + 1. Let |transition| be a new {{ViewTransition}} object in |oldDocument|'s [=relevant Realm=]. + + 1. [=Capture the old state=] for |transition|. If this fails, return. + + Note: implementations might need to [=queue a task=] in order to [=capture the old state=]. + However, this should not have web-observable side-effects. + + 1. [=Queue a global task=] on the [=DOM manipulation task source=], + given |newDocument|'s [=relevant global object=], to set |newDocument|'s + [=active view transition=] to a new {{ViewTransition}} in |newDocument|'s [=relevant Realm=], + whose [=ViewTransition/named elements=] is |transition|'s [=ViewTransition/named elements=], + [=ViewTransition/update callback done promise=] is [=a promise resolved with=] undefined, + [=ViewTransition/initial snapshot containing block size=] is |transition|'s [=ViewTransition/initial snapshot containing block size=], + and whose [=ViewTransition/is cross-document=] is true. + + Note: this task would run before any script on the new {{Document}}. +
+ +
+ To get the inbound cross-document view-transition for a {{Document}} |document|: + + 1. If |document| does not [=opt in to cross-document view transitions=], then return null. + + 1. Let |transition| be |document|'s [=active view transition=]. + + 1. If |transition| is null or |transition|'s [=ViewTransition/is cross-document=] is false, + then return null. + + Note: |transition|'s [=ViewTransition/is cross-document=] would be false if a same-document + transition was started before the page was revealed. + + 1. Return |transition|. +
+ +
+ A {{Document}} |document| is said to opt in to cross-document view transitions + if the [=computed value=] of same-origin + is enabled. +
+ + +

Privacy Considerations

+ +This specification introduces no new privacy considerations. + +

Security Considerations

From 8a3a87f8c8955bba8c828ee87e76cf83b6f64d8c Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Tue, 4 Jul 2023 14:44:18 +0300 Subject: [PATCH 02/22] Add examples --- css-view-transitions-2/Overview.bs | 148 ++++++++++++++++++++++++++--- 1 file changed, 137 insertions(+), 11 deletions(-) diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs index b505cef076c..b2e08052381 100644 --- a/css-view-transitions-2/Overview.bs +++ b/css-view-transitions-2/Overview.bs @@ -45,6 +45,49 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; text: signal; for: NavigateEvent; url: #ref-for-dom-navigateevent-signalâ‘  + # Introduction # {#intro} @@ -71,12 +114,92 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; 1. Right before the new {{Document}} has a new [=rendering opportunity=], its state is captured as the "new" state. - 1. An event named `reveal` is fired on the new {{Document}}, with a `viewTransition` property, + 1. An event named [[#reveal-event|`reveal`]] is fired on the new {{Document}}, with a `viewTransition` property, which is a {{ViewTransition}} object. This {{ViewTransition}}'s {{ViewTransition/updateCallbackDone}} is already resolved, and its [=captured elements=] are populated from the old {{Document}}. 1. From this point forward, the transition continues as if it was a same-document transition, as per [=activate view transition=]. +## Examples ## {#examples} + +
+ To generate the same cross-fade as in the first example [[css-view-transitions-1#examples]], + but across documents, we don't need JavaScript. + + Instead, we opt in to auto-view-transitions in both page 1 and page 2: + + ```css + // in both documents: + @auto-view-transitions { + same-origin: enable; + } + ``` + + A link from page 1 to or from page 2 would generate a crossfade transition for example 1. + To achieve the effect examples 2, 3 & 4, simply put the CSS for the pseudo-elements in both + documents. +
+ +
+ To achieve the effect in [[css-view-transitions-1#examples|example 5]], we have to do several + things: + + - Opt-in to auto-view-transitions in both pages. + - Pass the click location to the new document, e.g. via {{WindowSessionStorage/sessionStorage}}. + - Intercept the {{ViewTransition}} object in the new document, using the [[#reveal-event|`reveal` event]]. + + In both pages: + ```css + @auto-view-transitions { + same-origin: enable; + } + + ``` + + In the old page: + ```js + addEventListener('click', event => { + sessionStorage.setItem("lastClickX", event.clientX); + sessionStorage.setItem("lastClickY", event.clientY); + }); + ``` + + In the new page: + ```js + // This would run both on initial load and on reactivation from BFCache. + addEventListener("reveal", async event => { + if (!event.viewTransition) + return; + + const x = sessionStorage.getItem("lastClickX") ?? innerWidth / 2; + const y = sessionStorage.getItem("lastClickY") ?? innerHeight / 2; + + const endRadius = Math.hypot( + Math.max(x, innerWidth - x), + Math.max(y, innerHeight - y) + ); + + await event.viewTransition.ready; + + // Animate the new document's view + document.documentElement.animate( + { + clipPath: [ + `circle(0 at ${x}px ${y}px)`, + `circle(${endRadius}px at ${x}px ${y}px)`, + ], + }, + { + duration: 500, + easing: 'ease-in', + pseudoElement: '::view-transition-new(root)' + } + ); + }) + ``` +
+ + # CSS rules # {#css-rules} @@ -113,7 +236,7 @@ plus the additional rules noted below: # API # {#api} -## The `reveal` event ## {#reveal-document-algorithm} +## The PageRevealEvent ## {#reveal-event} Note: this should go in the HTML spec. See [Issue 9315](https://github.com/whatwg/html/issues/9315). @@ -124,7 +247,7 @@ Note: this should go in the HTML spec. See [Issue 9315](https://github.com/whatw }; -The {{PageRevealEvent/viewTransition}} [=getter steps=] are to return the +The viewTransition [=getter steps=] are to return the [=inbound cross-document view-transition=] for [=this's=] [=relevant global object's=] [=associated document=]. @@ -167,7 +290,8 @@ The {{PageRevealEvent/viewTransition}} [=getter steps=] are to return the 1. If |document| is [=render-blocked=] then return. - 1. Fire a new {{PageRevealEvent}}. + 1. Fire a new event named reveal on |document|'s [=relevant global object=], + using {{PageRevealEvent}}. 1. Let |transition| be the result of getting the [=inbound cross-document view-transition=] for |document|. @@ -197,7 +321,8 @@ The {{PageRevealEvent/viewTransition}} [=getter steps=] are to return the 1. If |oldDocument| does not [=opt in to cross-document view transitions=], then return. - Note: we don't know yet if |newDocument| has opted in. + Note: we don't know yet if |newDocument| has opted in, as it might not be parsed yet. + We check the opt-in for |newDocument| when it is [=reveal document|revealed=]. 1. Let |transition| be a new {{ViewTransition}} object in |oldDocument|'s [=relevant Realm=]. @@ -207,12 +332,13 @@ The {{PageRevealEvent/viewTransition}} [=getter steps=] are to return the However, this should not have web-observable side-effects. 1. [=Queue a global task=] on the [=DOM manipulation task source=], - given |newDocument|'s [=relevant global object=], to set |newDocument|'s - [=active view transition=] to a new {{ViewTransition}} in |newDocument|'s [=relevant Realm=], - whose [=ViewTransition/named elements=] is |transition|'s [=ViewTransition/named elements=], - [=ViewTransition/update callback done promise=] is [=a promise resolved with=] undefined, - [=ViewTransition/initial snapshot containing block size=] is |transition|'s [=ViewTransition/initial snapshot containing block size=], - and whose [=ViewTransition/is cross-document=] is true. + given |newDocument|'s [=relevant global object=], to perform the following step: + + 1. Set |newDocument|'s [=active view transition=] to a new {{ViewTransition}} in |newDocument|'s [=relevant Realm=], + whose [=ViewTransition/named elements=] is |transition|'s [=ViewTransition/named elements=], + [=ViewTransition/update callback done promise=] is [=a promise resolved with=] undefined, + [=ViewTransition/initial snapshot containing block size=] is |transition|'s [=ViewTransition/initial snapshot containing block size=], + and whose [=ViewTransition/is cross-document=] is true. Note: this task would run before any script on the new {{Document}}. From a3508dd75b4a7332d36d9fd6b9f6b4fd1ae0cf0b Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Wed, 12 Jul 2023 09:47:56 +0300 Subject: [PATCH 03/22] Update css-view-transitions-2/Overview.bs Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com> --- css-view-transitions-2/Overview.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs index b2e08052381..84d22ea74b4 100644 --- a/css-view-transitions-2/Overview.bs +++ b/css-view-transitions-2/Overview.bs @@ -321,7 +321,7 @@ The viewTransition [=getter steps=] are 1. If |oldDocument| does not [=opt in to cross-document view transitions=], then return. - Note: we don't know yet if |newDocument| has opted in, as it might not be parsed yet. + Note: We don't know yet if |newDocument| has opted in, as it might not be parsed yet. We check the opt-in for |newDocument| when it is [=reveal document|revealed=]. 1. Let |transition| be a new {{ViewTransition}} object in |oldDocument|'s [=relevant Realm=]. From 4aefea27c82a0bc492a7b8e62df859de62a4a756 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Wed, 12 Jul 2023 09:48:07 +0300 Subject: [PATCH 04/22] Update css-view-transitions-2/Overview.bs Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com> --- css-view-transitions-2/Overview.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs index 84d22ea74b4..f28b3b15918 100644 --- a/css-view-transitions-2/Overview.bs +++ b/css-view-transitions-2/Overview.bs @@ -106,7 +106,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; A successful cross-document view transition goes through the following phases: 1. The user navigates, by clicking a link, submitting a form, traversing history using the - browser API, etc. + browser UI, etc. 1. Once it's time to [=unload=] the old document, if the navigation is [=same origin=] and the old {{Document}} has opted in to cross-document view-transitions, the old state is captured. From fdc79c0f1044c510bc7ace5e8fceb017a0f7f028 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Wed, 12 Jul 2023 09:48:29 +0300 Subject: [PATCH 05/22] Update css-view-transitions-2/Overview.bs Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com> --- css-view-transitions-2/Overview.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs index f28b3b15918..10ba4a4d5b7 100644 --- a/css-view-transitions-2/Overview.bs +++ b/css-view-transitions-2/Overview.bs @@ -111,7 +111,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; 1. Once it's time to [=unload=] the old document, if the navigation is [=same origin=] and the old {{Document}} has opted in to cross-document view-transitions, the old state is captured. - 1. Right before the new {{Document}} has a new [=rendering opportunity=], its state is captured as + 1. Right before the new {{Document}} has the first [=rendering opportunity=], its state is captured as the "new" state. 1. An event named [[#reveal-event|`reveal`]] is fired on the new {{Document}}, with a `viewTransition` property, From 2c0b271a78aa0d27f7d2032449220ff0bef9b7cc Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Wed, 12 Jul 2023 10:42:05 +0300 Subject: [PATCH 06/22] Many PR changes --- css-view-transitions-2/Overview.bs | 41 +++++++++++++++++++----------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs index 10ba4a4d5b7..c64fc169178 100644 --- a/css-view-transitions-2/Overview.bs +++ b/css-view-transitions-2/Overview.bs @@ -2,7 +2,7 @@ Title: CSS View Transitions Module Level 2 Shortname: css-view-transitions Level: 2 -Status: WD +Status: ED Group: csswg Date: 2023-05-30 Prepare for TR: yes @@ -11,6 +11,7 @@ TR: https://www.w3.org/TR/css-view-transitions-2/ Work Status: exploring Editor: Noam Rosenthal, Google, w3cid 121539 Editor: Khushal Sagar, Google, w3cid 122787 +Editor: Vladimir Levin, Google, w3cid 75295 Editor: Tab Atkins-Bittner, Google, http://xanthir.com/contact/, w3cid 42199 Abstract: This module defines how the View Transition API works with cross-document navigations. Markup Shorthands: css yes, markdown yes @@ -28,6 +29,7 @@ spec:css-view-transitions-1; text: activate view transition; type: dfn; text: captured elements; type: dfn; text: updateCallbackDone; type: property; for: ViewTransition; + text: call the update callback; type: dfn; spec:dom; type:dfn; text:document spec:css22; type:dfn; text:element spec:html @@ -103,6 +105,8 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; ## Lifecycle ## {#lifecycle} + *This section is non-normative.* + A successful cross-document view transition goes through the following phases: 1. The user navigates, by clicking a link, submitting a form, traversing history using the @@ -247,6 +251,8 @@ Note: this should go in the HTML spec. See [Issue 9315](https://github.com/whatw }; +Note: this event is fired when [=reveal document|revealing a document=]. + The viewTransition [=getter steps=] are to return the [=inbound cross-document view-transition=] for [=this's=] [=relevant global object's=] [=associated document=]. @@ -281,15 +287,13 @@ The viewTransition [=getter steps=] are
Run the following step in [=Document/reactivate=], before step 4 (querying for [=page showing=]): - 1. [=reveal document|reveal=] |document|. + 1. If |document| is not [=render-blocked=], then [=reveal document|reveal=] |document|.
To reveal {{Document}} |document|: 1. Assert: |document|'s [=page showing=] is false. - 1. If |document| is [=render-blocked=] then return. - 1. Fire a new event named reveal on |document|'s [=relevant global object=], using {{PageRevealEvent}}. @@ -306,10 +310,6 @@ The viewTransition [=getter steps=] are 1. Assert: this is called when |oldDocument| is [=unloading=]. - 1. If |oldDocument|'s [=active view transition=] is not null, - then [=skip the view transition|skip=] |oldDocument|'s [=active view transition=] - with an "{{AbortError}}" {{DOMException}} in |oldDocument|'s [=relevant Realm=]. - 1. If |oldDocument|'s [=environment settings object/origin=] is not [=same origin=] as |newDocument|'s [=environment settings object/origin=] then return. @@ -324,9 +324,19 @@ The viewTransition [=getter steps=] are Note: We don't know yet if |newDocument| has opted in, as it might not be parsed yet. We check the opt-in for |newDocument| when it is [=reveal document|revealed=]. - 1. Let |transition| be a new {{ViewTransition}} object in |oldDocument|'s [=relevant Realm=]. + 1. If |oldDocument|'s [=active view transition=] is not null, + then [=skip the view transition|skip=] |oldDocument|'s [=active view transition=] + with an "{{AbortError}}" {{DOMException}} in |oldDocument|'s [=relevant Realm=]. + + Note: this means that any running transition would be skipped when the document is ready + to unload. + + 1. Let |outboundTransition| be a new {{ViewTransition}} object in |oldDocument|'s [=relevant Realm=]. - 1. [=Capture the old state=] for |transition|. If this fails, return. + Note: |outboundTransition| is not exposed to JavaScript, it is used only for capturing + the state of the old document. + + 1. [=Capture the old state=] for |outboundTransition|. If this fails, return. Note: implementations might need to [=queue a task=] in order to [=capture the old state=]. However, this should not have web-observable side-effects. @@ -334,13 +344,14 @@ The viewTransition [=getter steps=] are 1. [=Queue a global task=] on the [=DOM manipulation task source=], given |newDocument|'s [=relevant global object=], to perform the following step: - 1. Set |newDocument|'s [=active view transition=] to a new {{ViewTransition}} in |newDocument|'s [=relevant Realm=], - whose [=ViewTransition/named elements=] is |transition|'s [=ViewTransition/named elements=], - [=ViewTransition/update callback done promise=] is [=a promise resolved with=] undefined, - [=ViewTransition/initial snapshot containing block size=] is |transition|'s [=ViewTransition/initial snapshot containing block size=], + 1. Let |inboundTransition| be a new {{ViewTransition}} in |newDocument|'s [=relevant Realm=], + whose [=ViewTransition/named elements=] is |outboundTransition|'s [=ViewTransition/named elements=], + [=ViewTransition/initial snapshot containing block size=] is |outboundTransition|'s [=ViewTransition/initial snapshot containing block size=], and whose [=ViewTransition/is cross-document=] is true. - Note: this task would run before any script on the new {{Document}}. + 1. [=Call the update callback=] for |inboundTransition|. + + 1. Set |newDocument|'s [=active view transition=] to |inboundTransition|.
From 09207d55407102f4cff1a5cccbe082585c731fbf Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Wed, 12 Jul 2023 10:43:00 +0300 Subject: [PATCH 07/22] Add Vlad --- css-view-transitions-2/Overview.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs index c64fc169178..0ca5e0d1fad 100644 --- a/css-view-transitions-2/Overview.bs +++ b/css-view-transitions-2/Overview.bs @@ -11,7 +11,7 @@ TR: https://www.w3.org/TR/css-view-transitions-2/ Work Status: exploring Editor: Noam Rosenthal, Google, w3cid 121539 Editor: Khushal Sagar, Google, w3cid 122787 -Editor: Vladimir Levin, Google, w3cid 75295 +Editor: Vladimir Levin, Google Editor: Tab Atkins-Bittner, Google, http://xanthir.com/contact/, w3cid 42199 Abstract: This module defines how the View Transition API works with cross-document navigations. Markup Shorthands: css yes, markdown yes From e0989f489436baa8d6cd9b236037cd9ecff60735 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Thu, 13 Jul 2023 12:04:10 +0300 Subject: [PATCH 08/22] Make it explicit when we capture the old state --- css-view-transitions-1/Overview.bs | 12 ++++- css-view-transitions-2/Overview.bs | 71 ++++++++++++++++++------------ 2 files changed, 52 insertions(+), 31 deletions(-) diff --git a/css-view-transitions-1/Overview.bs b/css-view-transitions-1/Overview.bs index 29f170919cc..16cff92c280 100644 --- a/css-view-transitions-1/Overview.bs +++ b/css-view-transitions-1/Overview.bs @@ -1048,6 +1048,12 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; Note: This is used to detect changes in the [=snapshot containing block size=], which causes the transition to [=skip the view transition|skip=]. [Discussion of this behavior](https://github.com/w3c/csswg-drafts/issues/8045). + + : old state captured steps + :: An algorithm accepting nothing, or null. + Initially null. + + Note: this is used for cross-document view transitions. The {{ViewTransition/finished}} [=getter steps=] are to return [=this's=] [=ViewTransition/finished promise=]. @@ -1204,7 +1210,9 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; 1. [=Capture the old state=] for |transition|. - If failure is returned, then [=skip the view transition=] for |transition| with an "{{InvalidStateError}}" {{DOMException}} in |transition|'s [=relevant Realm=], + 1. If |transition|'s [=ViewTransition/process old state captured=] is not null, then call [=ViewTransition/process old state captured=] and return. + + 1.If failure is returned, then [=skip the view transition=] for |transition| with an "{{InvalidStateError}}" {{DOMException}} in |transition|'s [=relevant Realm=], and return. 1. Set |document|'s [=document/rendering suppression for view transitions=] to true. @@ -1217,7 +1225,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; 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. - +0 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. diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs index 0ca5e0d1fad..127771f1bdc 100644 --- a/css-view-transitions-2/Overview.bs +++ b/css-view-transitions-2/Overview.bs @@ -11,7 +11,7 @@ TR: https://www.w3.org/TR/css-view-transitions-2/ Work Status: exploring Editor: Noam Rosenthal, Google, w3cid 121539 Editor: Khushal Sagar, Google, w3cid 122787 -Editor: Vladimir Levin, Google +Editor: Vladimir Levin, Google, w3cid 75295 Editor: Tab Atkins-Bittner, Google, http://xanthir.com/contact/, w3cid 42199 Abstract: This module defines how the View Transition API works with cross-document navigations. Markup Shorthands: css yes, markdown yes @@ -20,15 +20,16 @@ Markup Shorthands: css yes, markdown yes