Use traits for animation timing functions
<rdar://problem/36525328>
Created attachment 331347 [details] Patch
Committed r226952: <https://trac.webkit.org/changeset/226952>
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);
(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.
Reopening to attach new patch.
Created attachment 331380 [details] Patch
Comment on attachment 331380 [details] Patch Clearing flags on attachment: 331380 Committed r226976: <https://trac.webkit.org/changeset/226976>
All reviewed patches have been landed. Closing bug.