Flaky crash in AnimationTimeline::cancelOrRemoveDeclarativeAnimation
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jul 2018 00:06:10 +0000 (00:06 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jul 2018 00:06:10 +0000 (00:06 +0000)
commited61753a1e99339e2d7ac6e33537ef976ed8438d
treeb90eab0659a211f050bc3d82af8fa179f0b5eb60
parent4f70c4981196dd89c252181333b05f71efd988fd
Flaky crash in AnimationTimeline::cancelOrRemoveDeclarativeAnimation
https://bugs.webkit.org/show_bug.cgi?id=187530
<rdar://problem/42095186>

Reviewed by Dean Jackson.

LayoutTests/imported/mozilla:

Mark a WPT progression now that we correctly ignore animation names that have no matching @keyframes rule.

* css-animations/test_element-get-animations-expected.txt:

Source/WebCore:

We would crash in cancelOrRemoveDeclarativeAnimation() because updateCSSAnimationsForElement() would pass
nullptr values due to the return value of cssAnimationsByName.take(nameOfAnimationToRemove). This is because
we would create animations for animation names that may be empty or not match an existing @keyframes rule.
Not only was that wasteful, but it was also non-compliant, and as a result of fixing this we're actually
seeing a progression in the CSS Animations WPT tests.

* animation/AnimationTimeline.cpp:
(WebCore::shouldConsiderAnimation): New function that performs all required steps to see if a provided animation
is valid and has a name that is not "none", not the empty string and matches the name of a @keyframes rule.
(WebCore::AnimationTimeline::updateCSSAnimationsForElement):
* animation/KeyframeEffectReadOnly.cpp:
(WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): We no longer need to check whether we have
an empty animation name since we're no longer creating CSSAnimation objects in that circumstance.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::isAnimationNameValid): Add a new method that checks whether the provided animation name
a known @keyframes rule.
* css/StyleResolver.h:

LayoutTests:

Adjust an existing test which assumes an animation might be running when it's not really, so we test the animation is
not running using an alternate method.

* animations/keyframes-dynamic-expected.txt:
* animations/keyframes-dynamic.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234017 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/animations/keyframes-dynamic-expected.txt
LayoutTests/animations/keyframes-dynamic.html
LayoutTests/imported/mozilla/ChangeLog
LayoutTests/imported/mozilla/css-animations/test_element-get-animations-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/animation/AnimationTimeline.cpp
Source/WebCore/animation/KeyframeEffectReadOnly.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h