[CoordinatedGraphics] serviceScriptedAnimations expects time in seconds
authorrafael.lobo@openbossa.org <rafael.lobo@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Apr 2013 14:31:35 +0000 (14:31 +0000)
committerrafael.lobo@openbossa.org <rafael.lobo@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Apr 2013 14:31:35 +0000 (14:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=112582

Reviewed by Andreas Kling.

Source/WebKit/qt:

We've been exposing different time unit for requestAnimationFrame because
of wrong conversion before serviceScriptedAnimations function calls.
Fixed it to use seconds instead of milliseconds.

* WebCoreSupport/ChromeClientQt.cpp: Remove unnecessary conversion.

Source/WebKit2:

We've been exposing different time unit for requestAnimationFrame because
of wrong conversion before serviceScriptedAnimations function calls.
Fixed it to use seconds instead of milliseconds.

* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
(WebKit::CoordinatedLayerTreeHost::syncDisplayState): Remove unnecessary conversion.

LayoutTests:

Add test to measure if the time interval is coherent with the unit
of DOMTimeStamp (milliseconds) by comparing it with Date.now() interval.

* fast/animation/request-animation-frame-time-unit-expected.txt: Added.
* fast/animation/request-animation-frame-time-unit.html: Added.
* fast/animation/script-tests/request-animation-frame-time-unit.js: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/animation/request-animation-frame-time-unit-expected.txt [new file with mode: 0644]
LayoutTests/fast/animation/request-animation-frame-time-unit.html [new file with mode: 0644]
LayoutTests/fast/animation/script-tests/request-animation-frame-time-unit.js [new file with mode: 0644]
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp

index 4f4db9c..9052057 100644 (file)
@@ -1,3 +1,17 @@
+2013-04-09  Rafael Brandao  <rafael.lobo@openbossa.org>
+
+        [CoordinatedGraphics] serviceScriptedAnimations expects time in seconds
+        https://bugs.webkit.org/show_bug.cgi?id=112582
+
+        Reviewed by Andreas Kling.
+
+        Add test to measure if the time interval is coherent with the unit
+        of DOMTimeStamp (milliseconds) by comparing it with Date.now() interval.
+
+        * fast/animation/request-animation-frame-time-unit-expected.txt: Added.
+        * fast/animation/request-animation-frame-time-unit.html: Added.
+        * fast/animation/script-tests/request-animation-frame-time-unit.js: Added.
+
 2013-04-09  Lamarque V. Souza  <Lamarque.Souza@basyskom.com>
 
         [WebSocket] Ignore incoming message in CLOSING state
diff --git a/LayoutTests/fast/animation/request-animation-frame-time-unit-expected.txt b/LayoutTests/fast/animation/request-animation-frame-time-unit-expected.txt
new file mode 100644 (file)
index 0000000..bef025f
--- /dev/null
@@ -0,0 +1,10 @@
+Tests time unit of requestAnimationFrame callback
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS isTimeUnitInMs is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/animation/request-animation-frame-time-unit.html b/LayoutTests/fast/animation/request-animation-frame-time-unit.html
new file mode 100644 (file)
index 0000000..0ba0174
--- /dev/null
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<script src="script-tests/request-animation-frame-time-unit.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/animation/script-tests/request-animation-frame-time-unit.js b/LayoutTests/fast/animation/script-tests/request-animation-frame-time-unit.js
new file mode 100644 (file)
index 0000000..7668e1a
--- /dev/null
@@ -0,0 +1,31 @@
+description("Tests time unit of requestAnimationFrame callback");
+
+var isTimeUnitInMs = false;
+
+window.requestAnimationFrame(function(time) {
+    var callbackTimeRef = time;
+    var timeRefInMs = Date.now();
+
+    setTimeout(function() {
+        window.requestAnimationFrame(function(time) {
+            var delta = time - callbackTimeRef;
+            var deltaTimeInMs = Date.now() - timeRefInMs;
+            var toleranceInMs = 10;
+            isTimeUnitInMs = Math.abs(delta - deltaTimeInMs) <= toleranceInMs;
+            shouldBeTrue("isTimeUnitInMs");
+            isSuccessfullyParsed();
+
+            if (window.testRunner)
+                testRunner.notifyDone();
+        });
+
+        if (window.testRunner)
+            testRunner.display();
+    }, 1);
+});
+
+if (window.testRunner)
+    testRunner.display();
+
+if (window.testRunner)
+    testRunner.waitUntilDone();
index b0a5ae7..e694b45 100644 (file)
@@ -1,3 +1,16 @@
+2013-04-09  Rafael Brandao  <rafael.lobo@openbossa.org>
+
+        [CoordinatedGraphics] serviceScriptedAnimations expects time in seconds
+        https://bugs.webkit.org/show_bug.cgi?id=112582
+
+        Reviewed by Andreas Kling.
+
+        We've been exposing different time unit for requestAnimationFrame because
+        of wrong conversion before serviceScriptedAnimations function calls.
+        Fixed it to use seconds instead of milliseconds.
+
+        * WebCoreSupport/ChromeClientQt.cpp: Remove unnecessary conversion.
+
 2013-04-08  Benjamin Poulain  <benjamin@webkit.org>
 
         Remove HTML Notification
index 0958ff4..8b086c9 100644 (file)
@@ -625,7 +625,7 @@ void ChromeClientQt::scheduleAnimation()
 
 void ChromeClientQt::serviceScriptedAnimations()
 {
-    m_webPage->mainFrameAdapter()->frame->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime()));
+    m_webPage->mainFrameAdapter()->frame->view()->serviceScriptedAnimations(currentTime());
 }
 #endif
 
index dde2209..1b4348b 100644 (file)
@@ -1,3 +1,17 @@
+2013-04-09  Rafael Brandao  <rafael.lobo@openbossa.org>
+
+        [CoordinatedGraphics] serviceScriptedAnimations expects time in seconds
+        https://bugs.webkit.org/show_bug.cgi?id=112582
+
+        Reviewed by Andreas Kling.
+
+        We've been exposing different time unit for requestAnimationFrame because
+        of wrong conversion before serviceScriptedAnimations function calls.
+        Fixed it to use seconds instead of milliseconds.
+
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
+        (WebKit::CoordinatedLayerTreeHost::syncDisplayState): Remove unnecessary conversion.
+
 2013-04-09  Michael BrĂ¼ning  <michael.bruning@digia.com>
 
         [Qt][WK2] Remove obsolete QtWebPageFindClient forward declaration from qquickwebview_p.h.
index e044835..a485103 100644 (file)
@@ -506,7 +506,7 @@ void CoordinatedLayerTreeHost::syncDisplayState()
 {
 #if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) && !USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
     // Make sure that any previously registered animation callbacks are being executed before we flush the layers.
-    m_webPage->corePage()->mainFrame()->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime()));
+    m_webPage->corePage()->mainFrame()->view()->serviceScriptedAnimations(currentTime());
 #endif
 
     m_webPage->layoutIfNeeded();