@@ -559,33 +559,6 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
559559
560560 Note: This does not effect pointers that are [=pointer capture|captured=] .
561561
562- # User-agent styles # {#ua-styles}
563-
564- The <dfn>global view transition user agent style sheet</dfn> is a style sheet in the [=user-agent origin=] , used in all namespaces.
565-
566- Issue: [CSS needs a central place for an "all namespaces" style sheet] (https://github.com/w3c/csswg-drafts/issues/8573).
567-
568- It contains the following:
569-
570- ```css
571- @keyframes -ua-view-transition-fade-out {
572- to { opacity: 0; }
573- }
574-
575- @keyframes -ua-view-transition-fade-in {
576- from { opacity: 0; }
577- }
578-
579- :root {
580- view-transition-name: root;
581- }
582- ```
583-
584- <div class=note>
585- There are further additions to the [=global view transition user agent style sheet=] defined in [[#view-transition-pseudos]] for each pseudo-element,
586- and other styles are added at runtime via the [=document=] 's [=document/view transition style sheet=] .
587- </div>
588-
589562# Pseudo-elements # {#pseudo}
590563
591564## Pseudo-element Trees ## {#pseudo-root}
@@ -694,20 +667,6 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
694667
695668 Note: This element serves as the [=tree/parent=] of all ''::view-transition-group()'' pseudo-elements.
696669
697- The following is added to the [=global view transition user agent style sheet=] :
698-
699- ```css
700- :root::view-transition {
701- position: fixed;
702- inset: 0;
703- }
704- ```
705-
706- <div class="note">
707- The aim of the style is to size the pseudo-element to cover the [=snapshot containing block=]
708- and position all ''::view-transition-group()'' pseudo-elements relative to the [=snapshot containing block origin=] .
709- </div>
710-
711670### View Transition Named Subtree Root: the ''::view-transition-group()'' pseudo-element ### {#::view-transition-group}
712671
713672 The <dfn>::view-transition-group()</dfn> [=pseudo-element=]
@@ -723,26 +682,14 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
723682 or the “new” element if there isn't an “old” element.
724683
725684 If there's both an “old” and “new” state,
726- styles in the [=document/view transition style sheet=] animate this pseudo-element's 'width' and 'height'
685+ styles in the [=document/dynamic view transition style sheet=] animate this pseudo-element's 'width' and 'height'
727686 from the size of the old element's [=border box=] to that of the new element's [=border box=] .
728687
729688 Also the element's 'transform' is animated from the old element's screen space transform to the new element's screen space transform.
730689
731690 This style is generated dynamically since the values of animated properties are determined at the time that the transition begins.
732691 </div>
733692
734- The following is added to the [=global view transition user agent style sheet=] :
735-
736- ```css
737- :root::view-transition-group(*) {
738- position: absolute;
739- top: 0;
740- left: 0;
741-
742- animation-duration: 0.25s;
743- animation-fill-mode: both;
744- }
745- ```
746693
747694### View Transition Image Pair Isolation: the ''::view-transition-image-pair()'' pseudo-element ### {#::view-transition-image-pair}
748695
@@ -763,18 +710,6 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
763710 without affecting other visual outputs.
764711 </div>
765712
766- The following is added to the [=global view transition user agent style sheet=] :
767-
768- ```css
769- :root::view-transition-image-pair(*) {
770- position: absolute;
771- inset: 0;
772-
773- animation-duration: inherit;
774- animation-fill-mode: inherit;
775- }
776- ```
777-
778713### View Transition Old State Image: the ''::view-transition-old()'' pseudo-element ### {#::view-transition-old}
779714
780715 The <dfn>::view-transition-old()</dfn> [=pseudo-element=]
@@ -793,25 +728,8 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
793728 Note: The content and [=natural dimensions=] of the image are captured in [=capture the image=] ,
794729 and set in [=setup transition pseudo-elements=] .
795730
796- The following is added to the [=global view transition user agent style sheet=] :
797-
798- ```css
799- :root::view-transition-old(*) {
800- position: absolute;
801- inset-block-start: 0;
802- inline-size: 100%;
803- block-size: auto;
804-
805- animation-name: -ua-view-transition-fade-out;
806- animation-duration: inherit;
807- animation-fill-mode: inherit;
808- }
809- ```
810-
811- Note: The aim of the style is to match the element's inline size while retaining the aspect ratio.
812- It is also placed at the block start.
813-
814- 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=] .
731+ Note: Additional styles in the [=document/dynamic view transition style sheet=] added to animate these pseudo-elements
732+ are detailed in [=setup transition pseudo-elements=] and [=update pseudo-element styles=] .
815733
816734### View Transition New State Image: the ''::view-transition-new()'' pseudo-element ### {#::view-transition-new}
817735
@@ -826,21 +744,89 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
826744 Note: The content and [=natural dimensions=] of the image are captured in [=capture the image=] ,
827745 then set and updated in [=setup transition pseudo-elements=] and [=update pseudo-element styles=] .
828746
829- The following is added to the [=global view transition user agent style sheet=] :
747+ # User Agent Stylesheet # {#ua-styles}
748+
749+ The <dfn>global view transition user agent style sheet</dfn> is
750+ a [=user-agent origin=] style sheet containing the following rules:
830751
831752 ```css
753+ :root {
754+ view-transition-name: root;
755+ }
756+
757+ :root::view-transition {
758+ position: fixed;
759+ inset: 0;
760+ }
761+
762+ :root::view-transition-group(*) {
763+ position: absolute;
764+ top: 0;
765+ left: 0;
766+
767+ animation-duration: 0.25s;
768+ animation-fill-mode: both;
769+ }
770+
771+ :root::view-transition-image-pair(*) {
772+ position: absolute;
773+ inset: 0;
774+
775+ animation-duration: inherit;
776+ animation-fill-mode: inherit;
777+ }
778+
779+ :root::view-transition-old(*),
832780 :root::view-transition-new(*) {
833781 position: absolute;
834782 inset-block-start: 0;
835783 inline-size: 100%;
836784 block-size: auto;
837785
838- animation-name: -ua-view-transition-fade-in;
839786 animation-duration: inherit;
840787 animation-fill-mode: inherit;
841788 }
789+
790+ /* Default cross-fade transition */
791+ @keyframes -ua-view-transition-fade-out {
792+ to { opacity: 0; }
793+ }
794+ @keyframes -ua-view-transition-fade-in {
795+ from { opacity: 0; }
796+ }
797+ :root::view-transition-old(*) {
798+ animation-name: -ua-view-transition-fade-out;
799+ }
800+ :root::view-transition-new(*) {
801+ animation-name: -ua-view-transition-fade-in;
802+ }
842803 ```
843804
805+ <details class="note">
806+ <summary> Explanatory Summary</summary>
807+ This UA style sheet does several things:
808+ * Lay out ''::view-transition'' to cover the entire [=snapshot containing block=]
809+ so that each '':view-transition-group()'' child can lay out relative to it.
810+ * Give the [=root element=] a default [=view transition name=] ,
811+ to allow it to be independently selected.
812+ * Reduce layout interference from the ''::view-transition-image-pair()'' pseudo-element
813+ so that authors can essentially treat ''::view-transition-old()'' and ''::view-transition-new()''
814+ as direct children of ''::view-transition-group()'' for most purposes.
815+ * Inherit animation timing through the tree so that by default,
816+ the animation timing set on a ''::view-transition-group()''
817+ will dictate the animation timing of all its descendants.
818+ * Style the element captures ''::view-transition-old()'' and ''::view-transition-new()''
819+ to match the size and position set on ''::view-transition-group()''
820+ (insofar as possible without breaking their aspect ratios)
821+ as it interpolates between them
822+ (see [=dynamic view transition style sheet=] ).
823+ * Set up a default quarter-second cross-fade animation
824+ for each ''::view-transition-group()'' .
825+ </details>
826+
827+ Additional styles are dynamically added to the [=user-agent origin=] during a [=view transition=]
828+ through the [=document/dynamic view transition style sheet=] .
829+
844830# Concepts # {#concepts}
845831
846832## Phases ## {#phases-concept}
@@ -951,7 +937,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
951937 </dl>
952938
953939 Note: These are used to update, and later remove styles
954- from a [=/document=] 's [=document/view transition style sheet=] .
940+ from a [=/document=] 's [=document/dynamic view transition style sheet=] .
955941
956942## Additions to {{Document}} ## {#additions-to-document}
957943
@@ -964,7 +950,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
964950 : <dfn>transition suppressing rendering</dfn>
965951 :: a boolean. Initially false.
966952
967- : <dfn>view transition style sheet</dfn>
953+ : <dfn>dynamic view transition style sheet</dfn>
968954 :: a [=/style sheet=] .
969955 Initially a new [=/style sheet=] in the [=user-agent origin=] , ordered after the [=global view transition user agent style sheet=] .
970956
@@ -1444,7 +1430,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
14441430 1. Let |height| be |capturedElement|'s [=captured element/old height=] .
14451431
14461432 1. Set |capturedElement|'s [=captured element/group keyframes=] to a new {{CSSKeyframesRule}} representing the following CSS,
1447- and append it to |document|'s [=document/view transition style sheet=] :
1433+ and append it to |document|'s [=document/dynamic view transition style sheet=] :
14481434
14491435 <!-- deliberately using <pre> so the example can contain <var> references -->
14501436 <pre highlight="css">
@@ -1460,7 +1446,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
14601446 Note: The above code example contains variables to be replaced.
14611447
14621448 1. Set |capturedElement|'s [=captured element/group animation name rule=] to a new {{CSSStyleRule}} representing the following CSS,
1463- and append it to |document|'s [=document/view transition style sheet=] :
1449+ and append it to |document|'s [=document/dynamic view transition style sheet=] :
14641450
14651451 <!-- deliberately using <pre> so the example can contain <var> references -->
14661452 <pre highlight="css">
@@ -1472,7 +1458,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
14721458 Note: The above code example contains variables to be replaced.
14731459
14741460 1. Set |capturedElement|'s [=captured element/image pair isolation rule=] to a new {{CSSStyleRule}} representing the following CSS,
1475- and append it to |document|'s [=document/view transition style sheet=] :
1461+ and append it to |document|'s [=document/dynamic view transition style sheet=] :
14761462
14771463 <!-- deliberately using <pre> so the example can contain <var> references -->
14781464 <pre highlight="css">
@@ -1484,7 +1470,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
14841470 Note: The above code example contains variables to be replaced.
14851471
14861472 1. Set |capturedElement|'s [=captured element/view blend mode rule=] to a new {{CSSStyleRule}} representing the following CSS,
1487- and append it to |document|'s [=document/view transition style sheet=] :
1473+ and append it to |document|'s [=document/dynamic view transition style sheet=] :
14881474
14891475 <!-- deliberately using <pre> so the example can contain <var> references -->
14901476 <pre highlight="css">
@@ -1738,7 +1724,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
17381724
17391725 1. If |capturedElement|'s [=captured element/group styles rule=] is null,
17401726 then set |capturedElement|'s [=captured element/group styles rule=] to a new {{CSSStyleRule}} representing the following CSS,
1741- and append it to |document|'s [=document/view transition style sheet=] .
1727+ and append it to |document|'s [=document/dynamic view transition style sheet=] .
17421728
17431729 Otherwise, update |capturedElement|'s [=captured element/group styles rule=] to match the following CSS:
17441730
@@ -1783,8 +1769,8 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
17831769 1. [=list/For each=] |style| of |capturedElement|'s [=captured element/style definitions=] :
17841770
17851771 1. If |style| is not null,
1786- and |style| is in |document|'s [=document/view transition style sheet=] ,
1787- then remove |style| from |document|'s [=document/view transition style sheet=] .
1772+ and |style| is in |document|'s [=document/dynamic view transition style sheet=] ,
1773+ then remove |style| from |document|'s [=document/dynamic view transition style sheet=] .
17881774
17891775 1. Set |document|'s [=document/show view-transition root pseudo-element=] to false.
17901776
@@ -1832,7 +1818,7 @@ Changes from <a href="https://www.w3.org/TR/2022/WD-css-view-transitions-1-20221
18321818Changes from <a href="https://www.w3.org/TR/2022/WD-css-view-transitions-1-20221025/">2022-10-25 Working Draft (FPWD)</a>
18331819</h3>
18341820
1835- * Add [=document/view transition style sheet=] concept for dynamically generated UA styles scoped to the current Document.
1821+ * Add [=document/dynamic view transition style sheet=] concept for dynamically generated UA styles scoped to the current Document.
18361822* Add snapshot viewport concept. See <a href="https://github.com/w3c/csswg-drafts/issues/7859">issue 7859</a> .
18371823* Clarify timimg for resolving/rejecting promises when skipping the transition. See <a href="https://github.com/w3c/csswg-drafts/issues/7956">issue 7956</a> .
18381824* Elements under a content-visiblity:auto element that skips its contents are ignored. See <a href="https://github.com/w3c/csswg-drafts/issues/7874">issue 7874</a> .
0 commit comments