Skip to content

Commit b68c859

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
1 parent 0e01087 commit b68c859

File tree

2 files changed

+261
-72
lines changed

2 files changed

+261
-72
lines changed

css-view-transitions-1/Overview.bs

Lines changed: 105 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
579579

580580
# Pseudo-elements # {#pseudo}
581581

582-
## Pseudo-element root ## {#pseudo-root}
582+
## Pseudo-element Trees ## {#pseudo-root}
583583

584584
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]].
585585

@@ -597,29 +597,24 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
597597
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=].
598598
As in, there is no [=tree/sibling=] `::view-transition-old(ident)`.
599599

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}
600+
## View Transition Pseudo-elements ## {#view-transition-pseudos}
601+
602+
The visualization of a [=view transition=]
603+
is represented as a [=pseudo-element tree=]
604+
called the <dfn>view transition tree</dfn>
605+
composed of the <dfn>view transition pseudo-elements</dfn> defined below.
606+
This tree is built during the [=setup transition pseudo-elements=] step,
607+
and is rooted under a ''::view-transition'' pseudo-element
608+
[=originating element|originating=] from the [=root element=].
609+
All of the [=view transition pseudo-elements=] are selected
610+
from their [=ultimate originating element=], the [=document element=].
611+
612+
<div class="example">
613+
For example,
614+
the ''::view-transition-group()'' pseudo-element is attached to the root element selector directly,
615+
as in '':root::view-transition-group()'';
616+
it is not attached to its parent, the ''::view-transition'' pseudo-element.
617+
</div>
623618

624619
<div class=note>
625620
Once the user-agent has captured both the “old” and “new” states of the document,
@@ -646,15 +641,49 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
646641
This enables full customization of the transition.
647642
</div>
648643

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

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

653-
A [=tree-abiding pseudo-element=] that is also
654-
a [=pseudo-element root=].
655-
Its [=originating element=] is the document's [=document element=].
672+
The specificity of a [=named view-transition selector=]
673+
with a <<custom-ident>> argument
674+
is equivalent to a [=type selector=].
675+
The specificity of a [=named view-transition selector=]
676+
with a ''*'' argument
677+
is zero.
656678

657-
Its [=containing block=] is the [=snapshot containing block=].
679+
### View Transition Tree Root: the ''::view-transition'' pseudo-element ### {#view-transition-pseudo}
680+
681+
The <dfn>::view-transition</dfn> [=pseudo-element=]
682+
is a [=tree-abiding pseudo-element=] that is also a [=pseudo-element root=].
683+
Its [=originating element=] is the document's [=document element=],
684+
and its [=containing block=] is the [=snapshot containing block=].
685+
686+
Note: This element serves as the [=tree/parent=] of all ''::view-transition-group()'' pseudo-elements.
658687

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

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

673-
### <dfn>::view-transition-group( <<pt-name-selector>> )</dfn> ### {#::view-transition-group}
702+
### View Transition Named Subtree Root: the ''::view-transition-group()'' pseudo-element ### {#::view-transition-group}
703+
704+
The <dfn>::view-transition-group()</dfn> [=pseudo-element=]
705+
is a [=named view-transition pseudo-element=]
706+
that represents a matching named [=view transition=] capture.
707+
A ''::view-transition-group()'' [=pseudo-element=]
708+
is generated for each [=view transition name=]
709+
as a [=tree/child=] of the ''::view-transition'' [=pseudo-element=],
710+
and contains a corresponding ''::view-transition-image-pair()''.
674711

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

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

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-
695725
The following is added to the [=global view transition user agent style sheet=]:
696726

697727
```css
@@ -705,21 +735,25 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
705735
}
706736
```
707737

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

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.
740+
The <dfn>::view-transition-image-pair()</dfn> [=pseudo-element=]
741+
is a [=named view-transition pseudo-element=]
742+
that represents a pair of corresponding old/new [=view transition=] captures.
743+
This pseudo-element is a [=tree/child=] of the corresponding ''::view-transition-group()'' pseudo-element
744+
and contains
745+
a corresponding ''::view-transition-old()'' pseudo-element
746+
and/or
747+
a corresponding ''::view-transition-new()'' pseudo-element
748+
(in that order).
713749

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

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-
723757
The following is added to the [=global view transition user agent style sheet=]:
724758

725759
```css
@@ -732,31 +766,22 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
732766
}
733767
```
734768

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.
769+
### View Transition Old State Image: the ''::view-transition-old()'' pseudo-element ### {#::view-transition-old}
740770

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.
771+
The <dfn>::view-transition-old()</dfn> [=pseudo-element=]
772+
is an empty [=named view-transition pseudo-element=]
773+
that represents a visual snapshot of the “old” state as a [=replaced element=];
774+
it is omitted if there's no “old” state to represent.
775+
Each ''::view-transition-old()'' pseudo-element is a [=tree/child=]
776+
of the corresponding ''::view-transition-image-pair()'' pseudo-element.
744777

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

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

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=],
784+
Note: The content and [=natural dimensions=] of the image are captured in [=capture the image=],
760785
then set and updated in [=setup transition pseudo-elements=] and [=update pseudo-element styles=].
761786

762787
The following is added to the [=global view transition user agent style sheet=]:
@@ -779,10 +804,20 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
779804

780805
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=].
781806

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

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

787822
```css
788823
:root::view-transition-new(*) {
@@ -797,8 +832,6 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
797832
}
798833
```
799834

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

804837
## Phases ## {#phases-concept}

0 commit comments

Comments
 (0)