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):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230667
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2018-04-16 Antoine Quint <graouts@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 <graouts@apple.com>
[Web Animations] Animations do not naturally get a finish event
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
+2018-04-16 Antoine Quint <graouts@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 <graouts@apple.com>
[Web Animations] Animations do not naturally get a finish event
// 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);