Skip to content

Commit 507860e

Browse files
committed
[css-view-transitions-1][editorial] Improve structure of pseudo-elements section
* Define some high-level terms for better cross-referencing * Give a proper introduction to the pseudo tree * Move definition of named view-transition pseudo-elements to after we define what view-transition pseudo-elements are so we know what we're talking about * Give each pseudo-element a proper definition (“the algo generates it” is not a definition) * Include enough information that the pseudo-element tree is understandable from this section alone * Improve section titles * Make definition of view-transition-name more definitive
1 parent c0dd54f commit 507860e

File tree

2 files changed

+277
-80
lines changed

2 files changed

+277
-80
lines changed

css-view-transitions-1/Overview.bs

Lines changed: 121 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Editor: Tab Atkins-Bittner, Google, http://xanthir.com/contact/, w3cid 42199
1313
Editor: Jake Archibald, Google, w3cid 76394
1414
Editor: Khushal Sagar, Google, w3cid 122787
1515
Abstract: This module defines the View Transition API, along with associated properties and pseudo-elements,
16-
which allowsdevelopers to create animated visual transitions representing changes in the document state.
16+
which allows developers to create animated visual transitions representing changes in the document state.
1717
Markup Shorthands: css yes, markdown yes
1818
</pre>
1919

@@ -27,13 +27,16 @@ spec:webidl; type:interface; text:Promise
2727
spec:css-images-4; type:function; text:element()
2828
spec:dom; type:dfn; text:document
2929
spec:css-2022; type:dfn; text:style sheet
30-
spec:selectors-4; type:dfn; text:type selector
30+
spec:selectors-4; type:dfn;
31+
text:selector
32+
text:type selector
3133
spec:css-box-4; type:dfn; text:border box
3234
spec:css-display-3; type:dfn;
3335
text:containing block
3436
text:replaced element
3537
spec:css-cascade-5; type:dfn; text:computed value
3638
spec:css22; type:dfn; text:element
39+
spec:css-break-4; type:dfn; text:fragment
3740
</pre>
3841

3942
<pre class=anchors>
@@ -143,7 +146,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
143146
using a static visual capture of the old state, and a live capture of the new state.
144147
These captures are represented as a tree of [=pseudo-elements=]
145148
(detailed in [[#view-transition-pseudos]]),
146-
where the old visual state to co-exist with the new state,
149+
where the old visual state co-exists with the new state,
147150
allowing effects such as cross-fading
148151
while animating from the old to new size and position.
149152

@@ -232,7 +235,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
232235
That means a failure to create a visual transition,
233236
which can happen due to misconfiguration or device constraints,
234237
will not prevent the developer's {{UpdateCallback}} being called,
235-
even if it's known in advance that the transition animation cannot happen.
238+
even if it's known in advance that the transition animations cannot happen.
236239

237240
For example, if the developer calls {{ViewTransition/skipTransition()}} at the start of the [[#lifecycle|view transition lifecycle]],
238241
the steps relating to the animated transition,
@@ -496,7 +499,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
496499
</pre>
497500

498501
The 'view-transition-name' property “tags” an element
499-
as [=involved in a view transition=],
502+
as potentially [=involved in a view transition=],
500503
capturing it independently in the [=view transition tree=]
501504
under the specified <dfn>view transition name</dfn>.
502505
An element so captured is animated independently of the rest of the page.
@@ -506,8 +509,8 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
506509
:: The [=/element=] will not participate independently in a view transition.
507510

508511
: <dfn><<custom-ident>></dfn>
509-
:: The [=/element=] will participate in a view transition,
510-
as either an old or new [=/element=],
512+
:: The [=/element=] participates independently in a view transition--
513+
as either an old or new [=/element=]--
511514
with the specified [=view transition name=].
512515

513516
The value <css>none</css> is excluded from <<custom-ident>> here.
@@ -525,6 +528,11 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
525528
This may be confusing, since the elements themselves are not necessarily referring to the same object,
526529
but it is a useful model to consider them to be visual states of the same conceptual page entity.
527530

531+
If the element’s [=principal box=] is [=fragmented=],
532+
[=skips its contents|skipped=],
533+
or [=not rendered=],
534+
this property has no effect.
535+
528536
# Layout and rendering changes # {#layout-rendering-changes}
529537

530538
## Named and transitioning elements ## {#named-and-transitioning}
@@ -579,7 +587,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
579587

580588
# Pseudo-elements # {#pseudo}
581589

582-
## Pseudo-element root ## {#pseudo-root}
590+
## Pseudo-element Trees ## {#pseudo-root}
583591

584592
Note: This is a general definition for trees of pseudo-elements. If other features need this behavior, these definitions will be moved to [[css-pseudo-4]].
585593

@@ -597,29 +605,24 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
597605
Note: This means that `::view-transition-new(ident):only-child` will only select `::view-transition-new(ident)` if the parent `::view-transitions-image-pair(ident)` contains a single [=tree/child=].
598606
As in, there is no [=tree/sibling=] `::view-transition-old(ident)`.
599607

600-
## Named view-transition pseudo-elements ## {#named-view-transition-pseudo}
601-
602-
A <dfn>named view-transition pseudo-element</dfn> is a type of [=tree-abiding pseudo-elements=].
603-
604-
It has a <dfn for="named view-transition pseudo-element">view-transition name</dfn>,
605-
a string.
606-
607-
Their selector takes a <<pt-name-selector>> argument.
608-
609-
<pre class=prod>
610-
<dfn>&lt;pt-name-selector></dfn> = '*' | <<custom-ident>>
611-
</pre>
612-
613-
The selector matches if the <<pt-name-selector>> is `*` or matches the [=named view-transition pseudo-element=]'s [=view transition name=].
614-
615-
The specificity of a view-transition selector with a <<custom-ident>> argument is the same as for other pseudo-elements,
616-
and is equivalent to a [=type selector=].
617-
618-
The specificity of a view-transition selector with a `*` argument is zero.
619-
620-
Note: The [=view transition name=] is set to the 'view-transition-name' that triggered its creation.
621-
622-
## View transition pseudo-elements ## {#view-transition-pseudos}
608+
## View Transition Pseudo-elements ## {#view-transition-pseudos}
609+
610+
The visualization of a [=view transition=]
611+
is represented as a [=pseudo-element tree=]
612+
called the <dfn>view transition tree</dfn>
613+
composed of the <dfn>view transition pseudo-elements</dfn> defined below.
614+
This tree is built during the [=setup transition pseudo-elements=] step,
615+
and is rooted under a ''::view-transition'' pseudo-element
616+
[=originating element|originating=] from the [=root element=].
617+
All of the [=view transition pseudo-elements=] are selected
618+
from their [=ultimate originating element=], the [=document element=].
619+
620+
<div class="example">
621+
For example,
622+
the ''::view-transition-group()'' pseudo-element is attached to the root element selector directly,
623+
as in '':root::view-transition-group()'';
624+
it is not attached to its parent, the ''::view-transition'' pseudo-element.
625+
</div>
623626

624627
<div class=note>
625628
Once the user-agent has captured both the “old” and “new” states of the document,
@@ -646,15 +649,49 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
646649
This enables full customization of the transition.
647650
</div>
648651

649-
### <dfn>::view-transition</dfn> ### {#::view-transition}
652+
### Named View Transition Pseudo-elements ### {#named-view-transition-pseudo}
653+
654+
Several of the [=view transition pseudo-elements=]
655+
are <dfn>named view transition pseudo-elements</dfn>,
656+
which are [=functional pseudo-element|functional=] [=tree-abiding pseudo-element|tree-abiding=] [=view transition pseudo-elements=]
657+
associated with a [=view transition name=].
658+
These pseudo-elements take a <<pt-name-selector>> as their argument,
659+
and their syntax follows the pattern:
660+
661+
<pre class=prod>
662+
::view-transition-<var>pseudo</var>(<<pt-name-selector>>)
663+
</pre>
664+
665+
where <<pt-name-selector>> selects a [=view transition name=],
666+
and has the following syntax definition:
667+
668+
<pre class=prod>
669+
<dfn>&lt;pt-name-selector></dfn> = '*' | <<custom-ident>>
670+
</pre>
671+
672+
A [=named view transition pseudo-element=] [=selector=] only matches
673+
a corresponding [=pseudo-element=]
674+
if its <<pt-name-selector>> matches that [=pseudo-element=]’s [=view transition name=],
675+
i.e. if it is either ''*'' or a matching <<custom-ident>>.
650676

651-
<div class=note>This element serves as a parent for all ''::view-transition-group()'' pseudo-elements.</div>
677+
Note: The [=view transition name=] of a [=view transition pseudo-element=]
678+
is set to the 'view-transition-name' that triggered its creation.
652679

653-
A [=tree-abiding pseudo-element=] that is also
654-
a [=pseudo-element root=].
655-
Its [=originating element=] is the document's [=document element=].
680+
The specificity of a [=named view transition pseudo-element=] [=selector=]
681+
with a <<custom-ident>> argument
682+
is equivalent to a [=type selector=].
683+
The specificity of a [=named view transition pseudo-element=] [=selector=]
684+
with a ''*'' argument
685+
is zero.
656686

657-
Its [=containing block=] is the [=snapshot containing block=].
687+
### View Transition Tree Root: the ''::view-transition'' pseudo-element ### {#view-transition-pseudo}
688+
689+
The <dfn>::view-transition</dfn> [=pseudo-element=]
690+
is a [=tree-abiding pseudo-element=] that is also a [=pseudo-element root=].
691+
Its [=originating element=] is the document's [=document element=],
692+
and its [=containing block=] is the [=snapshot containing block=].
693+
694+
Note: This element serves as the [=tree/parent=] of all ''::view-transition-group()'' pseudo-elements.
658695

659696
The following is added to the [=global view transition user agent style sheet=]:
660697

@@ -670,12 +707,19 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
670707
and position all ''::view-transition-group()'' pseudo-elements relative to the [=snapshot containing block origin=].
671708
</div>
672709

673-
### <dfn>::view-transition-group( <<pt-name-selector>> )</dfn> ### {#::view-transition-group}
710+
### View Transition Named Subtree Root: the ''::view-transition-group()'' pseudo-element ### {#::view-transition-group}
711+
712+
The <dfn>::view-transition-group()</dfn> [=pseudo-element=]
713+
is a [=named view transition pseudo-element=]
714+
that represents a matching named [=view transition=] capture.
715+
A ''::view-transition-group()'' [=pseudo-element=]
716+
is generated for each [=view transition name=]
717+
as a [=tree/child=] of the ''::view-transition'' [=pseudo-element=],
718+
and contains a corresponding ''::view-transition-image-pair()''.
674719

675720
<div class=note>
676721
This element initially mirrors the size and position of the “old” element,
677722
or the “new” element if there isn't an “old” element.
678-
It is always a [=tree/child=] of a ''::view-transition''.
679723

680724
If there's both an “old” and “new” state,
681725
styles in the [=document/view transition style sheet=] animate this pseudo-element's 'width' and 'height'
@@ -686,12 +730,6 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
686730
This style is generated dynamically since the values of animated properties are determined at the time that the transition begins.
687731
</div>
688732

689-
A [=tree-abiding pseudo-element=]
690-
that is also a [=named view-transition pseudo-element=],
691-
and [=tree/participates=] in a [=pseudo-element tree=].
692-
693-
It is selected from its [=ultimate originating element=], the [=document element=].
694-
695733
The following is added to the [=global view transition user agent style sheet=]:
696734

697735
```css
@@ -705,21 +743,25 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
705743
}
706744
```
707745

708-
### <dfn>::view-transition-image-pair( <<pt-name-selector>> )</dfn> ### {#::view-transition-image-pair}
746+
### View Transition Image Pair Isolation: the ''::view-transition-image-pair()'' pseudo-element ### {#::view-transition-image-pair}
709747

710-
<div class=note>
711-
This element is a child of the group element and provides ''isolation: isolate'' for its children.
712-
It's needed so that its children can be blended with non-normal blend modes without affecting other visual outputs.
748+
The <dfn>::view-transition-image-pair()</dfn> [=pseudo-element=]
749+
is a [=named view transition pseudo-element=]
750+
that represents a pair of corresponding old/new [=view transition=] captures.
751+
This pseudo-element is a [=tree/child=] of the corresponding ''::view-transition-group()'' pseudo-element
752+
and contains
753+
a corresponding ''::view-transition-old()'' pseudo-element
754+
and/or
755+
a corresponding ''::view-transition-new()'' pseudo-element
756+
(in that order).
713757

714-
It is always present as a [=tree/child=] of each ''::view-transition-group()''.
758+
<div class=note>
759+
This element exists to provide ''isolation: isolate'' for its children,
760+
and is always present as a [=tree/child=] of each ''::view-transition-group()''.
761+
This isolation allows the image pair to be blended with non-normal blend modes
762+
without affecting other visual outputs.
715763
</div>
716764

717-
A [=tree-abiding pseudo-element=]
718-
that is also a [=named view-transition pseudo-element=],
719-
and [=tree/participates=] in a [=pseudo-element tree=].
720-
721-
It is selected from its [=ultimate originating element=], the [=document element=].
722-
723765
The following is added to the [=global view transition user agent style sheet=]:
724766

725767
```css
@@ -732,32 +774,23 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
732774
}
733775
```
734776

735-
### <dfn>::view-transition-old( <<pt-name-selector>> )</dfn> ### {#::view-transition-old}
736-
737-
<div class=note>
738-
739-
This element is a replaced element that produced the visual representation of the “old” state taken from user-agent provided snapshots.
777+
### View Transition Old State Image: the ''::view-transition-old()'' pseudo-element ### {#::view-transition-old}
740778

741-
This is only ever a [=tree/child=] of a ''::view-transition-image-pair()'',
742-
never has any [=tree/children=],
743-
and is omitted if there's no “old” state to represent.
779+
The <dfn>::view-transition-old()</dfn> [=pseudo-element=]
780+
is an empty [=named view transition pseudo-element=]
781+
that represents a visual snapshot of the “old” state as a [=replaced element=];
782+
it is omitted if there's no “old” state to represent.
783+
Each ''::view-transition-old()'' pseudo-element is a [=tree/child=]
784+
of the corresponding ''::view-transition-image-pair()'' pseudo-element.
744785

786+
<div class=note>
745787
'':only-child'' can be used to match cases where this element is the only element in the ''::view-transition-image-pair()''.
746788

747789
The appearance of this element can be manipulated with `object-*` properties in the same way that other replaced elements can be.
748-
749790
</div>
750791

751-
A [=tree-abiding pseudo-element=]
752-
that is also a [=named view-transition pseudo-element=],
753-
and [=tree/participates=] in a [=pseudo-element tree=].
754-
755-
It is selected from its [=ultimate originating element=], the [=document element=].
756-
757-
It is a [=replaced element=], with [=natural dimensions=] equal to the content's size.
758-
759-
Note: The image content is captured in [=capture the image=],
760-
then set and updated in [=setup transition pseudo-elements=] and [=update pseudo-element styles=].
792+
Note: The content and [=natural dimensions=] of the image are captured in [=capture the image=],
793+
and set in [=setup transition pseudo-elements=].
761794

762795
The following is added to the [=global view transition user agent style sheet=]:
763796

@@ -779,10 +812,20 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
779812

780813
Note: Additional styles in the [=document/view transition style sheet=] added to animate these pseudo-elements are detailed in [=setup transition pseudo-elements=] and [=update pseudo-element styles=].
781814

782-
### <dfn>::view-transition-new( <<pt-name-selector>> )</dfn> ### {#::view-transition-new}
815+
### View Transition New State Image: the ''::view-transition-new()'' pseudo-element ### {#::view-transition-new}
783816

784-
Identical to ''::view-transition-old()'',
785-
except the following styles added to the [=global view transition user agent style sheet=]:
817+
The <dfn>::view-transition-new()</dfn> [=pseudo-element=]
818+
(like the analogous ''::view-transition-old()'' pseudo-element)
819+
is an empty [=named view transition pseudo-element=]
820+
that represents a visual snapshot of the “new” state as a [=replaced element=];
821+
it is omitted if there's no “new” state to represent.
822+
Each ''::view-transition-new()'' pseudo-element is a [=tree/child=]
823+
of the corresponding ''::view-transition-image-pair()'' pseudo-element.
824+
825+
Note: The content and [=natural dimensions=] of the image are captured in [=capture the image=],
826+
then set and updated in [=setup transition pseudo-elements=] and [=update pseudo-element styles=].
827+
828+
The following is added to the [=global view transition user agent style sheet=]:
786829

787830
```css
788831
:root::view-transition-new(*) {
@@ -797,8 +840,6 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
797840
}
798841
```
799842

800-
Note: The construction of this tree is performed in the [=setup transition pseudo-elements=] algorithm.
801-
802843
# Concepts # {#concepts}
803844

804845
## Phases ## {#phases-concept}

0 commit comments

Comments
 (0)