Title: [239269] trunk/Source/WebCore
Revision
239269
Author
grao...@webkit.org
Date
2018-12-17 09:49:55 -0800 (Mon, 17 Dec 2018)

Log Message

[Web Animations] Ensure we don't update an animation's finished state twice when updating animations
https://bugs.webkit.org/show_bug.cgi?id=192757

Reviewed by Dean Jackson.

When animations are udpated and DocumentTimeline::updateAnimationsAndSendEvents() is called, we used to update an animation's finished state
twice since we'd do it once when calling tick() and once again when calling resolve() in the ensuing style invalidation. We now keep track of
whether we've already updated an animation's finished state during animation update in the call to tick() and avoid updating in the immediate
next call to resolve(), unless any of the timing properties have changed in the meantime.

No new test since there is no user-observable change.

* animation/WebAnimation.cpp:
(WebCore::WebAnimation::timingDidChange):
(WebCore::WebAnimation::tick):
(WebCore::WebAnimation::resolve):
* animation/WebAnimation.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239268 => 239269)


--- trunk/Source/WebCore/ChangeLog	2018-12-17 17:10:44 UTC (rev 239268)
+++ trunk/Source/WebCore/ChangeLog	2018-12-17 17:49:55 UTC (rev 239269)
@@ -1,3 +1,23 @@
+2018-12-17  Antoine Quint  <grao...@apple.com>
+
+        [Web Animations] Ensure we don't update an animation's finished state twice when updating animations
+        https://bugs.webkit.org/show_bug.cgi?id=192757
+
+        Reviewed by Dean Jackson.
+
+        When animations are udpated and DocumentTimeline::updateAnimationsAndSendEvents() is called, we used to update an animation's finished state
+        twice since we'd do it once when calling tick() and once again when calling resolve() in the ensuing style invalidation. We now keep track of
+        whether we've already updated an animation's finished state during animation update in the call to tick() and avoid updating in the immediate
+        next call to resolve(), unless any of the timing properties have changed in the meantime.
+
+        No new test since there is no user-observable change.
+
+        * animation/WebAnimation.cpp:
+        (WebCore::WebAnimation::timingDidChange):
+        (WebCore::WebAnimation::tick):
+        (WebCore::WebAnimation::resolve):
+        * animation/WebAnimation.h:
+
 2018-12-17  Simon Fraser  <simon.fra...@apple.com>
 
         REGRESSION (r233268): Elements animated in from offscreen sometimes don't display

Modified: trunk/Source/WebCore/animation/WebAnimation.cpp (239268 => 239269)


--- trunk/Source/WebCore/animation/WebAnimation.cpp	2018-12-17 17:10:44 UTC (rev 239268)
+++ trunk/Source/WebCore/animation/WebAnimation.cpp	2018-12-17 17:49:55 UTC (rev 239269)
@@ -696,6 +696,7 @@
 
 void WebAnimation::timingDidChange(DidSeek didSeek, SynchronouslyNotify synchronouslyNotify)
 {
+    m_shouldSkipUpdatingFinishedStateWhenResolving = false;
     updateFinishedState(didSeek, synchronouslyNotify);
     if (m_timeline)
         m_timeline->animationTimingDidChange(*this);
@@ -1107,6 +1108,7 @@
 void WebAnimation::tick()
 {
     updateFinishedState(DidSeek::No, SynchronouslyNotify::Yes);
+    m_shouldSkipUpdatingFinishedStateWhenResolving = true;
 
     // Run pending tasks, if any.
     if (hasPendingPauseTask())
@@ -1119,7 +1121,10 @@
 
 void WebAnimation::resolve(RenderStyle& targetStyle)
 {
-    updateFinishedState(DidSeek::No, SynchronouslyNotify::Yes);
+    if (!m_shouldSkipUpdatingFinishedStateWhenResolving)
+        updateFinishedState(DidSeek::No, SynchronouslyNotify::Yes);
+    m_shouldSkipUpdatingFinishedStateWhenResolving = false;
+
     if (m_effect)
         m_effect->apply(targetStyle);
 }

Modified: trunk/Source/WebCore/animation/WebAnimation.h (239268 => 239269)


--- trunk/Source/WebCore/animation/WebAnimation.h	2018-12-17 17:10:44 UTC (rev 239268)
+++ trunk/Source/WebCore/animation/WebAnimation.h	2018-12-17 17:49:55 UTC (rev 239269)
@@ -174,6 +174,7 @@
     bool m_finishNotificationStepsMicrotaskPending;
     bool m_scheduledMicrotask;
     bool m_isRelevant;
+    bool m_shouldSkipUpdatingFinishedStateWhenResolving;
     UniqueRef<ReadyPromise> m_readyPromise;
     UniqueRef<FinishedPromise> m_finishedPromise;
     TimeToRunPendingTask m_timeToRunPendingPlayTask { TimeToRunPendingTask::NotScheduled };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to