Remove legacy webkitRequestAnimationFrame time quirk
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Apr 2019 17:27:20 +0000 (17:27 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Apr 2019 17:27:20 +0000 (17:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196458
<rdar://problem/49490207>

Reviewed by Simon Fraser.

Source/WebCore:

Remove legacy webkitRequestAnimationFrame time quirk and log a deprecation
warning whenever webkitRequestAnimationFrame is called.

* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::serviceScriptedAnimations):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::requestAnimationFrame):
(WebCore::DOMWindow::webkitRequestAnimationFrame):

LayoutTests:

Rebaseline webkitRequestAnimationFrame layout test now that we log a deprecation
warning.

* fast/animation/request-animation-frame-prefix-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243810 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/animation/request-animation-frame-prefix-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/dom/RequestAnimationFrameCallback.h
Source/WebCore/dom/ScriptedAnimationController.cpp
Source/WebCore/page/DOMWindow.cpp

index 719ebb1..1937471 100644 (file)
@@ -1,3 +1,16 @@
+2019-04-03  Chris Dumez  <cdumez@apple.com>
+
+        Remove legacy webkitRequestAnimationFrame time quirk
+        https://bugs.webkit.org/show_bug.cgi?id=196458
+        <rdar://problem/49490207>
+
+        Reviewed by Simon Fraser.
+
+        Rebaseline webkitRequestAnimationFrame layout test now that we log a deprecation
+        warning.
+
+        * fast/animation/request-animation-frame-prefix-expected.txt:
+
 2019-04-03  Alex Christensen  <achristensen@webkit.org>
 
         Resurrect and fix layout test http/tests/adClickAttribution/store-ad-click-attribution.html
index a33318b..c410e7e 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 27: webkitRequestAnimationFrame() is deprecated and will be removed. Please use requestAnimationFrame() instead.
 Tests the timestamps provided to prefixed webkitRequestAnimationFrame callbacks
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
index ceccaca..02a6b0c 100644 (file)
@@ -1,3 +1,20 @@
+2019-04-03  Chris Dumez  <cdumez@apple.com>
+
+        Remove legacy webkitRequestAnimationFrame time quirk
+        https://bugs.webkit.org/show_bug.cgi?id=196458
+        <rdar://problem/49490207>
+
+        Reviewed by Simon Fraser.
+
+        Remove legacy webkitRequestAnimationFrame time quirk and log a deprecation
+        warning whenever webkitRequestAnimationFrame is called.
+
+        * dom/ScriptedAnimationController.cpp:
+        (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::requestAnimationFrame):
+        (WebCore::DOMWindow::webkitRequestAnimationFrame):
+
 2019-04-03  Sihui Liu  <sihui_liu@apple.com>
 
         Blob type cannot be stored correctly in IDB when IDBObjectStore has autoIncrement and keyPath options
index 3c67f7d..06398c4 100644 (file)
@@ -44,7 +44,6 @@ public:
 
     int m_id;
     bool m_firedOrCancelled;
-    bool m_useLegacyTimeBase;
 };
 
 } // namespace WebCore
index d0f10a1..180510c 100644 (file)
@@ -198,7 +198,6 @@ void ScriptedAnimationController::serviceScriptedAnimations(double timestamp)
 
     // We round this to the nearest microsecond so that we can return a time that matches what is returned by document.timeline.currentTime.
     double highResNowMs = std::round(1000 * timestamp);
-    double legacyHighResNowMs = 1000 * (timestamp + m_document->loader()->timing().referenceWallTime().secondsSinceEpoch().seconds());
 
     // First, generate a list of callbacks to consider.  Callbacks registered from this point
     // on are considered only for the "next" frame, not this one.
@@ -213,10 +212,7 @@ void ScriptedAnimationController::serviceScriptedAnimations(double timestamp)
         if (!callback->m_firedOrCancelled) {
             callback->m_firedOrCancelled = true;
             InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireAnimationFrame(protectedDocument, callback->m_id);
-            if (callback->m_useLegacyTimeBase)
-                callback->handleEvent(legacyHighResNowMs);
-            else
-                callback->handleEvent(highResNowMs);
+            callback->handleEvent(highResNowMs);
             InspectorInstrumentation::didFireAnimationFrame(cookie);
         }
     }
index 5f01c37..4040206 100644 (file)
@@ -1695,7 +1695,6 @@ void DOMWindow::clearInterval(int timeoutId)
 
 int DOMWindow::requestAnimationFrame(Ref<RequestAnimationFrameCallback>&& callback)
 {
-    callback->m_useLegacyTimeBase = false;
     auto* document = this->document();
     if (!document)
         return 0;
@@ -1704,11 +1703,12 @@ int DOMWindow::requestAnimationFrame(Ref<RequestAnimationFrameCallback>&& callba
 
 int DOMWindow::webkitRequestAnimationFrame(Ref<RequestAnimationFrameCallback>&& callback)
 {
-    callback->m_useLegacyTimeBase = true;
-    auto* document = this->document();
-    if (!document)
-        return 0;
-    return document->requestAnimationFrame(WTFMove(callback));
+    static bool firstTime = true;
+    if (firstTime && document()) {
+        document()->addConsoleMessage(MessageSource::JS, MessageLevel::Warning, "webkitRequestAnimationFrame() is deprecated and will be removed. Please use requestAnimationFrame() instead."_s);
+        firstTime = false;
+    }
+    return requestAnimationFrame(WTFMove(callback));
 }
 
 void DOMWindow::cancelAnimationFrame(int id)