Skip to content

Commit fe896a1

Browse files
committed
[css-transitions] Define a set of completed transitions that implementations must maintain, as part of the new definition of starting and canceling of transitions.
This fixes the issue discussed in https://lists.w3.org/Archives/Public/www-style/2015Jan/0444.html Also, make "running transition" a link, like "completed transition".
1 parent 54a74c1 commit fe896a1

File tree

2 files changed

+199
-48
lines changed

2 files changed

+199
-48
lines changed

css-transitions/Overview.bs

Lines changed: 90 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,8 @@ url: http://dev.w3.org/csswg/css-color-3/#html4; type: value; text: green;
502502
</h2>
503503

504504
<p>
505-
Implementations must maintain a set of running transitions,
505+
Implementations must maintain a set of
506+
<dfn title="running transition">running transitions</dfn>,
506507
each of which applies to a specific element and non-shorthand
507508
property. Each of these transitions also has a
508509
<dfn>start time</dfn>, <dfn>end time</dfn>, <dfn>start value</dfn>,
@@ -512,6 +513,46 @@ url: http://dev.w3.org/csswg/css-color-3/#html4; type: value; text: green;
512513
and are removed from this set
513514
when they <a>complete</a>
514515
or when implementations are required to <dfn>cancel</dfn> them.
516+
<span class="note">
517+
For the rationale behind the <a>reversing-adjusted start value</a>
518+
and <a>reversing shortening factor</a>, see [[#reversing]].
519+
</span>
520+
</p>
521+
522+
<p>
523+
Implementations must also maintain a set of
524+
<dfn title="completed transition">completed transitions</dfn>,
525+
each of which
526+
(like <a title="running transition">running transitions</a>)
527+
applies to a specific element and non-shorthand property.
528+
<span class="note">
529+
This specification maintains the invariant that
530+
there is never both a <a>running transition</a> and
531+
a <a>completed transition</a> for the same property and element.
532+
</span>
533+
<span class="note">
534+
This set of completed transitions
535+
needs to be maintained
536+
in order to prevent
537+
transitions from repeating themselves in certain cases,
538+
i.e., to maintain the invariant
539+
that this specification tries to maintain
540+
that unrelated style changes do not trigger transitions.
541+
</span>
542+
</p>
543+
544+
<p class="example">
545+
An example where maintaining the set of completed transitions
546+
is necessary would be a transition on
547+
an inherited property,
548+
where the parent specifies a transition of that property for
549+
a longer duration (say, ''transition: 4s text-indent'')
550+
and a child element that inherits the parent's value specifies
551+
a transition of the same property for a shorter duration
552+
(say, ''transition: 1s text-indent'').
553+
Without the maintenance of this set of completed transitions,
554+
implementations could start additional transitions on the child
555+
after the initial 1 second transition on the child completes.
515556
</p>
516557

517558
<p>
@@ -637,13 +678,33 @@ url: http://dev.w3.org/csswg/css-color-3/#html4; type: value; text: green;
637678

638679
<ol>
639680
<li>
640-
If the element does not have a running transition for the property,
641-
the <a>before-change style</a> is different from
642-
and can be interpolated with
643-
the <a>after-change style</a> for that property,
644-
there is a <a>matching transition-property value</a>,
645-
and the <a>combined duration</a> is greater than ''0s'',
646-
implementations must
681+
If all of the following are true:
682+
<ul>
683+
<li>
684+
the element does not have
685+
a <a>running transition</a> for the property,
686+
</li>
687+
<li>
688+
the <a>before-change style</a> is different from
689+
and can be interpolated with
690+
the <a>after-change style</a> for that property,
691+
</li>
692+
<li>
693+
the element does not have a <a>completed transition</a>
694+
for the property
695+
or the <a>end value</a> of the <a>completed transition</a>
696+
is different from the <a>after-change style</a> for the property,
697+
</li>
698+
<li>
699+
there is a <a>matching transition-property value</a>, and
700+
</li>
701+
<li>
702+
the <a>combined duration</a> is greater than ''0s'',
703+
</li>
704+
</ul>
705+
then implementations must
706+
remove the <a>completed transition</a> (if present) from the set
707+
of completed transitions and
647708
start a transition whose:
648709
<ul>
649710
<li>
@@ -675,49 +736,52 @@ url: http://dev.w3.org/csswg/css-color-3/#html4; type: value; text: green;
675736
</ul>
676737
</li>
677738
<li>
678-
If the element has a running transition for the property,
739+
If the element has a <a>running transition</a> or
740+
<a>completed transition</a> for the property,
679741
and there is <strong>not</strong>
680742
a <a>matching transition-property value</a>,
681743
then implementations must
682-
<a>cancel</a> the running transition.
744+
<a>cancel</a> the <a>running transition</a>
745+
or remove the <a>completed transition</a> from the set of
746+
<a title="completed transition">completed transitions</a>.
683747
</li>
684748
<li>
685-
If the element has a running transition for the property,
749+
If the element has a <a>running transition</a> for the property,
686750
there is a <a>matching transition-property value</a>,
687-
and the <a>end value</a> of the running transition is
751+
and the <a>end value</a> of the <a>running transition</a> is
688752
<strong>not</strong> equal to the value of the property in the
689753
<a>after-change style</a>, then:
690754
<ol>
691755
<li>
692756
If the <a>current value</a> of the property
693-
in the running transition
757+
in the <a>running transition</a>
694758
is equal to
695759
the value of the property in the <a>after-change style</a>,
696760
or if these two values cannot be interpolated,
697761
then implementations must
698-
<a>cancel</a> the running transition.
762+
<a>cancel</a> the <a>running transition</a>.
699763
</li>
700764
<li>
701765
Otherwise, if the <a>combined duration</a> is
702766
less than or equal to ''0s'',
703767
then implementations must
704-
<a>cancel</a> the running transition.
768+
<a>cancel</a> the <a>running transition</a>.
705769
</li>
706770
<li>
707771
Otherwise, if the <a>reversing-adjusted start value</a>
708-
of the running transition is the same as the value of
772+
of the <a>running transition</a> is the same as the value of
709773
the property in the <a>after-change style</a>
710774
<span class="note">(see the
711775
<a href="#reversing">section on reversing of
712776
transitions</a> for why these case exists)</span>,
713777
implementations must
714-
<a>cancel</a> the running transition and
778+
<a>cancel</a> the <a>running transition</a> and
715779
start a new transition whose:
716780
<ul>
717781
<li>
718782
<a>reversing-adjusted start value</a> is
719783
the <a>end value</a> of the
720-
running transition
784+
<a>running transition</a>
721785
<span class="note">(Note: This represents the logical start state of
722786
the transition, and allows some calculations to ignore that
723787
the transition started before that state was reached, which
@@ -766,7 +830,7 @@ url: http://dev.w3.org/csswg/css-color-3/#html4; type: value; text: green;
766830
<li>
767831
<a>start value</a> is
768832
the <a>current value</a> of the property
769-
in the running transition,
833+
in the <a>running transition</a>,
770834
</li>
771835
<li>
772836
<a>end value</a> is
@@ -777,7 +841,7 @@ url: http://dev.w3.org/csswg/css-color-3/#html4; type: value; text: green;
777841
</li>
778842
<li>
779843
Otherwise, implementations must
780-
<a>cancel</a> the running transition
844+
<a>cancel</a> the <a>running transition</a>
781845
and start a new transition whose:
782846
<ul>
783847
<li>
@@ -793,7 +857,7 @@ url: http://dev.w3.org/csswg/css-color-3/#html4; type: value; text: green;
793857
<li>
794858
<a>start value</a> is
795859
the <a>current value</a> of the property
796-
in the running transition,
860+
in the <a>running transition</a>,
797861
</li>
798862
<li>
799863
<a>end value</a> is
@@ -1003,14 +1067,16 @@ url: http://dev.w3.org/csswg/css-color-3/#html4; type: value; text: green;
10031067
<h2 id="complete">Completion of transitions</h2>
10041068

10051069
<p>
1006-
Running transitions <dfn id="dfn-complete">complete</dfn>
1070+
<a title="running transition">Running transitions</a>
1071+
<dfn id="dfn-complete">complete</dfn>
10071072
at a time that equal to or after their end time,
10081073
but prior to to the first <a>style change event</a>
10091074
whose time is equal to or after their <a>end time</a>.
10101075
When a transition completes,
1011-
implementations must remove
1076+
implementations must move
10121077
all transitions that complete at that time
1013-
from the set of running transitions
1078+
from the set of <a>running transitions</a>
1079+
to the set of <a>completed transitions</a>
10141080
and then fire the <a href="#transition-events">events</a>
10151081
for those completions.
10161082
<span class="note">(Note that doing otherwise could allow

0 commit comments

Comments
 (0)