From 4d40d9be099a29fb869c5c9b77d9b2cb3a35489a Mon Sep 17 00:00:00 2001
From: Noam Rosenthal
Date: Fri, 2 Feb 2024 12:19:51 +0000
Subject: [PATCH 01/13] Move `onReady` to the correct place and rename
See https://github.com/w3c/csswg-drafts/issues/9886#issuecomment-1921563503
---
css-view-transitions-2/Overview.bs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs
index b6180e53f81..1e743aa5461 100644
--- a/css-view-transitions-2/Overview.bs
+++ b/css-view-transitions-2/Overview.bs
@@ -577,7 +577,7 @@ When capturing the old or new state for an element, perform the following steps
To
setup cross-document view-transition given a {{Document}} |oldDocument|,
- a {{Document}} |newDocument|, and |onReady|, which is an algorithm accepting nothing:
+ a {{Document}} |newDocument|, and |proceedWithNavigation|, which is an algorithm accepting nothing:
1. Let |resolvedRule| be the result of [=Resolve @view-transition rule|resolving the @view-transition rule=] for |oldDocument|.
@@ -602,7 +602,7 @@ When capturing the old or new state for an element, perform the following steps
Issue: should we check for the opt-in again, in case there was a CSSOM change in a requestAnimationFrame callback?
- 1. If |outboundTransition|'s [=ViewTransition/phase=] is "`done`", then call |onReady| and return.
+ 1. If |outboundTransition|'s [=ViewTransition/phase=] is "`done`", then call |proceedWithNavigation| and return.
1. Assert: |outboundTransition|'s [=ViewTransition/phase=] is "`pending-capture`".
@@ -627,14 +627,12 @@ When capturing the old or new state for an element, perform the following steps
1. Set |inboundTransition|’s [=ViewTransition/phase=] to "`update-callback-called`".
- 1. Call |onReady|.
-
- Note: The |inboundTransition| is activated after the dispatch of {{Window/pagereveal}} to ensure mutations made in this event apply to the captured new state.
-
1. At any given time, the UA may decide to skip |inboundTransition|, e.g. after an [=implementation-defined=] timeout.
To do so, the UA should [=queue a global task=] on the [=DOM manipulation task source=] given |newDocument|'s [=relevant global object=] to perform the following step:
If |transition|'s [=ViewTransition/phase=] is not "`done`", then [=skip the view transition=] |transition| with a "{{TimeoutError}}" {{DOMException}}.
+ Note: The |inboundTransition| is activated after the dispatch of {{Window/pagereveal}} to ensure mutations made in this event apply to the captured new state.
+
Note: |outboundTransition| is not exposed to JavaScript, it is used only for capturing
the state of the old document.
@@ -642,6 +640,8 @@ When capturing the old or new state for an element, perform the following steps
Note: The process continues in [=setup view transition=], via [=perform pending transition operations=].
+ 1. Call |proceedWithNavigation|.
+
1. The user agent should display the currently displayed frame until either:
* The {{Window/pagereveal}} event is fired.
* its [=active view transition=]'s [=ViewTransition/phase=] is "`done`".
From b0742a1e33337043a3072501c7e97a1e56a2f2d7 Mon Sep 17 00:00:00 2001
From: Noam Rosenthal
Date: Tue, 6 Feb 2024 10:52:38 +0000
Subject: [PATCH 02/13] Call proceed with navigation after capturing old doc
---
css-view-transitions-2/Overview.bs | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs
index 1e743aa5461..dc4c9c6daf0 100644
--- a/css-view-transitions-2/Overview.bs
+++ b/css-view-transitions-2/Overview.bs
@@ -633,15 +633,12 @@ When capturing the old or new state for an element, perform the following steps
Note: The |inboundTransition| is activated after the dispatch of {{Window/pagereveal}} to ensure mutations made in this event apply to the captured new state.
- Note: |outboundTransition| is not exposed to JavaScript, it is used only for capturing
- the state of the old document.
+ 1. Call |proceedWithNavigation|.
1. Set |oldDocument|'s [=active view transition=] to |outboundTransition|.
Note: The process continues in [=setup view transition=], via [=perform pending transition operations=].
- 1. Call |proceedWithNavigation|.
-
1. The user agent should display the currently displayed frame until either:
* The {{Window/pagereveal}} event is fired.
* its [=active view transition=]'s [=ViewTransition/phase=] is "`done`".
From c64adb06f60d4498b866ef393dce6528b4bd61ff Mon Sep 17 00:00:00 2001
From: Noam Rosenthal
Date: Tue, 6 Feb 2024 11:32:29 +0000
Subject: [PATCH 03/13] Move all cross-doc references to L2
---
css-view-transitions-1/Overview.bs | 19 ++++---------
css-view-transitions-2/Overview.bs | 45 ++++++++++++++++++++++--------
2 files changed, 38 insertions(+), 26 deletions(-)
diff --git a/css-view-transitions-1/Overview.bs b/css-view-transitions-1/Overview.bs
index 197dbb5a7e3..a49b73b282c 100644
--- a/css-view-transitions-1/Overview.bs
+++ b/css-view-transitions-1/Overview.bs
@@ -956,6 +956,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
1. Let |document| be [=this's=] [=relevant global object's=] [=associated document=].
+<<<<<<< HEAD
1. If |document|'s [=Document/visibility state=] is "hidden",
then [=skip the view transition|skip=] |transition| with an "{{InvalidStateError}}" {{DOMException}},
and return.
@@ -964,6 +965,8 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
then [=skip the view transition|skip=] |transition| with an "{{InvalidStateError}}" {{DOMException}},
and return.
+=======
+>>>>>>> 2b700bdce (Move all cross-doc references to L2)
1. If |document|'s [=active view transition=] is not null,
then [=skip the view transition|skip that view transition=]
with an "{{AbortError}}" {{DOMException}} in [=this's=] [=relevant Realm=].
@@ -1095,19 +1098,10 @@ 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).
-
- : process old state captured
- :: An algorithm accepting nothing, or null.
- Initially null.
-
- Note: this is used for cross-document view transitions.
A {{ViewTransition}} must never have both an [=ViewTransition/update callback=] and a [=ViewTransition/process old state captured=].
- Note: [=ViewTransition/update callback=] is optionally set for same-document view transitions,
- and [=ViewTransition/process old state captured=] is set for cross-document view transitions.
-
The {{ViewTransition/finished}} [=getter steps=] are to return [=this's=] [=ViewTransition/finished promise=].
The {{ViewTransition/ready}} [=getter steps=] are to return [=this's=] [=ViewTransition/ready promise=].
@@ -1158,9 +1152,6 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
with [=this=]'s [=document element=] is its [=originating element=].
Note: The position of the [=ViewTransition/transition root pseudo-element=] within the [=document element=] does not matter, as the [=ViewTransition/transition root pseudo-element=]'s [=containing block=] is the [=snapshot containing block=].
-
- : auto-skip view transitions
- :: A boolean. Initially false.
### Additions to Elements ### {#elements-concept}
@@ -1259,8 +1250,6 @@ 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. If |transition|'s [=ViewTransition/process old state captured=] is not null, then call [=ViewTransition/process old state captured=] and return.
-
1. Set |document|'s [=document/rendering suppression for view transitions=] to true.
1. [=Queue a global task=] on the [=DOM manipulation task source=],
@@ -1960,6 +1949,8 @@ Changes from issue 9762.
* Add animation-delay inherit to UA stylesheet rules for (::view-transition) -image-pair, -old, and -new. See issue 9817.
* Auto-skip animation when document is hidden. See issue 9543.
+* Remove references to cross-document view-transitions, to keep the L1 spec clean.
+
diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs
index dc4c9c6daf0..6edd08405ae 100644
--- a/css-view-transitions-2/Overview.bs
+++ b/css-view-transitions-2/Overview.bs
@@ -19,6 +19,7 @@ Markup Shorthands: css yes, markdown yes
spec:css-view-transitions-1;
text: active view transition; type: dfn;
+ text: capture the old state; type: dfn;
text: clear view transition; type: dfn;
text: activate view transition; type: dfn;
text: skip the view transition; type: dfn;
@@ -448,15 +449,33 @@ Note: as per default behavior, the ''@view-transition'' rule can be nested insid
1. If |callbackOptions| is not provided, then run the [=method steps=] for {{Document/startViewTransition()}} and return the result.
- 1. If |callbackOptions| is an {{UpdateCallback}}, then run the [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptions| and return the result.
+ 1. Let |viewTransition| be null.
- 1. Let |viewTransition| be the result of running [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptions|'s {{StartViewTransitionOptions/update}}.
+ 1. If |callbackOptions| is an {{UpdateCallback}}, then set |viewTransition| to the result of running the [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptions|.
- 1. Set |viewTransition|'s [=ViewTransition/active types=] to |callbackOptions|'s {{StartViewTransitionOptions/type}}.
+ 1. Otherwise:
+
+ 1. Set |viewTransition| to the result of running [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptions|'s {{StartViewTransitionOptions/update}}.
+
+ 1. Set |viewTransition|'s [=ViewTransition/active types=] to |callbackOptions|'s {{StartViewTransitionOptions/type}}.
+
+ 1. If [=this=]'s [=auto-skip view transitions=] is true,
+ then [=skip the view transition|skip=] |viewTransition| with an "{{InvalidStateError}}" {{DOMException}}.
+
+ Note: This would happen if starting a same-document view-transition while a cross-document view-transition is being set up.
1. Return |viewTransition|.
+ A {{Document}} additionaly has:
+
+
+ : auto-skip view transitions
+ :: A boolean. Initially false.
+
+
+
+
## Extensions to the CSSRule interface ## {#extensions-to-cssrule-interface}
The CSSRule interface is extended as follows:
@@ -491,8 +510,6 @@ The {{CSSViewTransitionRule}} represents a ''@view-transition'' rule.
: is inbound cross-document transition
:: a boolean, initially false.
- Issue: should a cross-document transition take precedent? See [#9512](https://github.com/w3c/csswg-drafts/issues/9512)
-
: active types
:: Null or a [=list=] of strings, initially null.
@@ -558,7 +575,7 @@ When capturing the old or new state for an element, perform the following steps
To check if a navigation can trigger a cross-document view-transition? given
- an [=origin=] |oldOrigin|, an [=origin=] |newOrigin|, a boolean |navigationHasCrossOriginRedirects|, a {{NavigationType}} |navigationType|, and a boolean |isBrowserUINavigation|:
+ an [=/origin=] |oldOrigin|, an [=/origin=] |newOrigin|, a boolean |navigationHasCrossOriginRedirects|, a {{NavigationType}} |navigationType|, and a boolean |isBrowserUINavigation|:
Note: this is called during navigation, potentially [=in parallel=], for documents that have opted-in to view-transitions using the ''@view-transition'' rule.
@@ -598,20 +615,19 @@ When capturing the old or new state for an element, perform the following steps
Note: this means that calling {{Document/startViewTransition()}} while capturing the old document for a cross-document view-transition would run the callback but skip the animation.
1. Let |outboundTransition| be a new {{ViewTransition}} object in |oldDocument|'s [=relevant Realm=],
- whose [=ViewTransition/active types=] is |resolvedRule|, and whose [=ViewTransition/process old state captured=] is set to the following steps:
+ whose [=ViewTransition/active types=] is |resolvedRule|.
- Issue: should we check for the opt-in again, in case there was a CSSOM change in a requestAnimationFrame callback?
+ 1. Run the following steps when [=Perform pending transition operations|performing pending transition operations=]:
1. If |outboundTransition|'s [=ViewTransition/phase=] is "`done`", then call |proceedWithNavigation| and return.
1. Assert: |outboundTransition|'s [=ViewTransition/phase=] is "`pending-capture`".
- 1. [=Clear view transition=] |outboundTransition|.
+ 1. Set |oldDocument|'s [=auto-skip view transitions=] to false.
- Note: The ViewTransition object on the old Document should be destroyed after its state has been copied to the new Document below.
- We explicitly clear it here since the old Document may be cached by the UA.
+ 1. [=Capture the old state=] for |outboundTransition|.
- 1. Set |oldDocument|'s [=auto-skip view transitions=] to false.
+ 1. If failure is returned, call |proceedWithNavigation| and return.
1. [=Queue a global task=] on the [=DOM manipulation task source=] given |newDocument|'s [=relevant global object=],
to perform the following steps:
@@ -633,6 +649,11 @@ When capturing the old or new state for an element, perform the following steps
Note: The |inboundTransition| is activated after the dispatch of {{Window/pagereveal}} to ensure mutations made in this event apply to the captured new state.
+ 1. [=Clear view transition=] |outboundTransition|.
+
+ Note: The ViewTransition object on the old Document should be destroyed after its state has been copied to the new Document below.
+ We explicitly clear it here since the old Document may be cached by the UA.
+
1. Call |proceedWithNavigation|.
1. Set |oldDocument|'s [=active view transition=] to |outboundTransition|.
From d33b40cef1cea65881d9b729de05cc5ad7fc523f Mon Sep 17 00:00:00 2001
From: Noam Rosenthal
Date: Thu, 8 Feb 2024 10:26:24 +0000
Subject: [PATCH 04/13] 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 6edd08405ae..8860f478754 100644
--- a/css-view-transitions-2/Overview.bs
+++ b/css-view-transitions-2/Overview.bs
@@ -462,7 +462,7 @@ Note: as per default behavior, the ''@view-transition'' rule can be nested insid
1. If [=this=]'s [=auto-skip view transitions=] is true,
then [=skip the view transition|skip=] |viewTransition| with an "{{InvalidStateError}}" {{DOMException}}.
- Note: This would happen if starting a same-document view-transition while a cross-document view-transition is being set up.
+ Note: This would happen when starting a same-document view-transition on the old Document while a cross-document view-transition is being set up.
1. Return |viewTransition|.
From fa716ea16d0d1cd69cff5918d4a55621b7ac411d Mon Sep 17 00:00:00 2001
From: Noam Rosenthal
Date: Thu, 8 Feb 2024 13:28:33 +0000
Subject: [PATCH 05/13] Restructure new document steps and auto-skip
---
css-view-transitions-1/Overview.bs | 2 +-
css-view-transitions-2/Overview.bs | 84 ++++++++++++++++--------------
2 files changed, 47 insertions(+), 39 deletions(-)
diff --git a/css-view-transitions-1/Overview.bs b/css-view-transitions-1/Overview.bs
index a49b73b282c..444de40ec43 100644
--- a/css-view-transitions-1/Overview.bs
+++ b/css-view-transitions-1/Overview.bs
@@ -1949,7 +1949,7 @@ Changes from issue 9762.
* Add animation-delay inherit to UA stylesheet rules for (::view-transition) -image-pair, -old, and -new. See issue 9817.
* Auto-skip animation when document is hidden. See issue 9543.
-* Remove references to cross-document view-transitions, to keep the L1 spec clean.
+* Remove references to cross-document view-transitions, to keep the L1 spec clean. See Issue 9886.
Changes from 2022-05-25 Working Draft
diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs
index 8860f478754..8b0b03f0200 100644
--- a/css-view-transitions-2/Overview.bs
+++ b/css-view-transitions-2/Overview.bs
@@ -25,6 +25,8 @@ spec:css-view-transitions-1;
text: skip the view transition; type: dfn;
text: ViewTransition; type: interface;
text: named elements; for: ViewTransition; type: dfn;
+ text: finished promise; for: ViewTransition; type: dfn;
+ text: ready promise; for: ViewTransition; type: dfn;
text: update callback done promise; for: ViewTransition; type: dfn;
text: initial snapshot containing block size; for: ViewTransition; type: dfn;
text: captured elements; type: dfn;
@@ -447,11 +449,22 @@ Note: as per default behavior, the ''@view-transition'' rule can be nested insid
The [=method steps=] for startViewTransition(|callbackOptions|) are as follows:
- 1. If |callbackOptions| is not provided, then run the [=method steps=] for {{Document/startViewTransition()}} and return the result.
-
1. Let |viewTransition| be null.
- 1. If |callbackOptions| is an {{UpdateCallback}}, then set |viewTransition| to the result of running the [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptions|.
+ 1. If |this|'s [=active view transition=] is not null and its [=ViewTransition/is outbound cross-document transition=] is true,
+ then:
+
+ 1. Let |transition| be a new {{ViewTransition}} in |this|'s [=relevant realm=].
+
+ 1. [=Resolve=] |transition|'s [=ViewTransition/finished promise=] with undefined.
+
+ 1. [=Resolve=] |transition|'s [=ViewTransition/update callback done promise=] with undefined.
+
+ 1. [=Reject=] |transition|'s [=ViewTransition/ready promise=] with an "{{InvalidStateError}}" {{DOMException}}.
+
+ 1. If |callbackOptions| is not provided, then set |viewTransition| to the result of running the [=method steps=] for {{Document/startViewTransition()}}.
+
+ 1. Otherwise, If |callbackOptions| is an {{UpdateCallback}}, then set |viewTransition| to the result of running the [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptions|.
1. Otherwise:
@@ -459,19 +472,14 @@ Note: as per default behavior, the ''@view-transition'' rule can be nested insid
1. Set |viewTransition|'s [=ViewTransition/active types=] to |callbackOptions|'s {{StartViewTransitionOptions/type}}.
- 1. If [=this=]'s [=auto-skip view transitions=] is true,
- then [=skip the view transition|skip=] |viewTransition| with an "{{InvalidStateError}}" {{DOMException}}.
-
- Note: This would happen when starting a same-document view-transition on the old Document while a cross-document view-transition is being set up.
-
1. Return |viewTransition|.
A {{Document}} additionaly has:
- : auto-skip view transitions
- :: A boolean. Initially false.
+ : inbound view-transition steps
+ :: Null or an algorithm accepting nothing, initially null.
@@ -507,7 +515,7 @@ The {{CSSViewTransitionRule}} represents a ''@view-transition'' rule.
A {{ViewTransition}} additionally has:
- : is inbound cross-document transition
+ : is outbound cross-document transition
:: a boolean, initially false.
: active types
@@ -596,6 +604,8 @@ When capturing the old or new state for an element, perform the following steps
To setup cross-document view-transition given a {{Document}} |oldDocument|,
a {{Document}} |newDocument|, and |proceedWithNavigation|, which is an algorithm accepting nothing:
+ 1. [=Assert=]: These steps are running as part of a [=task=] queued on |oldDocument|.
+
1. Let |resolvedRule| be the result of [=Resolve @view-transition rule|resolving the @view-transition rule=] for |oldDocument|.
1. If |resolvedRule| is "skip transition", then return null.
@@ -610,44 +620,44 @@ When capturing the old or new state for an element, perform the following steps
Note: this means that any running transition would be skipped when the document is ready
to unload.
- 1. Set |oldDocument|'s [=auto-skip view transitions=] to true.
-
- Note: this means that calling {{Document/startViewTransition()}} while capturing the old document for a cross-document view-transition would run the callback but skip the animation.
-
1. Let |outboundTransition| be a new {{ViewTransition}} object in |oldDocument|'s [=relevant Realm=],
whose [=ViewTransition/active types=] is |resolvedRule|.
- 1. Run the following steps when [=Perform pending transition operations|performing pending transition operations=]:
+ 1. Set |outboundTransition|'s [=is outbound cross-document transition=] to true.
- 1. If |outboundTransition|'s [=ViewTransition/phase=] is "`done`", then call |proceedWithNavigation| and return.
+ 1. Run the following steps when [=Perform pending transition operations|performing pending transition operations=]:
1. Assert: |outboundTransition|'s [=ViewTransition/phase=] is "`pending-capture`".
- 1. Set |oldDocument|'s [=auto-skip view transitions=] to false.
-
1. [=Capture the old state=] for |outboundTransition|.
- 1. If failure is returned, call |proceedWithNavigation| and return.
+ 1. If this succeeded, then:
+
+ 1. Let |clonedNamedElements| be |outboundTransition|'s [=ViewTransition/named elements=] to a [=map/clone=] of |outboundTransition|'s [=ViewTransition/named elements=].
+
+ 1. Let |initialSnapshotContainingBlockSize| to |outboundTransition|'s [=ViewTransition/initial snapshot containing block size=].
+
+ 1. Set |newDocument|'s [=inbound view-transition steps=] to the following steps:
+
+ 1. [=Assert=]: |newDocument| is [=fully active=].
- 1. [=Queue a global task=] on the [=DOM manipulation task source=] given |newDocument|'s [=relevant global object=],
- to perform the following steps:
+ 1. Let |inboundTransition| be a new {{ViewTransition}} in |newDocument|'s [=relevant Realm=],
+ whose [=ViewTransition/named elements=] is |clonedNamedElements|,
+ and [=ViewTransition/initial snapshot containing block size=] is |initialSnapshotContainingBlockSize|.
- 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 inbound cross-document transition=] is true.
+ 1. Set |newDocument|'s [=active view transition=] to |inboundTransition|.
- 1. Set |newDocument|'s [=active view transition=] to |inboundTransition|.
+ 1. [=Resolve=] |inboundTransition|’s [=ViewTransition/update callback done promise=] with undefined.
- 1. [=Resolve=] |inboundTransition|’s [=ViewTransition/update callback done promise=] with undefined.
+ 1. Set |inboundTransition|’s [=ViewTransition/phase=] to "`update-callback-called`".
- 1. Set |inboundTransition|’s [=ViewTransition/phase=] to "`update-callback-called`".
+ 1. At any given time, the UA may decide to skip |inboundTransition|, e.g. after an [=implementation-defined=] timeout.
+ To do so, the UA should [=queue a global task=] on the [=DOM manipulation task source=] given |newDocument|'s [=relevant global object=] to perform the following step:
+ If |transition|'s [=ViewTransition/phase=] is not "`done`", then [=skip the view transition=] |transition| with a "{{TimeoutError}}" {{DOMException}}.
- 1. At any given time, the UA may decide to skip |inboundTransition|, e.g. after an [=implementation-defined=] timeout.
- To do so, the UA should [=queue a global task=] on the [=DOM manipulation task source=] given |newDocument|'s [=relevant global object=] to perform the following step:
- If |transition|'s [=ViewTransition/phase=] is not "`done`", then [=skip the view transition=] |transition| with a "{{TimeoutError}}" {{DOMException}}.
+ 1. Return |inboundTransition|.
- Note: The |inboundTransition| is activated after the dispatch of {{Window/pagereveal}} to ensure mutations made in this event apply to the captured new state.
+ Note: The |inboundTransition| is activated after the dispatch of {{Window/pagereveal}} to ensure mutations made in this event apply to the captured new state.
1. [=Clear view transition=] |outboundTransition|.
@@ -674,13 +684,11 @@ When capturing the old or new state for an element, perform the following steps
To
resolve cross-document view-transition for {{Document}} |document|:
- 1. Let |transition| be |document|'s [=active view transition=].
+ 1. If |document|'s [=inbound view-transition steps=] is null, then return.
- 1. If |transition| is null or |transition|'s [=ViewTransition/is inbound cross-document transition=] is false,
- then return null.
+ 1. Let |transition| be the result of running |document|'s [=inbound view-transition steps=].
- Note: |transition|'s [=ViewTransition/is inbound cross-document transition=] would be false if a same-document
- transition was started before the {{Window/pagereveal}} event was fired.
+ 1. If |transition| is null then return null.
1. [=Resolve @view-transition rule=] for |document| and let |resolvedRule| be the result.
From 34925bbcec60099d0a28c02e072f16fbc489da6a Mon Sep 17 00:00:00 2001
From: Noam Rosenthal
Date: Thu, 8 Feb 2024 14:14:09 +0000
Subject: [PATCH 06/13] Add missing piece
---
css-view-transitions-2/Overview.bs | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs
index 8b0b03f0200..ac7bbf8436f 100644
--- a/css-view-transitions-2/Overview.bs
+++ b/css-view-transitions-2/Overview.bs
@@ -478,7 +478,7 @@ Note: as per default behavior, the ''@view-transition'' rule can be nested insid
A {{Document}} additionaly has:
- : inbound view-transition steps
+ : inbound view transition steps
:: Null or an algorithm accepting nothing, initially null.
@@ -637,10 +637,16 @@ When capturing the old or new state for an element, perform the following steps
1. Let |initialSnapshotContainingBlockSize| to |outboundTransition|'s [=ViewTransition/initial snapshot containing block size=].
- 1. Set |newDocument|'s [=inbound view-transition steps=] to the following steps:
+ 1. Set |newDocument|'s [=inbound view transition steps=] to the following steps:
1. [=Assert=]: |newDocument| is [=fully active=].
+ 1. Set |newDocument|'s [=inbound view transition steps=] to null.
+
+ 1. If |newDocument|'s [=active view transition=] is not null, then return.
+
+ Note: this means that starting a same-document transition before revealing the document would cancel a pending cross-document transition.
+
1. Let |inboundTransition| be a new {{ViewTransition}} in |newDocument|'s [=relevant Realm=],
whose [=ViewTransition/named elements=] is |clonedNamedElements|,
and [=ViewTransition/initial snapshot containing block size=] is |initialSnapshotContainingBlockSize|.
@@ -684,9 +690,9 @@ When capturing the old or new state for an element, perform the following steps
To resolve cross-document view-transition for {{Document}} |document|:
- 1. If |document|'s [=inbound view-transition steps=] is null, then return.
+ 1. If |document|'s [=inbound view transition steps=] is null, then return.
- 1. Let |transition| be the result of running |document|'s [=inbound view-transition steps=].
+ 1. Let |transition| be the result of running |document|'s [=inbound view transition steps=].
1. If |transition| is null then return null.
From 4193a7879cf7b2312c24cca777fb09022bb4e09a Mon Sep 17 00:00:00 2001
From: Noam Rosenthal
Date: Fri, 9 Feb 2024 10:26:07 +0000
Subject: [PATCH 07/13] Remove more references to L2
---
css-view-transitions-1/Overview.bs | 4 -
css-view-transitions-2/Overview.bs | 152 ++++++++++++++---------------
2 files changed, 76 insertions(+), 80 deletions(-)
diff --git a/css-view-transitions-1/Overview.bs b/css-view-transitions-1/Overview.bs
index 444de40ec43..bf91a9b05cd 100644
--- a/css-view-transitions-1/Overview.bs
+++ b/css-view-transitions-1/Overview.bs
@@ -1100,8 +1100,6 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
[Discussion of this behavior](https://github.com/w3c/csswg-drafts/issues/8045).
- A {{ViewTransition}} must never have both an [=ViewTransition/update callback=] and a [=ViewTransition/process old state captured=].
-
The {{ViewTransition/finished}} [=getter steps=] are to return [=this's=] [=ViewTransition/finished promise=].
The {{ViewTransition/ready}} [=getter steps=] are to return [=this's=] [=ViewTransition/ready promise=].
@@ -1669,8 +1667,6 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
Note: Since the rejection of |transition|'s [=ViewTransition/update callback done promise=] isn't explicitly handled here,
if |transition|'s [=ViewTransition/update callback done promise=] rejects,
then |transition|'s [=ViewTransition/finished promise=] will reject with the same reason.
-
- 1. If |transition|'s [=ViewTransition/process old state captured=] is not null, then call |transition|'s [=ViewTransition/process old state captured=].
## [=Capture the image=] ## {#capture-the-image-algorithm}
diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs
index ac7bbf8436f..d4b02c793cd 100644
--- a/css-view-transitions-2/Overview.bs
+++ b/css-view-transitions-2/Overview.bs
@@ -449,41 +449,28 @@ Note: as per default behavior, the ''@view-transition'' rule can be nested insid
The [=method steps=] for startViewTransition(|callbackOptions|) are as follows:
- 1. Let |viewTransition| be null.
-
- 1. If |this|'s [=active view transition=] is not null and its [=ViewTransition/is outbound cross-document transition=] is true,
+ 1. If |this|'s [=active view transition=] is not null and its [=outbound post-capture steps=] is not null,
then:
- 1. Let |transition| be a new {{ViewTransition}} in |this|'s [=relevant realm=].
-
- 1. [=Resolve=] |transition|'s [=ViewTransition/finished promise=] with undefined.
+ 1. Let |preSkippedTransition| be a new {{ViewTransition}} in |this|'s [=relevant realm=].
- 1. [=Resolve=] |transition|'s [=ViewTransition/update callback done promise=] with undefined.
+ 1. [=Skip the view transition|Skip=] |preSkippedTransition| with an "{{InvalidStateError}}" {{DOMException}}.
- 1. [=Reject=] |transition|'s [=ViewTransition/ready promise=] with an "{{InvalidStateError}}" {{DOMException}}.
+ 1. Return |preSkippedTransition|.
- 1. If |callbackOptions| is not provided, then set |viewTransition| to the result of running the [=method steps=] for {{Document/startViewTransition()}}.
+ 1. If |callbackOptions| is not provided, then return the result of running the [=method steps=] for {{Document/startViewTransition()}}.
- 1. Otherwise, If |callbackOptions| is an {{UpdateCallback}}, then set |viewTransition| to the result of running the [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptions|.
+ 1. Otherwise, if |callbackOptions| is an {{UpdateCallback}}, then return the result of running the [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptions|.
1. Otherwise:
- 1. Set |viewTransition| to the result of running [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptions|'s {{StartViewTransitionOptions/update}}.
+ 1. Let |viewTransition| be the result of running [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptions|'s {{StartViewTransitionOptions/update}}.
1. Set |viewTransition|'s [=ViewTransition/active types=] to |callbackOptions|'s {{StartViewTransitionOptions/type}}.
- 1. Return |viewTransition|.
+ 1. Return |viewTransition|.
- A {{Document}} additionaly has:
-
-
- : inbound view transition steps
- :: Null or an algorithm accepting nothing, initially null.
-
-
-
-
## Extensions to the CSSRule interface ## {#extensions-to-cssrule-interface}
The CSSRule interface is extended as follows:
@@ -511,12 +498,25 @@ The {{CSSViewTransitionRule}} represents a ''@view-transition'' rule.
# Algorithms # {#algorithms}
## Data Structures ## {#concepts}
+### Additions to {{Document}} ### {#additions-to-document}
+ A {{Document}} additionaly has:
+
+
+ : inbound named elements
+ :: Null or [=/map=] with the same type as [=ViewTransition/named elements=].
+ Initially null.
+
+ : inbound snapshot containing block size
+ :: a [=tuple=] of two numbers (width and height), or null.
+ Initially null.
+
+
### Additions to {{ViewTransition}} ### {#view-transitions-extension}
A {{ViewTransition}} additionally has:
- : is outbound cross-document transition
- :: a boolean, initially false.
+ : outbound post-capture steps
+ :: Null or a set of steps, initially null.
: active types
:: Null or a [=list=] of strings, initially null.
@@ -531,7 +531,7 @@ The [=captured element=] struct should contain these fields, in addition to the
:: a [=/list=] of strings, initially empty.
-## Algorithms to capture 'view-transition-class': ## {#vt-class-algorithms}
+## Algorithm to capture 'view-transition-class': ## {#vt-class-algorithms}
When capturing the old or new state for an element, perform the following steps given a [=captured element=] |capture| and an [=element=] |element|:
@@ -540,6 +540,31 @@ When capturing the old or new state for an element, perform the following steps
Note: This is written in a monkey-patch manner, and will be merged into the algorithm once the L1 spec graduates.
+## Addition to pending transition operations ## {#additions-to-pending-transition-operation}
+
+Prepend this to the [=Perform pending transition operations=] algorithm given a {{Document}} |document|:
+ 1. If |document|'s [=active view transition=] is not null and its [=outbound post-capture steps=] is not null, then:
+
+ 1. Assert: |document|'s [=active view transition=]'s [=ViewTransition/phase=] is "`pending-capture`".
+
+ 1. [=Capture the old state=] for |transition|.
+
+ 1. If this succeeded, then:
+
+ 1. Set |newDocument|'s [=inbound named elements=] to a [=map/clone=] of |transition|'s [=ViewTransition/named elements=].
+
+ 1. Set |newDocument|'s [=inbound snapshot containing block size=] to |transition|'s [=ViewTransition/initial snapshot containing block size=].
+
+ Note: The inbound transition is activated after the dispatch of {{Window/pagereveal}} to ensure mutations made in this event apply to the captured new state.
+
+ 1. [=Clear view transition=] |transition|.
+
+ Note: The ViewTransition object on the old Document should be destroyed after its state has been copied to the new Document below.
+ We explicitly clear it here since the old Document may be cached by the UA.
+
+ 1. Call |transition|'s [=outbound post-capture steps=].
+
+
## Monkey patches to HTML ## {#monkey-patch-to-html}
@@ -623,54 +648,7 @@ When capturing the old or new state for an element, perform the following steps
1. Let |outboundTransition| be a new {{ViewTransition}} object in |oldDocument|'s [=relevant Realm=],
whose [=ViewTransition/active types=] is |resolvedRule|.
- 1. Set |outboundTransition|'s [=is outbound cross-document transition=] to true.
-
- 1. Run the following steps when [=Perform pending transition operations|performing pending transition operations=]:
-
- 1. Assert: |outboundTransition|'s [=ViewTransition/phase=] is "`pending-capture`".
-
- 1. [=Capture the old state=] for |outboundTransition|.
-
- 1. If this succeeded, then:
-
- 1. Let |clonedNamedElements| be |outboundTransition|'s [=ViewTransition/named elements=] to a [=map/clone=] of |outboundTransition|'s [=ViewTransition/named elements=].
-
- 1. Let |initialSnapshotContainingBlockSize| to |outboundTransition|'s [=ViewTransition/initial snapshot containing block size=].
-
- 1. Set |newDocument|'s [=inbound view transition steps=] to the following steps:
-
- 1. [=Assert=]: |newDocument| is [=fully active=].
-
- 1. Set |newDocument|'s [=inbound view transition steps=] to null.
-
- 1. If |newDocument|'s [=active view transition=] is not null, then return.
-
- Note: this means that starting a same-document transition before revealing the document would cancel a pending cross-document transition.
-
- 1. Let |inboundTransition| be a new {{ViewTransition}} in |newDocument|'s [=relevant Realm=],
- whose [=ViewTransition/named elements=] is |clonedNamedElements|,
- and [=ViewTransition/initial snapshot containing block size=] is |initialSnapshotContainingBlockSize|.
-
- 1. Set |newDocument|'s [=active view transition=] to |inboundTransition|.
-
- 1. [=Resolve=] |inboundTransition|’s [=ViewTransition/update callback done promise=] with undefined.
-
- 1. Set |inboundTransition|’s [=ViewTransition/phase=] to "`update-callback-called`".
-
- 1. At any given time, the UA may decide to skip |inboundTransition|, e.g. after an [=implementation-defined=] timeout.
- To do so, the UA should [=queue a global task=] on the [=DOM manipulation task source=] given |newDocument|'s [=relevant global object=] to perform the following step:
- If |transition|'s [=ViewTransition/phase=] is not "`done`", then [=skip the view transition=] |transition| with a "{{TimeoutError}}" {{DOMException}}.
-
- 1. Return |inboundTransition|.
-
- Note: The |inboundTransition| is activated after the dispatch of {{Window/pagereveal}} to ensure mutations made in this event apply to the captured new state.
-
- 1. [=Clear view transition=] |outboundTransition|.
-
- Note: The ViewTransition object on the old Document should be destroyed after its state has been copied to the new Document below.
- We explicitly clear it here since the old Document may be cached by the UA.
-
- 1. Call |proceedWithNavigation|.
+ 1. Set |outboundTransition|'s [=outbound post-capture steps=] to |proceedWithNavigation|.
1. Set |oldDocument|'s [=active view transition=] to |outboundTransition|.
@@ -690,18 +668,40 @@ When capturing the old or new state for an element, perform the following steps
To resolve cross-document view-transition for {{Document}} |document|:
- 1. If |document|'s [=inbound view transition steps=] is null, then return.
+ 1. [=Assert=]: |document| is [=fully active=].
+
+ 1. If |document|'s [=active view transition=] is not null, then return null.
+
+ Note: this means that starting a same-document transition before revealing the document would cancel a pending cross-document transition.
+
+ 1. If |document|'s [=inbound named elements=] is null, then return null.
- 1. Let |transition| be the result of running |document|'s [=inbound view transition steps=].
+ 1. [=Assert=]: |document|'s [=inbound snapshot containing block size=] is not null.
- 1. If |transition| is null then return null.
+ 1. Let |transition| be a new {{ViewTransition}} in |document|'s [=relevant Realm=],
+ whose [=ViewTransition/named elements=] is |document|'s [=inbound named elements=],
+ and [=ViewTransition/initial snapshot containing block size=] is |document|'s [=inbound snapshot containing block size=].
+
+ 1. Set |document|'s [=inbound named elements=] to null.
+
+ 1. Set |document|'s [=inbound snapshot containing block size=] to null.
1. [=Resolve @view-transition rule=] for |document| and let |resolvedRule| be the result.
- 1. If |resolvedRule| is "skip transition", then [=skip the view transition|skip=] |transition| and return null.
+ 1. If |resolvedRule| is "skip transition", then return null.
+
+ 1. Set |document|'s [=active view transition=] to |transition|.
+
+ 1. [=Resolve=] |inboundTransition|’s [=ViewTransition/update callback done promise=] with undefined.
+
+ 1. Set |inboundTransition|’s [=ViewTransition/phase=] to "`update-callback-called`".
1. Set |transition|'s [=ViewTransition/active types=] to |resolvedRule|.
+ 1. At any given time, the UA may decide to skip |inboundTransition|, e.g. after an [=implementation-defined=] timeout.
+ To do so, the UA should [=queue a global task=] on the [=DOM manipulation task source=] given |document|'s [=relevant global object=] to perform the following step:
+ If |transition|'s [=ViewTransition/phase=] is not "`done`", then [=skip the view transition=] |transition| with a "{{TimeoutError}}" {{DOMException}}.
+
1. Return |transition|.
From 1720ab1d3cc85948133cd5ba90a80bf936905201 Mon Sep 17 00:00:00 2001
From: Noam Rosenthal
Date: Fri, 9 Feb 2024 11:23:26 +0000
Subject: [PATCH 08/13] Address PR nits
---
css-view-transitions-2/Overview.bs | 51 ++++++++++++++++++------------
1 file changed, 30 insertions(+), 21 deletions(-)
diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs
index d4b02c793cd..f9c9f802d6b 100644
--- a/css-view-transitions-2/Overview.bs
+++ b/css-view-transitions-2/Overview.bs
@@ -502,13 +502,22 @@ The {{CSSViewTransitionRule}} represents a ''@view-transition'' rule.
A {{Document}} additionaly has:
- : inbound named elements
- :: Null or [=/map=] with the same type as [=ViewTransition/named elements=].
+ : inbound view transition params
+ :: a [=view transition params=], or null.
Initially null.
+
- : inbound snapshot containing block size
- :: a [=tuple=] of two numbers (width and height), or null.
- Initially null.
+### View transition params ### {#view-transition-params-section}
+
+ A view transition params is a [=struct=] whose purpose is to serialize view transition information across documents.
+ It has the following [=struct/items=]:
+
+
+ : named elements
+ :: a [=/map=], whose keys are strings and whose values are [=captured elements=].
+
+ : initial snapshot containing block size
+ :: a [=tuple=] of two numbers (width and height).
### Additions to {{ViewTransition}} ### {#view-transitions-extension}
@@ -522,6 +531,10 @@ The {{CSSViewTransitionRule}} represents a ''@view-transition'' rule.
:: Null or a [=list=] of strings, initially null.
+### [=Captured elements=] ### {#captured-elements}
+
+ A captured element is a [=struct=] with the following:
+
### Additions to [=captured element=] struct ### {#additions-to-captured-element-struct}
The [=captured element=] struct should contain these fields, in addition to the existing ones:
@@ -549,11 +562,9 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a
1. [=Capture the old state=] for |transition|.
- 1. If this succeeded, then:
-
- 1. Set |newDocument|'s [=inbound named elements=] to a [=map/clone=] of |transition|'s [=ViewTransition/named elements=].
-
- 1. Set |newDocument|'s [=inbound snapshot containing block size=] to |transition|'s [=ViewTransition/initial snapshot containing block size=].
+ 1. If this succeeded, then set |document|'s [=inbound view transition params=] to a new [=view transition params=] whose
+ [=view transition params/named elements=] is a [=map/clone=] of |transition|'s [=ViewTransition/named elements=],
+ and whose [=view transition params/initial snapshot containing block size=] is |transition|'s [=ViewTransition/initial snapshot containing block size=].
Note: The inbound transition is activated after the dispatch of {{Window/pagereveal}} to ensure mutations made in this event apply to the captured new state.
@@ -670,21 +681,19 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a
1. [=Assert=]: |document| is [=fully active=].
- 1. If |document|'s [=active view transition=] is not null, then return null.
-
- Note: this means that starting a same-document transition before revealing the document would cancel a pending cross-document transition.
+ 1. Let |inboundViewTransitionParams| be |document|'s [=inbound view transition params=].
- 1. If |document|'s [=inbound named elements=] is null, then return null.
+ 1. If |inboundViewTransitionParams| is null, then return null.
- 1. [=Assert=]: |document|'s [=inbound snapshot containing block size=] is not null.
+ 1. Set |document|'s [=inbound view transition params=] to null.
- 1. Let |transition| be a new {{ViewTransition}} in |document|'s [=relevant Realm=],
- whose [=ViewTransition/named elements=] is |document|'s [=inbound named elements=],
- and [=ViewTransition/initial snapshot containing block size=] is |document|'s [=inbound snapshot containing block size=].
+ 1. If |document|'s [=active view transition=] is not null, then return null.
- 1. Set |document|'s [=inbound named elements=] to null.
+ Note: this means that starting a same-document transition before revealing the document would cancel a pending cross-document transition.
- 1. Set |document|'s [=inbound snapshot containing block size=] to null.
+ 1. Let |transition| be a new {{ViewTransition}} in |document|'s [=relevant Realm=],
+ whose [=ViewTransition/named elements=] is |inboundViewTransitionParams|'s [=view transition params/named elements=],
+ and [=ViewTransition/initial snapshot containing block size=] is |inboundViewTransitionParams|'s [=view transition params/initial snapshot containing block size=].
1. [=Resolve @view-transition rule=] for |document| and let |resolvedRule| be the result.
@@ -698,7 +707,7 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a
1. Set |transition|'s [=ViewTransition/active types=] to |resolvedRule|.
- 1. At any given time, the UA may decide to skip |inboundTransition|, e.g. after an [=implementation-defined=] timeout.
+ 1. At any given time, the UA may decide to skip the inbound transition, e.g. after an [=implementation-defined=] timeout.
To do so, the UA should [=queue a global task=] on the [=DOM manipulation task source=] given |document|'s [=relevant global object=] to perform the following step:
If |transition|'s [=ViewTransition/phase=] is not "`done`", then [=skip the view transition=] |transition| with a "{{TimeoutError}}" {{DOMException}}.
From 1c621b3b3dd6c2516a936deec0131a00e0bf9f76 Mon Sep 17 00:00:00 2001
From: Noam Rosenthal
Date: Fri, 9 Feb 2024 13:41:08 +0000
Subject: [PATCH 09/13] Address PR nits
---
css-view-transitions-2/Overview.bs | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs
index f9c9f802d6b..cee46ad2f3d 100644
--- a/css-view-transitions-2/Overview.bs
+++ b/css-view-transitions-2/Overview.bs
@@ -560,20 +560,20 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a
1. Assert: |document|'s [=active view transition=]'s [=ViewTransition/phase=] is "`pending-capture`".
+ 1. Let |viewTransitionParams| be null;
+
1. [=Capture the old state=] for |transition|.
- 1. If this succeeded, then set |document|'s [=inbound view transition params=] to a new [=view transition params=] whose
+ 1. If this succeeded, then set |viewTransitionParams| to a new [=view transition params=] whose
[=view transition params/named elements=] is a [=map/clone=] of |transition|'s [=ViewTransition/named elements=],
and whose [=view transition params/initial snapshot containing block size=] is |transition|'s [=ViewTransition/initial snapshot containing block size=].
- Note: The inbound transition is activated after the dispatch of {{Window/pagereveal}} to ensure mutations made in this event apply to the captured new state.
-
1. [=Clear view transition=] |transition|.
Note: The ViewTransition object on the old Document should be destroyed after its state has been copied to the new Document below.
We explicitly clear it here since the old Document may be cached by the UA.
- 1. Call |transition|'s [=outbound post-capture steps=].
+ 1. Call |transition|'s [=outbound post-capture steps=] given |viewTransitionParams|.
## Monkey patches to HTML ## {#monkey-patch-to-html}
@@ -659,7 +659,12 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a
1. Let |outboundTransition| be a new {{ViewTransition}} object in |oldDocument|'s [=relevant Realm=],
whose [=ViewTransition/active types=] is |resolvedRule|.
- 1. Set |outboundTransition|'s [=outbound post-capture steps=] to |proceedWithNavigation|.
+ 1. Set |outboundTransition|'s [=outbound post-capture steps=] to the following steps given a [=view transition params=]-or-null |params|:
+ 1. Set |newDocument|'s [=inbound view transition params=] to |params|.
+
+ Note: The inbound transition is activated after the dispatch of {{Window/pagereveal}} to ensure mutations made in this event apply to the captured new state.
+
+ 1. Call |proceedWithNavigation|.
1. Set |oldDocument|'s [=active view transition=] to |outboundTransition|.
From 5bb19735fcc79893e38378f802d1e8037025fc06 Mon Sep 17 00:00:00 2001
From: Noam Rosenthal
Date: Fri, 9 Feb 2024 13:41:52 +0000
Subject: [PATCH 10/13] Address PR nits
---
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 cee46ad2f3d..07cff90e81f 100644
--- a/css-view-transitions-2/Overview.bs
+++ b/css-view-transitions-2/Overview.bs
@@ -507,7 +507,7 @@ The {{CSSViewTransitionRule}} represents a ''@view-transition'' rule.
Initially null.
-### View transition params ### {#view-transition-params-section}
+### The View transition params struct ### {#view-transition-params-struct}
A view transition params is a [=struct=] whose purpose is to serialize view transition information across documents.
It has the following [=struct/items=]:
From 6606c42ca0cff7ae11a4b6fe1cf05be47bdb00c2 Mon Sep 17 00:00:00 2001
From: Noam Rosenthal
Date: Fri, 9 Feb 2024 19:50:06 +0000
Subject: [PATCH 11/13] nits
---
css-view-transitions-2/Overview.bs | 43 +++++++++++++++---------------
1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs
index 07cff90e81f..5a0e03d1b12 100644
--- a/css-view-transitions-2/Overview.bs
+++ b/css-view-transitions-2/Overview.bs
@@ -27,6 +27,7 @@ spec:css-view-transitions-1;
text: named elements; for: ViewTransition; type: dfn;
text: finished promise; for: ViewTransition; type: dfn;
text: ready promise; for: ViewTransition; type: dfn;
+ text: update callback; for: ViewTransition; type: dfn;
text: update callback done promise; for: ViewTransition; type: dfn;
text: initial snapshot containing block size; for: ViewTransition; type: dfn;
text: captured elements; type: dfn;
@@ -449,26 +450,26 @@ Note: as per default behavior, the ''@view-transition'' rule can be nested insid
The [=method steps=] for startViewTransition(|callbackOptions|) are as follows:
+ 1. Let |updateCallback| be null.
+
+ 1. If |callbackOptions| is an an {{UpdateCallback}}, set |updateCallback| to |callbackOptions|.
+
+ 1. Otherwise, if |callbackOptions| is a {{StartViewTransitionOptions}}, then set |updateCallback| to |callbackOptions|'s {{StartViewTransitionOptions/update}}.
+
1. If |this|'s [=active view transition=] is not null and its [=outbound post-capture steps=] is not null,
then:
- 1. Let |preSkippedTransition| be a new {{ViewTransition}} in |this|'s [=relevant realm=].
+ 1. Let |preSkippedTransition| be a new {{ViewTransition}} in |this|'s [=relevant realm=] whose [=ViewTransition/update callback=] is |updateCallback|.
1. [=Skip the view transition|Skip=] |preSkippedTransition| with an "{{InvalidStateError}}" {{DOMException}}.
1. Return |preSkippedTransition|.
- 1. If |callbackOptions| is not provided, then return the result of running the [=method steps=] for {{Document/startViewTransition()}}.
-
- 1. Otherwise, if |callbackOptions| is an {{UpdateCallback}}, then return the result of running the [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptions|.
-
- 1. Otherwise:
+ 1. Let |viewTransition| be the result of running the [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |updateCallback|.
- 1. Let |viewTransition| be the result of running [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |callbackOptions|'s {{StartViewTransitionOptions/update}}.
+ 1. If |callbackOptions| is a {{StartViewTransitionOptions}}, then set |viewTransition|'s [=ViewTransition/active types=] to |callbackOptions|'s {{StartViewTransitionOptions/type}}.
- 1. Set |viewTransition|'s [=ViewTransition/active types=] to |callbackOptions|'s {{StartViewTransitionOptions/type}}.
-
- 1. Return |viewTransition|.
+ 1. Return |viewTransition|.
## Extensions to the CSSRule interface ## {#extensions-to-cssrule-interface}
@@ -531,10 +532,6 @@ The {{CSSViewTransitionRule}} represents a ''@view-transition'' rule.
:: Null or a [=list=] of strings, initially null.
-### [=Captured elements=] ### {#captured-elements}
-
- A captured element is a [=struct=] with the following:
-
### Additions to [=captured element=] struct ### {#additions-to-captured-element-struct}
The [=captured element=] struct should contain these fields, in addition to the existing ones:
@@ -668,7 +665,11 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a
1. Set |oldDocument|'s [=active view transition=] to |outboundTransition|.
- Note: The process continues in [=setup view transition=], via [=perform pending transition operations=].
+ Note: The process continues in [=perform pending transition operations=].
+
+ 1. React to |outboundTransition|'s [=ViewTransition/finished promise=]:
+
+ 1. Call |proceedWithNavigation|.
1. The user agent should display the currently displayed frame until either:
* The {{Window/pagereveal}} event is fired.
@@ -696,19 +697,19 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a
Note: this means that starting a same-document transition before revealing the document would cancel a pending cross-document transition.
- 1. Let |transition| be a new {{ViewTransition}} in |document|'s [=relevant Realm=],
- whose [=ViewTransition/named elements=] is |inboundViewTransitionParams|'s [=view transition params/named elements=],
- and [=ViewTransition/initial snapshot containing block size=] is |inboundViewTransitionParams|'s [=view transition params/initial snapshot containing block size=].
-
1. [=Resolve @view-transition rule=] for |document| and let |resolvedRule| be the result.
1. If |resolvedRule| is "skip transition", then return null.
+ 1. Let |transition| be a new {{ViewTransition}} in |document|'s [=relevant Realm=],
+ whose [=ViewTransition/named elements=] is |inboundViewTransitionParams|'s [=view transition params/named elements=],
+ and [=ViewTransition/initial snapshot containing block size=] is |inboundViewTransitionParams|'s [=view transition params/initial snapshot containing block size=].
+
1. Set |document|'s [=active view transition=] to |transition|.
- 1. [=Resolve=] |inboundTransition|’s [=ViewTransition/update callback done promise=] with undefined.
+ 1. [=Resolve=] |transition|’s [=ViewTransition/update callback done promise=] with undefined.
- 1. Set |inboundTransition|’s [=ViewTransition/phase=] to "`update-callback-called`".
+ 1. Set |transition|’s [=ViewTransition/phase=] to "`update-callback-called`".
1. Set |transition|'s [=ViewTransition/active types=] to |resolvedRule|.
From 8e146217a380e54b50b2d3f6e21149afcc368463 Mon Sep 17 00:00:00 2001
From: Noam Rosenthal
Date: Mon, 12 Feb 2024 10:08:14 +0000
Subject: [PATCH 12/13] Add rendering suppression
---
css-view-transitions-2/Overview.bs | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs
index 5a0e03d1b12..16365596a5c 100644
--- a/css-view-transitions-2/Overview.bs
+++ b/css-view-transitions-2/Overview.bs
@@ -559,8 +559,15 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a
1. Let |viewTransitionParams| be null;
+ 1. Set |document|'s [=document/rendering suppression for view transitions=] to true.
+
+ Issue: though [=capture the old state=] appears here as a synchronous step, it is in fact an asynchronous step
+ as rendering an element into an image cannot be done synchronously. This should be more explicit in the L1 spec.
+
1. [=Capture the old state=] for |transition|.
+ 1. Set |document|'s [=document/rendering suppression for view transitions=] to false.
+
1. If this succeeded, then set |viewTransitionParams| to a new [=view transition params=] whose
[=view transition params/named elements=] is a [=map/clone=] of |transition|'s [=ViewTransition/named elements=],
and whose [=view transition params/initial snapshot containing block size=] is |transition|'s [=ViewTransition/initial snapshot containing block size=].
From d4c7d6d7208d0be0c4fa3a382f91ace793505e68 Mon Sep 17 00:00:00 2001
From: Noam Rosenthal
Date: Tue, 13 Feb 2024 18:07:53 +0000
Subject: [PATCH 13/13] Move skip steps to monkey patch
---
css-view-transitions-2/Overview.bs | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs
index 16365596a5c..d90d0814e66 100644
--- a/css-view-transitions-2/Overview.bs
+++ b/css-view-transitions-2/Overview.bs
@@ -37,6 +37,7 @@ spec:css-view-transitions-1;
text: perform pending transition operations; type: dfn;
text: setup view transition; type: dfn;
text: named view transition pseudo-element; type: dfn;
+ text: rendering suppression for view transitions; type: dfn;
spec:dom; type:dfn; text:document
spec:css22; type:dfn; text:element
spec:selectors-4; type:dfn;
@@ -550,6 +551,14 @@ When capturing the old or new state for an element, perform the following steps
Note: This is written in a monkey-patch manner, and will be merged into the algorithm once the L1 spec graduates.
+## Additions to skip steps: ## {#additional-skip-steps}
+
+Append the following steps to [=skip the view transition=] given a {{ViewTransition}} |transition|:
+ 1. If |transition|'s [=outbound post-capture steps=] is not null, then run |transition|'s [=outbound post-capture steps=] with null.
+
+ Note: This is written in a monkey-patch manner, and will be merged into the algorithm once the L1 spec graduates.
+
+
## Addition to pending transition operations ## {#additions-to-pending-transition-operation}
Prepend this to the [=Perform pending transition operations=] algorithm given a {{Document}} |document|:
@@ -674,10 +683,6 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a
Note: The process continues in [=perform pending transition operations=].
- 1. React to |outboundTransition|'s [=ViewTransition/finished promise=]:
-
- 1. Call |proceedWithNavigation|.
-
1. The user agent should display the currently displayed frame until either:
* The {{Window/pagereveal}} event is fired.
* its [=active view transition=]'s [=ViewTransition/phase=] is "`done`".