From eaf34b1a629ff3fa6bf557a90f3f1fc01182aa3e Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Fri, 5 Jul 2024 09:09:15 +0000 Subject: [PATCH] [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 --- css-view-transitions-1/Overview.bs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/css-view-transitions-1/Overview.bs b/css-view-transitions-1/Overview.bs index f21b1567080..df0fb3580e4 100644 --- a/css-view-transitions-1/Overview.bs +++ b/css-view-transitions-1/Overview.bs @@ -538,6 +538,10 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; as either an old or new [=/element=]-- with the specified [=view transition name=]. + Each [=view transition name=] is a [=tree-scoped name=]. + + Note: Since currently only document-scoped view transitions are supported, only view transition names that are associated with the document are respected. + The values none and auto are excluded from <> here. Note: If this name is not unique @@ -559,6 +563,16 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; this property has no effect. See [[#algorithms]] for exact details. +
+ To get the document-scoped view transition name for an {{Element}} |element|: + + 1. Let |scopedViewTransitionName| be the [=computed value=] of 'view-transition-name' for |element|. + + 1. If |scopedViewTransitionName| is associated with |element|'s [=node document=], then return |scopedViewTransitionName|. + + 1. Otherwise, return ''view-transition-name/none''. +
+ ### Rendering Consolidation ### {#named-and-transitioning} [=/Elements=] [=captured in a view transition=] during a [=view transition=] @@ -1319,7 +1333,6 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; 1. [=list/For each=] |element| of every [=/element=] that is [=/connected=], and has a [=node document=] equal to |document|, - and has a [=tree context=] equal to |document|, in [paint order](https://drafts.csswg.org/css2/#painting-order):
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; Note: [=box fragment=] here does not refer to fragmentation of inline boxes across line boxes. Such inlines can participate in a transition. - 1. Let |transitionName| be the [=computed value=] of 'view-transition-name' for |element|. + 1. Let |transitionName| be the |element|'s [=document-scoped view transition name=]. 1. If |transitionName| is ''view-transition-name/none'', or |element| is [=element-not-rendered|not rendered=], @@ -1403,12 +1416,11 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; 1. [=list/For each=] |element| of every [=/element=] that is [=/connected=], and has a [=node document=] equal to |document|, - and has a [=tree context=] equal to |document|, in [paint order](https://drafts.csswg.org/css2/#painting-order): 1. If any [=flat tree=] ancestor of this |element| [=skips its contents=], then [=continue=]. - 1. Let |transitionName| be the [=computed value=] of 'view-transition-name' for |element|. + 1. Let |transitionName| be |element|'s [=document-scoped view transition name=]. 1. If |transitionName| is ''view-transition-name/none'', or |element| is [=element-not-rendered|not rendered=], @@ -1966,6 +1978,7 @@ Changes from issue #10177. * Fix algorithm for dispatching updateDOMCallback promise. * Scope view transition names to matching tree context. See issue 10145. +* Fix scoping to match name instead of element. See issue 10145.

Changes from 2022-05-25 Working Draft