Bug 184644 - [Web Animations] Ensure we never return -0 through the API
Summary: [Web Animations] Ensure we never return -0 through the API
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Animations (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-04-16 00:24 PDT by Antoine Quint
Modified: 2018-05-23 01:52 PDT (History)
6 users (show)

See Also:


Attachments
Patch (3.89 KB, patch)
2018-04-16 00:25 PDT, Antoine Quint
dino: review+
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews100 for mac-sierra (2.23 MB, application/zip)
2018-04-16 01:31 PDT, EWS Watchlist
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Quint 2018-04-16 00:24:02 PDT
[Web Animations] Ensure we never return -0 through the API
Comment 1 Antoine Quint 2018-04-16 00:25:46 PDT
Created attachment 337991 [details]
Patch
Comment 2 EWS Watchlist 2018-04-16 01:31:04 PDT
Comment on attachment 337991 [details]
Patch

Attachment 337991 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/7328720

New failing tests:
animations/needs-layout.html
Comment 3 EWS Watchlist 2018-04-16 01:31:06 PDT
Created attachment 337992 [details]
Archive of layout-test-results from ews100 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 4 Antoine Quint 2018-04-16 01:47:29 PDT
Committed r230667: <https://trac.webkit.org/changeset/230667>
Comment 5 Radar WebKit Bug Importer 2018-04-16 01:52:10 PDT
<rdar://problem/39450781>
Comment 6 Darin Adler 2018-04-16 18:14:03 PDT
Comment on attachment 337991 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=337991&action=review

> Source/WebCore/animation/WebAnimationUtilities.h:43
> -    return std::round(time.microseconds()) / 1000;
> +    auto roundedTime = std::round(time.microseconds()) / 1000;
> +    if (roundedTime == -0)
> +        return 0;
> +    return roundedTime;

Another way to write it, less straightforward but a little cleaner maybe is to add 0, which turns -0 into +0.

    return std::round(time.microseconds()) / 1000 + 0; // Add 0 to convert -0 to +0.