@@ -93,6 +93,10 @@ spec:css-color-4;
9393 text:blue
9494 text:transparent
9595spec:css-values-3; type:type; text:<time>
96+ spec:web-animations-1;
97+ type:dfn;
98+ text: target properties
99+ text: animation effect
96100</pre>
97101<!-- FIXME: These overrides aren't great for dev/TR switching -->
98102<pre class="anchors">
@@ -431,54 +435,12 @@ Starting of transitions {#starting}
431435 </span>
432436 </p>
433437
434- <p>
435- Implementations must also maintain a set of
436- <dfn export lt="completed transition">completed transitions</dfn> ,
437- each of which
438- (like <a>running transitions</a> )
439- applies to a specific element and non-shorthand property.
440- <span class="note">
441- This specification maintains the invariant that
442- there is never both a <a>running transition</a> and
443- a <a>completed transition</a> for the same property and element.
444- </span>
445- </p>
446-
447438 <p>
448439 If an element is no longer in the document,
449440 implementations must <a>cancel</a> any <a>running transitions</a>
450- on it and remove transitions on it from the
451- <a>completed transitions</a> .
441+ on that element.
452442 </p>
453443
454- <div class="note">
455-
456- <p>
457- This set of completed transitions
458- needs to be maintained
459- in order to prevent
460- transitions from repeating themselves in certain cases,
461- i.e., to maintain the invariant
462- that this specification tries to maintain
463- that unrelated style changes do not trigger transitions.
464- </p>
465-
466- <p class="example">
467- An example where maintaining the set of completed transitions
468- is necessary would be a transition on
469- an inherited property,
470- where the parent specifies a transition of that property for
471- a longer duration (say, ''transition: 4s text-indent'' )
472- and a child element that inherits the parent's value specifies
473- a transition of the same property for a shorter duration
474- (say, ''transition: 1s text-indent'' ).
475- Without the maintenance of this set of completed transitions,
476- implementations could start additional transitions on the child
477- after the initial 1 second transition on the child completes.
478- </p>
479-
480- </div>
481-
482444 <p>
483445 Various things can cause the <a>computed values</a> of properties
484446 on an element to change.
@@ -538,29 +500,30 @@ Starting of transitions {#starting}
538500 the previous style change event,
539501 then transitions are not started for that element
540502 in that style change event.
541- Otherwise,
542- define the <dfn export>before-change style</dfn> as
543- the <a>computed values</a> of all properties on the element as of
544- the previous <a>style change event</a> ,
545- except with any styles derived from declarative
546- animations such as CSS Transitions, CSS Animations
547- ([[CSS3-ANIMATIONS]] ),
548- and SMIL Animations ([[SMIL-ANIMATION]] , [[SVG11]] )
549- updated to the current time.
550- Likewise, define the <dfn export>after-change style</dfn> as
551- the <a>computed values</a> of all properties
552- on the element based on the information
553- known at the start of that <a>style change event</a> ,
554- but using the computed values of the 'animation-*' properties from the
555- <a>before-change style</a> ,
556- excluding any styles from CSS Transitions in the computation,
557- and inheriting from
558- the <a>after-change style</a> of the parent.
559- Note that this means the <a>after-change style</a> does not differ from
560- the <a>before-change style</a> due to newly created or canceled CSS
561- Animations.
503+ Otherwise, define the following:
562504 </p>
563505
506+ <dl>
507+ <dt> <dfn export>base style</dfn> </dt>
508+ <dd>
509+ the <a>computed values</a> of all properties on the element
510+ as they <em> would be</em>
511+ without any declarations from the "Animation" or "Transition" [[css-cascade-3#cascading-origins|origins]] ;
512+ without any declarations originating from [[smil-animation|SMIL]] ;
513+ and inheriting from the base style of the parent element.
514+ </dd>
515+
516+ <dt> <dfn export>before-change style</dfn> </dt>
517+ <dd>
518+ the <a>base style</a> as of the previous <a>style change event</a> .
519+ </dd>
520+
521+ <dt> <dfn export>after-change style</dfn> </dt>
522+ <dd>
523+ the <a>base style</a> as of the current <a>style change event</a> .
524+ </dd>
525+ </dl>
526+
564527 <div class="note">
565528 <p>
566529 Note that this definition of the <a>after-change style</a>
@@ -635,6 +598,11 @@ Starting of transitions {#starting}
635598 ''0px 0px black'' and ''inset 10px 10px black''
636599 are <em> not</em> [=transitionable=] .
637600
601+ A property on a given element is <dfn>affected by an animation</dfn>
602+ when there is a <a>relevant animation</a> for that element
603+ whose <a>animation effect</a> is associated with that property
604+ through its <a>target properties</a> .
605+
638606 For each element and property, the implementation must act
639607 as follows:
640608
@@ -646,17 +614,18 @@ Starting of transitions {#starting}
646614 the element does not have
647615 a <a>running transition</a> for the property,
648616 </li>
617+ <li>
618+ the property is not <a>affected by an animation</a> ,
619+ </li>
620+ <li>
621+ the property was not <a>affected by an animation</a>
622+ at the time of the previous <a>style change event</a> ,
623+ </li>
649624 <li>
650625 the <a>before-change style</a> is different from
651626 the <a>after-change style</a> for that property,
652627 and the values for the property are [=transitionable=] ,
653628 </li>
654- <li>
655- the element does not have a <a>completed transition</a>
656- for the property
657- or the <a>end value</a> of the <a>completed transition</a>
658- is different from the <a>after-change style</a> for the property,
659- </li>
660629 <li>
661630 there is a <a>matching transition-property value</a> , and
662631 </li>
@@ -665,8 +634,6 @@ Starting of transitions {#starting}
665634 </li>
666635 </ul>
667636 then implementations must
668- remove the <a>completed transition</a> (if present) from the set
669- of completed transitions and
670637 start a transition whose:
671638 <ul>
672639 <li>
@@ -698,23 +665,11 @@ Starting of transitions {#starting}
698665 </ul>
699666 </li>
700667 <li>
701- Otherwise,
702- if the element has a <a>completed transition</a> for the property
703- and the <a>end value</a> of the <a>completed transition</a>
704- is different from the <a>after-change style</a> for the property,
705- then implementations must
706- remove the <a>completed transition</a> from the set of
707- <a>completed transitions</a> .
708- </li>
709- <li>
710- If the element has a <a>running transition</a> or
711- <a>completed transition</a> for the property,
668+ If the element has a <a>running transition</a> for the property,
712669 and there is <strong> not</strong>
713670 a <a>matching transition-property value</a> ,
714671 then implementations must
715- <a>cancel</a> the <a>running transition</a>
716- or remove the <a>completed transition</a> from the set of
717- <a>completed transitions</a> .
672+ <a>cancel</a> the <a>running transition</a> .
718673 </li>
719674 <li>
720675 If the element has a <a>running transition</a> for the property,
@@ -920,14 +875,35 @@ Starting of transitions {#starting}
920875 property immediately changes to its final value).
921876 </p>
922877
923- <p class="note">
924- Note that above rules mean that
925- transitions do not start when the computed
926- value of a property changes as a result of declarative animation
927- (as opposed to scripted animation).
928- This happens because the before-change style includes up-to-date
929- style for declarative animations.
930- </p>
878+ <div class="example" id="commitStyles-no-transition-start">
879+ <pre>
880+ <style>
881+ #target {
882+ transition: width 1s;
883+ width: 100px;
884+ }
885+ </style>
886+ <script>
887+ let animation = target.animate([{ "width": "200px" }] , { duration: 1000 });
888+ animation.finished.then(() => {
889+ animation.commitStyles();
890+ animation.cancel();
891+ });
892+ </script>
893+ </pre>
894+ <p>
895+ The call to <code> commitStyles()</code>
896+ will trigger a <a>style change event</a> ,
897+ with the <a href="#before-change-style">before-change</a>
898+ <code> width</code> being <code> 100px</code> ,
899+ and the <a href="#after-change-style">after-change</a>
900+ <code> width</code> being <code> 200px</code> .
901+ However,
902+ since <code> width</code> is <a>affected by an animation</a>
903+ at the time of the previous <a>style change event</a> ,
904+ no transition will start.
905+ </p>
906+ </div>
931907
932908Faster reversing of interrupted transitions {#reversing}
933909--------------------------------------------------------
@@ -1059,15 +1035,14 @@ Completion of transitions {#complete}
10591035 but prior to the first <a>style change event</a>
10601036 whose time is equal to or after their <a>end time</a> .
10611037 When a transition completes,
1062- implementations must move
1038+ implementations must remove
10631039 all transitions that complete at that time
10641040 from the set of <a>running transitions</a>
1065- to the set of <a>completed transitions</a>
10661041 and then fire the <a href="#transition-events">events</a>
10671042 for those completions.
10681043 <span class="note"> (Note that doing otherwise, that is,
1069- firing some of the events before doing all of the moving
1070- from <a>running transitions</a> to <a>completed transitions</a> ,
1044+ firing some of the events before removing all completed transitions
1045+ from <a>running transitions</a>
10711046 could allow
10721047 a style change event to happen
10731048 without the necessary transitions completing,
@@ -1361,7 +1336,12 @@ The following are the substantive changes made since the
13611336<a href="https://www.w3.org/TR/2018/WD-css-transitions-1-20181011/">Working Draft
13621337dated 11 October 2018</a> :
13631338
1364- * (Not up to date)
1339+ * Redefined the <a>before-change style</a> and <a>after-change style</a>
1340+ in terms of the <a>base style</a> ;
1341+ removed the "completed transition" concept;
1342+ more explicitly prevented transitions <a>affected by an animation</a>
1343+ from starting.
1344+ (<a href="https://github.com/w3c/csswg-drafts/issues/6398">6398</a> )
13651345
13661346For more details on these changes, see the version control
13671347<a href="https://github.com/w3c/csswg-drafts/commits/main/css-transitions-1/Overview.bs">change log</a> .
0 commit comments