[Web Animations] Accelerated animations don't get suspended
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Sep 2018 13:09:45 +0000 (13:09 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Sep 2018 13:09:45 +0000 (13:09 +0000)
commitaec73e23162e7c32126587c8f3b6b99ae17a1b4f
treecdb770c0ed84d27c678f640d4b86fe8b84516f0e
parent5986f13b5302ade3229878abf25801b0a9267491
[Web Animations] Accelerated animations don't get suspended
https://bugs.webkit.org/show_bug.cgi?id=189783
<rdar://problem/43033568>

Reviewed by Dean Jackson.

Source/WebCore:

Test: webanimations/accelerated-animation-suspension.html

We used to set the flag that marked the timeline as suspended prior to notifying animations that they need to be suspended.
However, since the timeline was marked as suspended, querying the running state of the animations would indicate that the
animations weren't running since a suspended timeline would identify its animations as not running. As such we would fail
to pause the accelerated animations because they were already not marked as running. We now set the suspended flag on the
timeline _after_ suspending its animations.

We also fix a bug in the new internals.acceleratedAnimationsForElement() test function so that we read from the actual
CA animations and not from a stale list of animations which would not indicate the correct animation speeds.

* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::suspendAnimations):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::acceleratedAnimationsForTesting):

LayoutTests:

Add a new test that checks whether an accelerated animation is correctly paused after suspending animations.

* webanimations/accelerated-animation-suspension-expected.txt: Added.
* webanimations/accelerated-animation-suspension.html: Added.
* platform/win/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236312 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/animations/suspend-resume-animation-events.html
LayoutTests/webanimations/accelerated-animation-suspension-expected.txt [new file with mode: 0644]
LayoutTests/webanimations/accelerated-animation-suspension.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/animation/DocumentTimeline.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp