Skip to content

Commit 9d7be5c

Browse files
noamrkhushalsagar
andauthored
[css-view-transitions-2] Clarify a few nesting details (#10964)
* [css-view-transitions-2] Clarify a few nesting details - view-transition-group is tree-scoped - nearest/custom-ident act like contain Closes #10780 Closes #10633 * Simplify tree-scope matching * Make everything algorithmic * Update Overview.bs Co-authored-by: Khushal Sagar <[email protected]> --------- Co-authored-by: Khushal Sagar <[email protected]>
1 parent 0edbe98 commit 9d7be5c

File tree

1 file changed

+47
-28
lines changed

1 file changed

+47
-28
lines changed

css-view-transitions-2/Overview.bs

Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ spec:css-view-transitions-1;
4545
text: view transition name; type: dfn;
4646
text: group styles rule; type: dfn;
4747
text: update pseudo-element styles rule; type: dfn;
48+
text: document-scoped view transition name; type: dfn;
4849
spec:dom; type:dfn; text:document
4950
spec:css22; type:dfn; text:element
5051
spec:selectors-4; type:dfn;
@@ -884,24 +885,6 @@ and by applying ''view-transition-group'' to the internal element referencing th
884885
The [=used value=] for 'view-transition-group' resolves to a 'view-transition-name' in its ancestor chain, or to ''view-transition-name/none''. When generating the [=named view transition pseudo-element=], the ''::view-transition-group()'' with that name
885886
would be the parent of the ''::view-transition-group()'' generated for this element's 'view-transition-name'.
886887

887-
When the [=computed value=] of 'view-transition-name' for an element is ''view-transition-name/none'', its 'view-transition-group' [=used value=] is always resolved to ''view-transition-name/none'' as well.
888-
889-
<dl dfn-type=value dfn-for=view-transition-group>
890-
: <dfn>normal</dfn>
891-
:: The [=used value=] is the element's [=nearest containing group name=].
892-
893-
: <dfn>nearest</dfn>
894-
:: The [=used value=] is the 'view-transition-name' [=computed value=] of the nearest ancestor whose 'view-transition-name' [=computed value=] is not ''view-transition-name/none''.
895-
896-
: <dfn>contain</dfn>
897-
:: The [=used value=] is the element's [=nearest containing group name=].
898-
899-
Note: Descendant elements are contained within this group by default, as it would be their element's [=nearest containing group name=].
900-
901-
: <dfn><<custom-ident>></dfn>
902-
:: The [=used value=] is the given <<custom-ident>> if the element has an ancestor whose 'view-transition-name' [=computed value=] is that <<custom-ident>>, otherwise the element's [=nearest containing group name=]
903-
</dl>
904-
905888
# Algorithms # {#algorithms}
906889

907890
## Data structures ## {#cross-doc-data-structures}
@@ -1177,28 +1160,64 @@ When capturing the old or new state for an element, perform the following steps
11771160

11781161
## Capturing and applying 'view-transition-group' ## {#vt-group-algorithm}
11791162

1180-
### Compute the nearest containing 'view-transition-group' ### {#vt-group-nearest-contain}
1181-
<div algorithm="nearest containing group name">
1163+
### Resolving the 'view-transition-group' value ### {#vt-group-value-resolve}
1164+
1165+
<div algorithm="resolve the document-scoped view-transition-group">
1166+
To get the <dfn>document-scoped view transition group</dfn> of an {{Element}} |element|, perform the following steps:
1167+
1168+
1. Let |computedGroup| be the [=computed value=] of element's 'view-transition-group' property.
1169+
1. If |computedGroup| is associated with |element|'s [=node document=], return |computedGroup|.
1170+
1. Return ''view-transition-group/normal''.
1171+
</div>
1172+
1173+
### Resolving the containing group name ### {#vt-containing-group-name-resolve}
1174+
1175+
<div algorithm="resolve nearest containing group name">
1176+
1177+
To resolve the <dfn>nearest containing group name</dfn> of an {{Element}} |element|, perform the following steps given a {{ViewTransition}} |viewTransition|:
1178+
1. Assert: |element| participates in |viewTransition|.
1179+
1. Let |ancestorGroup| be |element|'s nearest [=flat tree=] [=tree/ancestor=] who participates in |viewTransition| and whose [=document-scoped view transition group=] is not ''view-transition-group/normal''.
1180+
1. If |ancestorGroup| exists, return |ancestorGroup|'s [=document-scoped view transition name=].
1181+
1. Return ''view-transition-name/none''.
1182+
</div>
1183+
1184+
### Resolving the group name ### {#vt-group-name-resolve}
1185+
1186+
<div algorithm="resolve used group name">
1187+
To resolve the <dfn>used group name</dfn> of an {{Element}} |element|, perform the following steps given a {{ViewTransition}} |transition|:
11821188

1183-
To get the <dfn>nearest containing group name</dfn> for an {{Element}} |element|, perform the following steps:
1189+
1. Assert: |element| participates in |transition|.
1190+
1. Let |group| be |element|'s [=document-scoped view transition group=].
1191+
1. Let |containingGroupName| be |element|'s [=nearest containing group name=] given |transition|.
1192+
1. Return the first matching statement, switching on |group|:
11841193

1185-
1. Let |nearestAncestorWithContain| be |element|'s nearest ancestor whose 'view-transition-name' [=computed value=] is not ''view-transition-name/none'' and whose 'view-transition-group' [=computed value=] is ''view-transition-group/contain''.
1186-
1. If |nearestAncestorWithContain| is null, return ''view-transition-group/none''.
1187-
1. Otherwise, return |nearestAncestorWithContain|'s 'view-transition-name' [=computed value=].
1194+
<dl dfn-type=value dfn-for=view-transition-group>
1195+
: <dfn>normal</dfn>
1196+
: <dfn>contain</dfn>
1197+
:: |containingGroupName|.
1198+
1199+
Note: an element with ''view-transition-group/contain'' becomes the [=nearest containing group name=] for its descendants.
1200+
1201+
: <dfn>nearest</dfn>
1202+
:: The [=document-scoped view transition name=] of the element's nearest [=flat tree=] ancestor which participates in the |transition|.
1203+
1204+
: <dfn><<custom-ident>></dfn>
1205+
:: |group| if the element has a [=flat tree=] [=tree/ancestor=] whose [=document-scoped view transition name=] is |group| and participates in |transition|; Otherwise |containingGroupName|.
1206+
</dl>
11881207
</div>
11891208

11901209
### Compute the old 'view-transition-group' ### {#vt-group-capture-old}
11911210
<div algorithm="additional old capture steps (group)">
1192-
When [[css-view-transitions-1#capture-old-state-algorithm|capturing the old state for an element]], perform the following steps given a [=captured element=] |capturedElement|, and an [=element=] |element|:
1211+
When [[css-view-transitions-1#capture-old-state-algorithm|capturing the old state for an element]], perform the following steps given a [=captured element=] |capturedElement|, a {{ViewTransition}} |transition|, and an [=element=] |element|:
11931212

1194-
1. Set |capturedElement|'s [=captured element/containing group name=] to the [=used value=] of |element|'s ''view-transition-group''.
1213+
1. Set |capturedElement|'s [=captured element/containing group name=] to |element|'s [=used group name=] given |transition|.
11951214
</div>
11961215

11971216
### Compute the new 'view-transition-group' ### {#vt-group-capture-new}
11981217
<div algorithm="additional new capture steps (group)">
1199-
When [[css-view-transitions-1#capture-new-state-algorithm|capturing the new state for an element]], perform the following steps given a [=captured element=] |capturedElement| and an [=element=] |element|:
1218+
When [[css-view-transitions-1#capture-new-state-algorithm|capturing the new state for an element]], perform the following steps given a [=captured element=] |capturedElement| a {{ViewTransition}} |transition|, and an [=element=] |element|:
12001219

1201-
1. Set |capturedElement|'s [=captured element/containing group name=] to the [=used value=] of |element|'s 'view-transition-group'.
1220+
1. Set |capturedElement|'s [=captured element/containing group name=] to |element|'s [=used group name=] given |transition|.
12021221
</div>
12031222

12041223
### Reparent a ''::view-transition-group()'' to its specified containing group ### {#vt-group-reparent}

0 commit comments

Comments
 (0)