Skip to content

Commit 4e8335a

Browse files
committed
Progress on handling styles correctly
1 parent 8152680 commit 4e8335a

1 file changed

Lines changed: 79 additions & 24 deletions

File tree

css-view-transitions-1/Overview.bs

Lines changed: 79 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,21 @@ urlPrefix: https://html.spec.whatwg.org/multipage/rendering.html; type: dfn;
591591
: <dfn>finished promise</dfn>
592592
:: a {{Promise}}.
593593
Initially [=a new promise=] in [=this's=] [=relevant Realm=].
594+
595+
: <dfn>group keyframes</dfn>
596+
:: A {{CSSKeyframesRule}} or null. Initially null.
597+
598+
: <dfn>group animation name rule</dfn>
599+
:: A {{CSSStyleRule}} or null. Initially null.
600+
601+
: <dfn>group styles rule</dfn>
602+
:: A {{CSSStyleRule}} or null. Initially null.
603+
604+
: <dfn>old view-box rule</dfn>
605+
:: A {{CSSStyleRule}} or null. Initially null.
606+
607+
: <dfn>new view-box rule</dfn>
608+
:: A {{CSSStyleRule}} or null. Initially null.
594609
</dl>
595610

596611
The {{ViewTransition/finished}} [=getter steps=] are to return [=this's=] [=ViewTransition/finished promise=].
@@ -834,13 +849,8 @@ urlPrefix: https://html.spec.whatwg.org/multipage/rendering.html; type: dfn;
834849

835850
1. Set [=document/transition suppressing rendering=] to false.
836851

837-
1. If |transition|'s [=ViewTransition/phase=] is equal to or [=phases/after=] "`animating`", then:
838-
839-
1. Remove all associated [=view-transition pseudo-elements=] from |document|.
840-
841-
Issue: There needs to be a definition/link for "remove".
842-
843-
Issue: There needs to be a definition/link for "associated".
852+
1. If |transition|'s [=ViewTransition/phase=] is equal to or [=phases/after=] "`animating`",
853+
then [=clear view transition=] |transition|.
844854

845855
1. Set |transition|'s [=ViewTransition/phase=] to "`done`".
846856

@@ -969,11 +979,7 @@ urlPrefix: https://html.spec.whatwg.org/multipage/rendering.html; type: dfn;
969979

970980
1. Set |transition|'s [=ViewTransition/phase=] to "`done`".
971981

972-
1. Remove all associated [=view-transition pseudo-elements=] from |document|.
973-
974-
Issue: There needs to be a definition/link for "remove".
975-
976-
Issue: There needs to be a definition/link for "associated".
982+
1. [=Clear view transition=] |transition|.
977983

978984
1. Set |document|'s [=document/active DOM transition=] to null.
979985

@@ -1014,6 +1020,8 @@ urlPrefix: https://html.spec.whatwg.org/multipage/rendering.html; type: dfn;
10141020
<div algorithm>
10151021
To <dfn>animate a view transition</dfn> given a {{ViewTransition}} |transition|:
10161022

1023+
1. Let |document| be [=this's=] [=relevant global object's=] [=associated document=].
1024+
10171025
1. [=map/For each=] |name| → |capturedElement| of |transition|'s [=ViewTransition/named elements=]:
10181026

10191027
1. If neither of |capturedElement|'s [=captured element/old image=] or [=captured element/new element=] is null:
@@ -1024,21 +1032,30 @@ urlPrefix: https://html.spec.whatwg.org/multipage/rendering.html; type: dfn;
10241032

10251033
1. Let |height| be |capturedElement|'s [=old styles=]'s 'height' property.
10261034

1027-
1. Generate a <<@keyframes>> named "-ua-view-transition-group-anim-|name|" in
1028-
[=user-agent origin=] as follows:
1035+
1. If |transition|'s [=ViewTransition/group keyframes=] is not null,
1036+
then remove |transition|'s [=ViewTransition/group keyframes=] from |document|'s [=document/view transition style sheet=].
10291037

1030-
<!-- deliberately using <pre> so the example can contain <var> references -->
1031-
<pre highlight="css">
1032-
@keyframes -ua-view-transition-group-anim-<var>name</var> {
1033-
from {
1034-
transform: <var>transform</var>;
1035-
width: <var>width</var>;
1036-
height: <var>height</var>;
1038+
1. Set |transition|'s [=ViewTransition/group keyframes=] to a new {{CSSKeyframesRule}} representing the following:
1039+
1040+
<!-- deliberately using <pre> so the example can contain <var> references -->
1041+
<pre highlight="css">
1042+
@keyframes -ua-view-transition-group-anim-<var>name</var> {
1043+
from {
1044+
transform: <var>transform</var>;
1045+
width: <var>width</var>;
1046+
height: <var>height</var>;
1047+
}
10371048
}
1038-
}
1039-
</pre>
1049+
</pre>
1050+
1051+
Note: The above code example contains `<var>`s.
1052+
1053+
1. Append |transition|'s [=ViewTransition/group keyframes=] to |document|'s [=document/view transition style sheet=].
10401054

1041-
1. Apply the following styles in [=user-agent origin=]:
1055+
1. If |transition|'s [=ViewTransition/group animation name rule=] is not null,
1056+
then remove |transition|'s [=ViewTransition/group animation name rule=] from |document|'s [=document/view transition style sheet=].
1057+
1058+
1. Set |transition|'s [=ViewTransition/group animation name rule=] to a new {{CSSStyleRule}} representing the following:
10421059

10431060
<!-- deliberately using <pre> so the example can contain <var> references -->
10441061
<pre highlight="css">
@@ -1047,7 +1064,14 @@ urlPrefix: https://html.spec.whatwg.org/multipage/rendering.html; type: dfn;
10471064
}
10481065
</pre>
10491066

1067+
Note: The above code example contains `<var>`s.
1068+
1069+
1. Append |transition|'s [=ViewTransition/group animation name rule=] to |document|'s [=document/view transition style sheet=].
1070+
10501071
1. Set |transition|'s [=ViewTransition/phase=] to "`animating`".
1072+
1073+
Note: User agents can skip modifications to |document|'s [=document/view transition style sheet=] if the result would be the same.
1074+
The order of rules within the [=document/view transition style sheet=] is not observable.
10511075
</div>
10521076

10531077
## [=Create transition pseudo-elements=] ## {#create-transition-pseudo-elements-algorithm}
@@ -1181,6 +1205,37 @@ urlPrefix: https://html.spec.whatwg.org/multipage/rendering.html; type: dfn;
11811205
* If |callbackPromise| was rejected with reason |r|, then [=reject=] |transition|'s [=ViewTransition/DOM updated promise=] with |r|.
11821206
</div>
11831207

1208+
## [=Clear view transition=] ## {#clear-view-transition-algorithm}
1209+
1210+
<div algorithm>
1211+
To <dfn>clear view transition</dfn> of a {{ViewTransition}} |transition|:
1212+
1213+
1. Let |document| be |transition|'s [=relevant global object's=] [=associated document=].
1214+
1215+
1. Remove all associated [=view-transition pseudo-elements=] from |document|.
1216+
1217+
Issue: There needs to be a definition/link for "remove".
1218+
1219+
Issue: There needs to be a definition/link for "associated".
1220+
1221+
1. Let |styles| be a [=/list=] of the following members of |transition|:
1222+
1223+
1. [=ViewTransition/group keyframes=].
1224+
1225+
1. [=ViewTransition/group animation name rule=].
1226+
1227+
1. [=ViewTransition/group styles rule=].
1228+
1229+
1. [=ViewTransition/old view-box rule=].
1230+
1231+
1. [=ViewTransition/new view-box rule=].
1232+
1233+
1. [=list/For each=] |style| of |styles|:
1234+
1235+
1. If |style| is not null,
1236+
then remove |style| from |document|'s [=document/view transition style sheet=].
1237+
</div>
1238+
11841239
<h2 id="priv" class="no-num">Privacy Considerations</h2>
11851240

11861241
This specification introduces no new privacy considerations.

0 commit comments

Comments
 (0)