Skip to content

Commit e393053

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 e393053

File tree

2 files changed

+264
-73
lines changed

2 files changed

+264
-73
lines changed

css-view-transitions-1/Overview.bs

Lines changed: 108 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ 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
@@ -579,7 +581,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
579581

580582
# Pseudo-elements # {#pseudo}
581583

582-
## Pseudo-element root ## {#pseudo-root}
584+
## Pseudo-element Trees ## {#pseudo-root}
583585

584586
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]].
585587

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

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

624621
<div class=note>
625622
Once the user-agent has captured both the “old” and “new” states of the document,
@@ -646,15 +643,49 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
646643
This enables full customization of the transition.
647644
</div>
648645

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

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

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

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

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

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

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

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

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

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

697729
```css
@@ -705,21 +737,25 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
705737
}
706738
```
707739

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

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

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

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

725761
```css
@@ -732,31 +768,22 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
732768
}
733769
```
734770

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

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

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

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

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

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

780807
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=].
781808

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

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

787824
```css
788825
:root::view-transition-new(*) {
@@ -797,8 +834,6 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
797834
}
798835
```
799836

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

804839
## Phases ## {#phases-concept}

0 commit comments

Comments
 (0)