RESOLVED FIXED 181651
Use traits for animation timing functions
https://bugs.webkit.org/show_bug.cgi?id=181651
Summary Use traits for animation timing functions
Dean Jackson
Reported 2018-01-15 10:58:04 PST
Use traits for animation timing functions
Attachments
Patch (11.77 KB, patch)
2018-01-15 11:01 PST, Dean Jackson
no flags
Patch (10.42 KB, patch)
2018-01-16 03:21 PST, Antoine Quint
no flags
Radar WebKit Bug Importer
Comment 1 2018-01-15 10:59:31 PST
Dean Jackson
Comment 2 2018-01-15 11:01:30 PST
Dean Jackson
Comment 3 2018-01-15 11:16:24 PST
Darin Adler
Comment 4 2018-01-15 14:43:19 PST
Comment on attachment 331347 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=331347&action=review Great idea! > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1545 > + auto& function = downcast<const CubicBezierTimingFunction>(timingFunction); The downcast function template does not require you to specify const: it makes const match automatically, so this should be: auto& function = downcast<CubicBezierTimingFunction>(timingFunction); > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1568 > + auto& function = downcast<const StepsTimingFunction>(timingFunction); Ditto. > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1572 > + auto& function = downcast<const FramesTimingFunction>(timingFunction); Ditto. > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1576 > + auto& function = downcast<const SpringTimingFunction>(timingFunction); Ditto. > Source/WebCore/platform/animation/TimingFunction.cpp:69 > + auto& function = *downcast<const CubicBezierTimingFunction>(this); It’s better to put the * inside before calling downcast, also const not needed: auto& function = downcast<CubicBezierTimingFunction>(*this); > Source/WebCore/platform/animation/TimingFunction.cpp:76 > + auto& function = *downcast<const StepsTimingFunction>(this); Ditto. > Source/WebCore/platform/animation/TimingFunction.cpp:84 > + auto& function = *downcast<const FramesTimingFunction>(this); Ditto. > Source/WebCore/platform/animation/TimingFunction.cpp:93 > + auto& function = *downcast<const SpringTimingFunction>(this); Ditto. > Source/WebCore/platform/animation/TimingFunction.h:126 > + auto& otherCubic = downcast<const CubicBezierTimingFunction>(other); Ditto. > Source/WebCore/platform/animation/TimingFunction.h:199 > + auto& otherSteps = downcast<const StepsTimingFunction>(other); Ditto. > Source/WebCore/platform/animation/TimingFunction.h:281 > + auto& otherSpring = downcast<const SpringTimingFunction>(other); Ditto. > Source/WebCore/platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:134 > + const CubicBezierTimingFunction* ctf = downcast<const CubicBezierTimingFunction>(timingFunction); I suggest using auto to avoid repeating everything: auto* function = downcast<CubicBezierTimingFunction>(timingFunction);
Antoine Quint
Comment 5 2018-01-16 00:29:20 PST
(In reply to Darin Adler from comment #4) > Comment on attachment 331347 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=331347&action=review > > Great idea! > > > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1545 > > + auto& function = downcast<const CubicBezierTimingFunction>(timingFunction); > > The downcast function template does not require you to specify const: it > makes const match automatically, so this should be: > > auto& function = downcast<CubicBezierTimingFunction>(timingFunction); I have a patch coming up that will address all of those.
Antoine Quint
Comment 6 2018-01-16 03:21:07 PST
Reopening to attach new patch.
Antoine Quint
Comment 7 2018-01-16 03:21:10 PST
WebKit Commit Bot
Comment 8 2018-01-16 10:45:51 PST
Comment on attachment 331380 [details] Patch Clearing flags on attachment: 331380 Committed r226976: <https://trac.webkit.org/changeset/226976>
WebKit Commit Bot
Comment 9 2018-01-16 10:45:52 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.