Ensure timingFunctionForKeyframeAtIndex() can be used from setAnimatedPropertiesInSty...
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jul 2018 01:05:29 +0000 (01:05 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jul 2018 01:05:29 +0000 (01:05 +0000)
commit75ad1af4e69ecf7173ee84673d49473a6ab31530
tree67836aafc48bad7e4bbab77d9783a022b927cbac
parent4957aadc1211c6871c8e7d94e7a036aa4b8af085
Ensure timingFunctionForKeyframeAtIndex() can be used from setAnimatedPropertiesInStyle().
https://bugs.webkit.org/show_bug.cgi?id=187637
<rdar://problem/42157915>

Reviewed by Dean Jackson.

Source/WebCore:

Test: webanimations/empty-keyframes-crash.html

Unlike what we assumed, it is possible to have a non-declarative animation without any parsed keyframes.
This can happen as a result of calling `Element.animate({}, …)`. In this case, we want to return a null
value in timingFunctionForKeyframeAtIndex() so we update the call site in setAnimatedPropertiesInStyle()
which is the only place where we didn't check for a null value and didn't know for sure that there would
be parsed keyframes to rely on in the case of a WebAnimation instance.

* animation/KeyframeEffectReadOnly.cpp:
(WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle):
(WebCore::KeyframeEffectReadOnly::timingFunctionForKeyframeAtIndex):

LayoutTests:

Add a new test that would crash prior to this change.

* webanimations/empty-keyframes-crash-expected.txt: Added.
* webanimations/empty-keyframes-crash.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233903 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/webanimations/empty-keyframes-crash-expected.txt [new file with mode: 0644]
LayoutTests/webanimations/empty-keyframes-crash.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/animation/KeyframeEffectReadOnly.cpp