[Web Animations] Ensure that changing the timing model updates styles synchronously
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Feb 2018 23:33:44 +0000 (23:33 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Feb 2018 23:33:44 +0000 (23:33 +0000)
commit14532b260a75b1583d298506fa71536643a01277
treebda6643a4240ec308716687312d90cbaf2fb499b
parentc0d35af2dcb5f4b5142f255c7f0e090715c7913f
[Web Animations] Ensure that changing the timing model updates styles synchronously
https://bugs.webkit.org/show_bug.cgi?id=182836

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Update test expectations for progressions.

* web-platform-tests/css-timing-1/cubic-bezier-timing-functions-output-expected.txt:
* web-platform-tests/css-timing-1/frames-timing-functions-output-expected.txt:
* web-platform-tests/css-timing-1/step-timing-functions-output-expected.txt:
* web-platform-tests/css/css-multicol/multicol-gap-animation-001-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/discrete-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/visibility-expected.txt:
* web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-iteration-composite-operation-expected.txt:
* web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-transformed-distance-expected.txt:
* web-platform-tests/web-animations/interfaces/Animation/cancel-expected.txt:
* web-platform-tests/web-animations/interfaces/KeyframeEffect/iterationComposite-expected.txt:

Source/WebCore:

We did not invalidate the timing model when properties of an effect's timing object changed
and even when we did invalidate the timing model, we did not update styles on effect targets
synchronously, only scheduling such updates for the next animation frame.

In this patch we expose the effect on the timing object such that changing timing properties
can notify the effect of a change in the timing model, which can then be forwarded to the
animation (which already informs its timeline, if any).

Additionally, when an animation's timing model has changed, we now invalidate the effect, which
will update styles synchronously.

This produces a number of progressions in WPT tests.

* animation/AnimationEffectReadOnly.cpp:
(WebCore::AnimationEffectReadOnly::AnimationEffectReadOnly): Set the timing object's effect upon
effect construction.
(WebCore::AnimationEffectReadOnly::~AnimationEffectReadOnly): Set the timing object's effect to
null upon effect destruction.
(WebCore::AnimationEffectReadOnly::timingDidChange): Notify the animation (if any) that its timing
model changed following a change in the timing properties.
* animation/AnimationEffectReadOnly.h: Add a new virtual invalidate() method that subclasses can
override to implement invalidation behavior when the animation finds out its timing model changed.
* animation/AnimationEffectTimingReadOnly.cpp: Notify the effect when a property changes such
that it may notify its animation of a timing model change.
(WebCore::AnimationEffectTimingReadOnly::propertyDidChange):
(WebCore::AnimationEffectTimingReadOnly::setIterationStart):
(WebCore::AnimationEffectTimingReadOnly::setIterations):
(WebCore::AnimationEffectTimingReadOnly::setBindingsDuration):
(WebCore::AnimationEffectTimingReadOnly::setEasing):
(WebCore::AnimationEffectTimingReadOnly::setDelay):
(WebCore::AnimationEffectTimingReadOnly::setEndDelay):
(WebCore::AnimationEffectTimingReadOnly::setFill):
(WebCore::AnimationEffectTimingReadOnly::setIterationDuration):
(WebCore::AnimationEffectTimingReadOnly::setDirection):
* animation/AnimationEffectTimingReadOnly.h:
(WebCore::AnimationEffectTimingReadOnly::setEffect):
(WebCore::AnimationEffectTimingReadOnly::setBindingsDelay):
(WebCore::AnimationEffectTimingReadOnly::setBindingsEndDelay):
(WebCore::AnimationEffectTimingReadOnly::setDelay): Deleted.
(WebCore::AnimationEffectTimingReadOnly::setEndDelay): Deleted.
(WebCore::AnimationEffectTimingReadOnly::setFill): Deleted.
(WebCore::AnimationEffectTimingReadOnly::setIterationDuration): Deleted.
(WebCore::AnimationEffectTimingReadOnly::setDirection): Deleted.
* animation/AnimationTimeline.cpp: Rename animationTimingModelDidChange() to timingModelDidChange()
to align it with the new WebAnimation::timingModelDidChange() method.
(WebCore::AnimationTimeline::addAnimation):
(WebCore::AnimationTimeline::removeAnimation):
(WebCore::AnimationTimeline::setCurrentTime):
* animation/AnimationTimeline.h:
(WebCore::AnimationTimeline::timingModelDidChange):
(WebCore::AnimationTimeline::animationTimingModelDidChange): Deleted.
* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::timingModelDidChange):
(WebCore::DocumentTimeline::updateAnimations):
(WebCore::DocumentTimeline::animationTimingModelDidChange): Deleted.
* animation/DocumentTimeline.h:
* animation/KeyframeEffectReadOnly.cpp:
(WebCore::KeyframeEffectReadOnly::invalidate): Override the invalidate() method to perform a synchronous
style update in order to ensure that timing properties are accounted for right as they change.
* animation/KeyframeEffectReadOnly.h:
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::timingModelDidChange): Invalidate the effect and notify the timeline of a timing
model change when an animation is notified that its timing model has changed.
(WebCore::WebAnimation::setStartTime):
* animation/WebAnimation.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228537 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/css-timing-1/cubic-bezier-timing-functions-output-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css-timing-1/frames-timing-functions-output-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css-timing-1/step-timing-functions-output-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/css-multicol/multicol-gap-animation-001-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/discrete-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/visibility-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-iteration-composite-operation-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-transformed-distance-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/cancel-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/KeyframeEffect/iterationComposite-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/animation/AnimationEffectReadOnly.cpp
Source/WebCore/animation/AnimationEffectReadOnly.h
Source/WebCore/animation/AnimationEffectTimingReadOnly.cpp
Source/WebCore/animation/AnimationEffectTimingReadOnly.h
Source/WebCore/animation/AnimationTimeline.cpp
Source/WebCore/animation/AnimationTimeline.h
Source/WebCore/animation/DocumentTimeline.cpp
Source/WebCore/animation/DocumentTimeline.h
Source/WebCore/animation/KeyframeEffectReadOnly.cpp
Source/WebCore/animation/KeyframeEffectReadOnly.h
Source/WebCore/animation/WebAnimation.cpp
Source/WebCore/animation/WebAnimation.h