Title: [230667] trunk
Revision
230667
Author
grao...@webkit.org
Date
2018-04-16 01:47:17 -0700 (Mon, 16 Apr 2018)

Log Message

[Web Animations] Ensure we never return -0 through the API
https://bugs.webkit.org/show_bug.cgi?id=184644

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Record one progression in the Web Animations WPT tests.

* web-platform-tests/web-animations/timing-model/animations/updating-the-finished-state-expected.txt:

Source/WebCore:

We could sometimes return -0 instead of 0, which is surprising and leads to an error in WPT tests.
This would happen when playbackRate < 0.

* animation/WebAnimationUtilities.h:
(WebCore::secondsToWebAnimationsAPITime):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (230666 => 230667)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-04-16 06:58:36 UTC (rev 230666)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-04-16 08:47:17 UTC (rev 230667)
@@ -1,3 +1,14 @@
+2018-04-16  Antoine Quint  <grao...@apple.com>
+
+        [Web Animations] Ensure we never return -0 through the API
+        https://bugs.webkit.org/show_bug.cgi?id=184644
+
+        Reviewed by Dean Jackson.
+
+        Record one progression in the Web Animations WPT tests.
+
+        * web-platform-tests/web-animations/timing-model/animations/updating-the-finished-state-expected.txt:
+
 2018-04-15  Antoine Quint  <grao...@apple.com>
 
         [Web Animations] Animations do not naturally get a finish event

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/updating-the-finished-state-expected.txt (230666 => 230667)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/updating-the-finished-state-expected.txt	2018-04-16 06:58:36 UTC (rev 230666)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/updating-the-finished-state-expected.txt	2018-04-16 08:47:17 UTC (rev 230667)
@@ -4,7 +4,7 @@
 PASS Updating the finished state when seeking exactly to end 
 PASS Updating the finished state when playing in reverse past zero 
 PASS Updating the finished state when seeking a reversed animation past zero 
-FAIL Updating the finished state when seeking a reversed animation exactly to zero assert_equals: Hold time is set so current time should NOT change expected 0 but got -0
+PASS Updating the finished state when seeking a reversed animation exactly to zero 
 PASS Updating the finished state when playing before end 
 PASS Updating the finished state when seeking before end 
 PASS Updating the finished state when seeking a reversed animation before end 

Modified: trunk/Source/WebCore/ChangeLog (230666 => 230667)


--- trunk/Source/WebCore/ChangeLog	2018-04-16 06:58:36 UTC (rev 230666)
+++ trunk/Source/WebCore/ChangeLog	2018-04-16 08:47:17 UTC (rev 230667)
@@ -1,3 +1,16 @@
+2018-04-16  Antoine Quint  <grao...@apple.com>
+
+        [Web Animations] Ensure we never return -0 through the API
+        https://bugs.webkit.org/show_bug.cgi?id=184644
+
+        Reviewed by Dean Jackson.
+
+        We could sometimes return -0 instead of 0, which is surprising and leads to an error in WPT tests.
+        This would happen when playbackRate < 0.
+
+        * animation/WebAnimationUtilities.h:
+        (WebCore::secondsToWebAnimationsAPITime):
+
 2018-04-15  Antoine Quint  <grao...@apple.com>
 
         [Web Animations] Animations do not naturally get a finish event

Modified: trunk/Source/WebCore/animation/WebAnimationUtilities.h (230666 => 230667)


--- trunk/Source/WebCore/animation/WebAnimationUtilities.h	2018-04-16 06:58:36 UTC (rev 230666)
+++ trunk/Source/WebCore/animation/WebAnimationUtilities.h	2018-04-16 08:47:17 UTC (rev 230667)
@@ -37,7 +37,10 @@
     // The internal representation of time values is implementation dependent however, it is RECOMMENDED that user
     // agents be able to represent input time values with microsecond precision so that a time value (which nominally
     // represents milliseconds) of 0.001 is distinguishable from 0.0.
-    return std::round(time.microseconds()) / 1000;
+    auto roundedTime = std::round(time.microseconds()) / 1000;
+    if (roundedTime == -0)
+        return 0;
+    return roundedTime;
 }
 
 const auto timeEpsilon = Seconds::fromMilliseconds(0.001);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to