[Web Animations] Correctly obtain the timing function for a given keyframe
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Mar 2018 05:41:47 +0000 (05:41 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Mar 2018 05:41:47 +0000 (05:41 +0000)
commit28a80c7fe362ed67d3910c25b11a329c9cbff71c
treea16aa3fb35216cd4a412bd0d75f92c09c7510106
parentb0fb3269970ec4a9daee89646444f2a3df3f9549
[Web Animations] Correctly obtain the timing function for a given keyframe
https://bugs.webkit.org/show_bug.cgi?id=184146

Reviewed by Dean Jackson.

Source/WebCore:

The way we would get the timing function for a given KeyframeValue stored in a KeyframeList was really suboptimal.
When keyframes were created, we would set the animated element's style on each keyframe, and set keyframe-specific
properties and values on top. When figuring out the timing function for a KeyframeValue, we would look at its render
style, go through its list of animations, which could include animations that are irrelevant to this specific keyframe
list since all animations from the animated element are referenced, and we would have to look up the correct animation
by name and get the timing function, even though the timing function stored on the animation was now specific to this
particular keyframe.

We now simply set a m_timingFunction member on a KeyframeValue, which is null if no explicit animation-timing-function
was provided for this keyframe in CSS, and otherwise set to a valid TimingFunction.

This fixes our behavior for a 4 existing animation tests when opted into the CSS Animations and CSS Transitions as
Web Animations feature.

* animation/KeyframeEffectReadOnly.cpp:
(WebCore::KeyframeEffectReadOnly::timingFunctionForKeyframeAtIndex):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::keyframeStylesForAnimation):
* page/animation/KeyframeAnimation.cpp:
(WebCore::KeyframeAnimation::fetchIntervalEndpointsForProperty const):
* platform/animation/TimingFunction.cpp:
(WebCore::TimingFunction::createFromCSSText):
(WebCore::TimingFunction::createFromCSSValue):
* platform/animation/TimingFunction.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::startAnimation):
* rendering/style/KeyframeList.cpp:
(WebCore::KeyframeValue::timingFunction const): Deleted.
* rendering/style/KeyframeList.h:
(WebCore::KeyframeValue::timingFunction const):
(WebCore::KeyframeValue::setTimingFunction):

LayoutTests:

Make 4 tests opt into CSS Animations and CSS Transitions as Web Animations.

* animations/keyframe-timing-functions-transform.html:
* animations/keyframe-timing-functions.html:
* animations/keyframe-timing-functions2.html:
* animations/missing-keyframe-properties-timing-function.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230100 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/animations/keyframe-timing-functions-transform.html
LayoutTests/animations/keyframe-timing-functions.html
LayoutTests/animations/keyframe-timing-functions2.html
LayoutTests/animations/missing-keyframe-properties-timing-function.html
Source/WebCore/ChangeLog
Source/WebCore/animation/KeyframeEffectReadOnly.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/page/animation/KeyframeAnimation.cpp
Source/WebCore/platform/animation/TimingFunction.cpp
Source/WebCore/platform/animation/TimingFunction.h
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/style/KeyframeList.cpp
Source/WebCore/rendering/style/KeyframeList.h