[Web Animations] REGRESSION: transition added immediately after element creation...
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jul 2018 08:33:31 +0000 (08:33 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jul 2018 08:33:31 +0000 (08:33 +0000)
commit149e9a470925d8854cb64450cf23302c7da9febf
tree51220b18b27258f2bf710fe33c23823f401f3bbe
parent57fe883aff7c48962830a773ff7ee180ab5a8aca
[Web Animations] REGRESSION: transition added immediately after element creation doesn't work
https://bugs.webkit.org/show_bug.cgi?id=187942

Reviewed by Dean Jackson.

Source/WebCore:

Tests: webanimations/accelerated-transition-by-removing-property.html
       webanimations/partly-accelerated-transition-by-removing-property.html

The Style::TreeResolver::createAnimatedElementUpdate() function expected a flag to be set that indicates that
running animations on an element should yield a change in composited state for that element's layer. We did not
have code accounting for this flag in the Web Animations engine. We now have a resolveAnimationsForElement()
method on DocumentTimeline which looks at all animations resolved on the element and see if all of them are
running accelerated and whether at least one of them is pending. In that case, we set the shouldRecompositeLayer
flag in createAnimatedElementUpdate() to true which guarantees the element's layer will have a backing when
we attempt to start the animation in KeyframeEffectReadOnly::applyPendingAcceleratedActions() where we would
have previously failed to have layer-backed renderer to perform an accelerated animation on (under certain
circumstances, see test).

* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::resolveAnimationsForElement):
* animation/DocumentTimeline.h:
* animation/KeyframeEffectReadOnly.h:
(WebCore::KeyframeEffectReadOnly::hasPendingAcceleratedAction const):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::createAnimatedElementUpdate):

LayoutTests:

Creating a new test that runs a transition based on an explicit value being removed in favor
of the implicit value of a property that can be accelerated. To check that we indeed run the
animation, we have a cache that covers the entire range of interpolated values except for the
start and end values and wait 100ms after creating the transition to end the test. Prior to this
patch, the element would be at its start value and a 1px red line would show to the right of the
cache. With this patch, the red line is hidden by the cache as it's animated.

We also add a test that checks that we do not create a composited layer when several transitions,
with only one being potentially accelerated, target the same element.

* webanimations/accelerated-transition-by-removing-property-expected.html: Added.
* webanimations/accelerated-transition-by-removing-property.html: Added.
* webanimations/partly-accelerated-transition-by-removing-property-expected.txt: Added.
* webanimations/partly-accelerated-transition-by-removing-property.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234250 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/webanimations/accelerated-transition-by-removing-property-expected.html [new file with mode: 0644]
LayoutTests/webanimations/accelerated-transition-by-removing-property.html [new file with mode: 0644]
LayoutTests/webanimations/partly-accelerated-transition-by-removing-property-expected.txt [new file with mode: 0644]
LayoutTests/webanimations/partly-accelerated-transition-by-removing-property.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/animation/DocumentTimeline.cpp
Source/WebCore/animation/DocumentTimeline.h
Source/WebCore/animation/KeyframeEffectReadOnly.h
Source/WebCore/style/StyleTreeResolver.cpp