Title: [215231] trunk/Source/WebCore
Revision
215231
Author
[email protected]
Date
2017-04-11 08:51:58 -0700 (Tue, 11 Apr 2017)

Log Message

REGRESSION(r215153): Request Animation Frame broken when building without REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR
https://bugs.webkit.org/show_bug.cgi?id=170719

Patch by Carlos Garcia Campos <[email protected]> on 2017-04-11
Reviewed by Žan Doberšek.

This is because when not using the display refresh monitor, the timer is always used, not only when throttling,
but since r215153 the rAF timer is always aligned to 30ms.

Fixes: fast/animation/request-animation-frame-too-rapid.html

* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::scheduleAnimation): Only do the timer alignment when throttling.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (215230 => 215231)


--- trunk/Source/WebCore/ChangeLog	2017-04-11 15:47:56 UTC (rev 215230)
+++ trunk/Source/WebCore/ChangeLog	2017-04-11 15:51:58 UTC (rev 215231)
@@ -1,3 +1,18 @@
+2017-04-11  Carlos Garcia Campos  <[email protected]>
+
+        REGRESSION(r215153): Request Animation Frame broken when building without REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR
+        https://bugs.webkit.org/show_bug.cgi?id=170719
+
+        Reviewed by Žan Doberšek.
+
+        This is because when not using the display refresh monitor, the timer is always used, not only when throttling,
+        but since r215153 the rAF timer is always aligned to 30ms.
+
+        Fixes: fast/animation/request-animation-frame-too-rapid.html
+
+        * dom/ScriptedAnimationController.cpp:
+        (WebCore::ScriptedAnimationController::scheduleAnimation): Only do the timer alignment when throttling.
+
 2017-04-11  Yoav Weiss  <[email protected]>
 
         [link preload] Double downloads of preloaded content when it's in MemoryCache

Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.cpp (215230 => 215231)


--- trunk/Source/WebCore/dom/ScriptedAnimationController.cpp	2017-04-11 15:47:56 UTC (rev 215230)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.cpp	2017-04-11 15:51:58 UTC (rev 215231)
@@ -303,17 +303,21 @@
         return;
 
     Seconds animationInterval = interval();
+    Seconds scheduleDelay = std::max(animationInterval - Seconds(m_document->domWindow()->nowTimestamp() - m_lastAnimationFrameTimestamp), 0_s);
 
-    // FIXME: not ideal to snapshot time both in now() and nowTimestamp(), the latter of which also has reduced resolution.
-    MonotonicTime now = MonotonicTime::now();
+    if (isThrottled()) {
+        // FIXME: not ideal to snapshot time both in now() and nowTimestamp(), the latter of which also has reduced resolution.
+        MonotonicTime now = MonotonicTime::now();
 
-    MonotonicTime fireTime = now + std::max(animationInterval - Seconds(m_document->domWindow()->nowTimestamp() - m_lastAnimationFrameTimestamp), 0_s);
-    Seconds alignmentInterval = 30_ms;
-    // Snap to the nearest alignmentInterval.
-    Seconds alignment = (fireTime + alignmentInterval / 2) % alignmentInterval;
-    MonotonicTime alignedFireTime = fireTime - alignment;
+        MonotonicTime fireTime = now + scheduleDelay;
+        Seconds alignmentInterval = 10_ms;
+        // Snap to the nearest alignmentInterval.
+        Seconds alignment = (fireTime + alignmentInterval / 2) % alignmentInterval;
+        MonotonicTime alignedFireTime = fireTime - alignment;
+        scheduleDelay = alignedFireTime - now;
+    }
 
-    m_animationTimer.startOneShot(alignedFireTime - now);
+    m_animationTimer.startOneShot(scheduleDelay);
 
     dispatchLoggingEventIfRequired("raf-schedule-animation-timer");
 #else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to