Skip to content

Commit bdf1e91

Browse files
vmpstrkhushalsagar
andauthored
[css-view-transitions-1] Refactor VT old capture algorithm (#9135)
* Refactor VT old capture algorithm * update * update * update * Typo --------- Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
1 parent 11dd0f2 commit bdf1e91

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

css-view-transitions-1/Overview.bs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,8 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
13141314

13151315
1. Let |usedTransitionNames| be a new [=/set=] of strings.
13161316

1317+
1. Let |captureElements| be a new [=/list=] of elements.
1318+
13171319
1. Let |document| be |transition|'s [=relevant global object's=] [=associated document=].
13181320

13191321
1. Set |transition|'s [=ViewTransition/initial snapshot containing block size=] to the [=snapshot containing block size=].
@@ -1322,6 +1324,9 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
13221324
and has a [=node document=] equal to to |document|,
13231325
in [paint order](https://drafts.csswg.org/css2/#painting-order):
13241326

1327+
<div class=note>We iterate in paint order to ensure that this order is cached in |namedElements|.
1328+
This defines the DOM order for ::view-transition-group pseudo-elements, such that the element at the bottom of the paint stack generates the first pseudo child of ::view-transition.</div>
1329+
13251330
1. If any [=flat tree=] ancestor of this |element| [=skips its contents=], then [=continue=].
13261331

13271332
1. If |element| has more than one [=box fragment=], then [=continue=].
@@ -1339,6 +1344,14 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
13391344

13401345
1. [=set/Append=] |transitionName| to |usedTransitionNames|.
13411346

1347+
1. Set |element|'s [=captured in a view transition=] to true.
1348+
1349+
1. [=list/Append=] |element| to |captureElements|.
1350+
1351+
<div class="note">The algorithm continues in a separate loop to ensure that [=captured in a view transition=] is set on all elements participating in this capture before it is read by future steps in the algorithm.</div>
1352+
1353+
1. [=list/For each=] |element| in |captureElements|:
1354+
13421355
1. Let |capture| be a new [=captured element=] struct.
13431356

13441357
1. Set |capture|'s [=old image=] to the result of [=capturing the image=] of |element|.
@@ -1363,7 +1376,13 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
13631376

13641377
1. Set |capture|'s [=captured element/old mix-blend-mode=] to the [=computed value=] of 'mix-blend-mode' on |element|.
13651378

1379+
1. Let |transitionName| be the [=computed value=] of 'view-transition-name' for |element|.
1380+
13661381
1. Set |namedElements|[|transitionName|] to |capture|.
1382+
1383+
1. [=list/For each=] |element| in |captureElements|:
1384+
1385+
1. Set |element|'s [=captured in a view transition=] to false.
13671386
</div>
13681387

13691388
### [=Capture the new state=] ### {#capture-new-state-algorithm}
@@ -1855,6 +1874,7 @@ Changes from <a href="https://www.w3.org/TR/2023/WD-css-view-transitions-1-20230
18551874
* Use a keyframe to add plus-lighter blending during cross-fade. See <a href="https://github.com/w3c/csswg-drafts/issues/8924">issue 8924</a>.
18561875
* Add mix-blend-mode to list of properties copied over to the ''::view-transition-group''. See <a href="https://github.com/w3c/csswg-drafts/issues/8962">issue 8962</a>.
18571876
* Add text-orientation to list of properties copied over to the ''::view-transition-group''. See <a href="https://github.com/w3c/csswg-drafts/issues/8230">issue 8230</a>.
1877+
* Refactor the old capture algorithm to properly set [=captured in a view transition=] before reading the value.
18581878

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

0 commit comments

Comments
 (0)