Skip to content

Commit eaf34b1

Browse files
authored
[css-view-transitions-1] Fix tree-scoping from element-based to name-based. (#10528)
* [css-view-transitions-1] Fix tree-scoping from being element-based to being name-based. The previous fix for using the tree context made it inconsistent with how shadow DOM styling works for things like anchor positioning, and made it so that e.g. `::part` cannot set a `view-transition-name`. Refactored to make the `view-transition-name` a tree-scoped name, rather than check the tree context of the element. Closes #10145 * Add changelog entry * Modifiy vt-name algorithm
1 parent b796137 commit eaf34b1

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

css-view-transitions-1/Overview.bs

+17-4
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,10 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
538538
as either an old or new [=/element=]--
539539
with the specified [=view transition name=].
540540

541+
Each [=view transition name=] is a [=tree-scoped name=].
542+
543+
Note: Since currently only document-scoped view transitions are supported, only view transition names that are associated with the document are respected.
544+
541545
The values <css>none</css> and <css>auto</css> are excluded from <<custom-ident>> here.
542546

543547
Note: If this name is not unique
@@ -559,6 +563,16 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
559563
this property has no effect.
560564
See [[#algorithms]] for exact details.
561565

566+
<div algorithm>
567+
To get the <dfn>document-scoped view transition name</dfn> for an {{Element}} |element|:
568+
569+
1. Let |scopedViewTransitionName| be the [=computed value=] of 'view-transition-name' for |element|.
570+
571+
1. If |scopedViewTransitionName| is associated with |element|'s [=node document=], then return |scopedViewTransitionName|.
572+
573+
1. Otherwise, return ''view-transition-name/none''.
574+
</div>
575+
562576
### Rendering Consolidation ### {#named-and-transitioning}
563577

564578
[=/Elements=] [=captured in a view transition=] during a [=view transition=]
@@ -1319,7 +1333,6 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
13191333

13201334
1. [=list/For each=] |element| of every [=/element=] that is [=/connected=],
13211335
and has a [=node document=] equal to |document|,
1322-
and has a [=tree context=] equal to |document|,
13231336
in [paint order](https://drafts.csswg.org/css2/#painting-order):
13241337

13251338
<div class=note>We iterate in paint order to ensure that this order is cached in |namedElements|.
@@ -1335,7 +1348,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
13351348
Note: [=box fragment=] here does not refer to fragmentation of <a href="https://www.w3.org/TR/CSS2/visuren.html#inline-boxes">inline boxes</a> across <a href="https://www.w3.org/TR/CSS2/visuren.html#line-box">line boxes</a>.
13361349
Such inlines can participate in a transition.
13371350

1338-
1. Let |transitionName| be the [=computed value=] of 'view-transition-name' for |element|.
1351+
1. Let |transitionName| be the |element|'s [=document-scoped view transition name=].
13391352

13401353
1. If |transitionName| is ''view-transition-name/none'',
13411354
or |element| is [=element-not-rendered|not rendered=],
@@ -1403,12 +1416,11 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
14031416

14041417
1. [=list/For each=] |element| of every [=/element=] that is [=/connected=],
14051418
and has a [=node document=] equal to |document|,
1406-
and has a [=tree context=] equal to |document|,
14071419
in [paint order](https://drafts.csswg.org/css2/#painting-order):
14081420

14091421
1. If any [=flat tree=] ancestor of this |element| [=skips its contents=], then [=continue=].
14101422

1411-
1. Let |transitionName| be the [=computed value=] of 'view-transition-name' for |element|.
1423+
1. Let |transitionName| be |element|'s [=document-scoped view transition name=].
14121424

14131425
1. If |transitionName| is ''view-transition-name/none'',
14141426
or |element| is [=element-not-rendered|not rendered=],
@@ -1966,6 +1978,7 @@ Changes from <a href="https://www.w3.org/TR/2023/WD-css-view-transitions-1-20230
19661978
* Use snapshot containing block when capturing new state for document element. See <a href="https://github.com/w3c/csswg-drafts/issues/10177">issue #10177</a>.
19671979
* Fix algorithm for dispatching updateDOMCallback promise.
19681980
* Scope view transition names to matching tree context. See <a href="https://github.com/w3c/csswg-drafts/issues/10145">issue 10145</a>.
1981+
* Fix scoping to match name instead of element. See <a href="https://github.com/w3c/csswg-drafts/issues/10145">issue 10145</a>.
19691982

19701983
<h3 id="changes-since-2022-05-25">
19711984
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)