Bug 181428 - Refactor timing function solving code
Summary: Refactor timing function solving code
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-01-09 02:51 PST by Antoine Quint
Modified: 2018-01-09 09:56 PST (History)
11 users (show)

See Also:


Attachments
Patch (14.34 KB, patch)
2018-01-09 02:54 PST, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch (10.24 KB, patch)
2018-01-09 07:15 PST, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch (11.19 KB, patch)
2018-01-09 07:18 PST, Antoine Quint
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-elcapitan (2.29 MB, application/zip)
2018-01-09 08:24 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews123 for ios-simulator-wk2 (2.35 MB, application/zip)
2018-01-09 08:50 PST, EWS Watchlist
no flags Details
Patch (10.48 KB, patch)
2018-01-09 08:54 PST, Antoine Quint
dino: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Quint 2018-01-09 02:51:34 PST
Refactor timing function solving code
Comment 1 Antoine Quint 2018-01-09 02:54:49 PST
Created attachment 330804 [details]
Patch
Comment 2 Antoine Quint 2018-01-09 07:15:54 PST
Created attachment 330821 [details]
Patch
Comment 3 Antoine Quint 2018-01-09 07:18:34 PST
Created attachment 330822 [details]
Patch
Comment 4 Darin Adler 2018-01-09 08:11:29 PST
Comment on attachment 330822 [details]
Patch

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

> Source/WebCore/platform/animation/TimingFunction.cpp:71
> +        return std::min(1.0, (floor(m_steps * inputTime) + 1) / m_steps);

Should use std::floor.

> Source/WebCore/platform/animation/TimingFunction.cpp:72
> +    return floor(m_steps * inputTime) / m_steps;

Should use std::floor.
Comment 5 EWS Watchlist 2018-01-09 08:24:15 PST
Comment on attachment 330822 [details]
Patch

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

New failing tests:
imported/w3c/web-platform-tests/css/css-ui-3/caret-color-021.html
transitions/steps-timing-function.html
animations/animation-direction-reverse-timing-functions.html
animations/keyframe-multiple-timing-functions-transform.html
animations/fill-mode-iteration-count-non-integer.html
fast/css-generated-content/pseudo-animation.html
animations/multiple-animations-timing-function.html
animations/missing-keyframe-properties-timing-function.html
fast/css-generated-content/pseudo-transition.html
animations/spring-function.html
transitions/default-timing-function.html
transitions/transition-display-property-2.html
animations/trigger-container-scroll-simple.html
animations/animation-direction-reverse-timing-functions-hardware.html
animations/timing-functions.html
Comment 6 EWS Watchlist 2018-01-09 08:24:17 PST
Created attachment 330825 [details]
Archive of layout-test-results from ews103 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 7 Darin Adler 2018-01-09 08:27:24 PST
Comment on attachment 330822 [details]
Patch

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

> Source/WebCore/platform/animation/TimingFunction.h:53
> +    double transformTime(double inputTime, double) const { return inputTime; }

Need to mark this virtual.

> Source/WebCore/platform/animation/TimingFunction.h:160
> +    double transformTime(double, double) const;

Need to mark this final.

> Source/WebCore/platform/animation/TimingFunction.h:210
> +    double transformTime(double, double) const;

Need to mark this final.

> Source/WebCore/platform/animation/TimingFunction.h:264
> +    double transformTime(double, double) const;

Need to mark this final.
Comment 8 EWS Watchlist 2018-01-09 08:50:00 PST
Comment on attachment 330822 [details]
Patch

Attachment 330822 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/5998401

New failing tests:
animations/multiple-animations-timing-function.html
transitions/steps-timing-function.html
fast/css-generated-content/pseudo-animation.html
animations/keyframe-multiple-timing-functions-transform.html
animations/fill-mode-iteration-count-non-integer.html
animations/animation-direction-reverse-timing-functions.html
imported/w3c/web-platform-tests/css/css-ui-3/caret-color-021.html
fast/css-generated-content/pseudo-transition.html
animations/spring-function.html
transitions/transition-display-property-2.html
animations/animation-direction-reverse-timing-functions-hardware.html
animations/trigger-container-scroll-simple.html
animations/animation-initial-inheritance.html
animations/missing-keyframe-properties-timing-function.html
animations/timing-functions.html
Comment 9 EWS Watchlist 2018-01-09 08:50:02 PST
Created attachment 330826 [details]
Archive of layout-test-results from ews123 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.6
Comment 10 Antoine Quint 2018-01-09 08:51:28 PST
(In reply to Darin Adler from comment #7)
> Comment on attachment 330822 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=330822&action=review
> 
> > Source/WebCore/platform/animation/TimingFunction.h:53
> > +    double transformTime(double inputTime, double) const { return inputTime; }
> 
> Need to mark this virtual.

There was a linking issue with a virtual method here that I couldn't fix, even with the help of some fine folks on #webkit. I'm preparing a new patch where we use a single method on TimingFunction that downcasts based on the type.
Comment 11 Antoine Quint 2018-01-09 08:54:47 PST
Created attachment 330827 [details]
Patch
Comment 12 Antoine Quint 2018-01-09 08:55:33 PST
(In reply to Darin Adler from comment #4)
> Comment on attachment 330822 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=330822&action=review
> 
> > Source/WebCore/platform/animation/TimingFunction.cpp:71
> > +        return std::min(1.0, (floor(m_steps * inputTime) + 1) / m_steps);
> 
> Should use std::floor.
> 
> > Source/WebCore/platform/animation/TimingFunction.cpp:72
> > +    return floor(m_steps * inputTime) / m_steps;
> 
> Should use std::floor.

The new patch uses std::floor.
Comment 13 Dean Jackson 2018-01-09 09:45:04 PST
Comment on attachment 330827 [details]
Patch

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

> Source/WebCore/platform/animation/TimingFunction.cpp:64
> +        auto& function = *static_cast<const CubicBezierTimingFunction*>(this);

Maybe we should have is<> and downcast<> for these?

> Source/WebCore/platform/animation/TimingFunction.cpp:66
> +        auto epsilon = 1.0 / (200.0 * duration);
> +        return UnitBezier(function.x1(), function.y1(), function.x2(), function.y2()).solve(inputTime, epsilon);

Any reason you moved the epsilon to a variable? This means we no longer have the comment on why we change the accuracy for longer durations.
Comment 14 Antoine Quint 2018-01-09 09:55:28 PST
Committed r226645: <https://trac.webkit.org/changeset/226645>
Comment 15 Antoine Quint 2018-01-09 09:56:35 PST
(In reply to Dean Jackson from comment #13)
> Comment on attachment 330827 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=330827&action=review
> 
> > Source/WebCore/platform/animation/TimingFunction.cpp:66
> > +        auto epsilon = 1.0 / (200.0 * duration);
> > +        return UnitBezier(function.x1(), function.y1(), function.x2(), function.y2()).solve(inputTime, epsilon);
> 
> Any reason you moved the epsilon to a variable? This means we no longer have
> the comment on why we change the accuracy for longer durations.

I added it back in the commit.
Comment 16 Radar WebKit Bug Importer 2018-01-09 09:56:36 PST
<rdar://problem/36378011>