[Web Animations] Implement basic to-from animations
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Nov 2017 21:35:38 +0000 (21:35 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Nov 2017 21:35:38 +0000 (21:35 +0000)
commit91ebb91e83c9d762d9fe45fccebd9a1f4fbab228
tree4281dd89802b928abcb035a387ef7bdc03c40ea0
parent0e810bafb42ef2c1bc97b07b6c60712117646f21
[Web Animations] Implement basic to-from animations
https://bugs.webkit.org/show_bug.cgi?id=179707
<rdar://problem/34932456>

Source/WebCore:

We can now actually perform an animation, in software only, when provided two keyframes on an AnimationEffect.
To parse a keyframes object from JS, we use the StyleResolver to create RenderStyle objects based on the strings
provided for the property names and values. Then, when the DocumentTimeline indicates that animations are ready
to be updated, we invalidate the style of elements with animations, so that during style resolution we can perform
blending between the RenderStyles for each keyframe.

Reviewed by Dean Jackson.

* animation/AnimationEffect.h:
(WebCore::AnimationEffect::~AnimationEffect): Deleted.
* animation/AnimationTimeline.h:
(WebCore::AnimationTimeline::elementToAnimationsMap const):
* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::animationResolutionTimerFired):
(WebCore::DocumentTimeline::updateAnimations): Renamed from resolveAnimations() since we're not
actually resolving animations, merely invalidating styles in preparation for resolution.
(WebCore::DocumentTimeline::resolveAnimations): Deleted.
* animation/DocumentTimeline.h:
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::create): Pass the keyframes argument to setKeyframes() and forward the
exception in case one was raised in the setter.
(WebCore::KeyframeEffect::setKeyframes): Pass the keyframes argument to processKeyframes() and
forward the exception in case one was raised during processing.
(WebCore::KeyframeEffect::processKeyframes): Deal with exactly two keyframes, set at 0 and 1 offsets,
specified in array forms for the keyframes object. As we parse the content of the provided JS object,
we create RenderStyle objects using the element's StyleResolver from a CSS text string we create
based on the property and values as strings.
(WebCore::KeyframeEffect::applyAtLocalTime): Compute the progress based on the local time and duration,
using the existing CSSPropertyAnimation::blendProperties() mechanics to perform the blend between the
from and to keyframes.
* animation/KeyframeEffect.h:
* animation/KeyframeEffect.idl:
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::resolve):
* animation/WebAnimation.h:
* bindings/IDLTypes.h:
(WebCore::IDLObject::nullValue): Make JSC::Strong an optional type.
* dom/Document.h:
(WebCore::Document::existingTimeline const): Provide an explicit method for call sites to check existence
of a timeline before forcing one to be created if missing by calling timeline().
* dom/Element.cpp:
(WebCore::Element::getAnimations): Do not force the creation of a timeline if one isn't already created.
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::createAnimatedElementUpdate): When applying styles, account for any Web
Animation applied to the provided element.

LayoutTests:

Reviewed by Dean Jackson.

Update existing tests to explicitly pass null for keyframes and update WPT expectations.

* http/wpt/web-animations/interfaces/AnimationTimeline/document-timeline-expected.txt:
* http/wpt/web-animations/interfaces/KeyframeEffect/constructor-expected.txt:
* http/wpt/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-001-expected.txt:
* http/wpt/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-002-expected.txt:
* http/wpt/web-animations/interfaces/KeyframeEffect/setKeyframes-expected.txt:
* http/wpt/wk-web-animations/interfaces/element-get-animations.html:
* http/wpt/wk-web-animations/timing-model/animation-creation-basic.html:
* http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship.html:
* http/wpt/wk-web-animations/timing-model/animation-interface-effect-property.html:
* http/wpt/wk-web-animations/timing-model/keyframe-effect-expected.txt:
* http/wpt/wk-web-animations/timing-model/keyframe-effect-interface-timing-duration.html:
* http/wpt/wk-web-animations/timing-model/keyframe-effect.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224897 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed:
LayoutTests/ChangeLog
LayoutTests/http/wpt/web-animations/interfaces/AnimationTimeline/document-timeline-expected.txt
LayoutTests/http/wpt/web-animations/interfaces/KeyframeEffect/constructor-expected.txt
LayoutTests/http/wpt/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-001-expected.txt
LayoutTests/http/wpt/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-002-expected.txt
LayoutTests/http/wpt/web-animations/interfaces/KeyframeEffect/setKeyframes-expected.txt
LayoutTests/http/wpt/wk-web-animations/interfaces/element-get-animations.html
LayoutTests/http/wpt/wk-web-animations/timing-model/animation-creation-basic.html
LayoutTests/http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship.html
LayoutTests/http/wpt/wk-web-animations/timing-model/animation-interface-effect-property.html
LayoutTests/http/wpt/wk-web-animations/timing-model/keyframe-effect-expected.txt
LayoutTests/http/wpt/wk-web-animations/timing-model/keyframe-effect-interface-timing-duration.html
LayoutTests/http/wpt/wk-web-animations/timing-model/keyframe-effect.html
Source/WebCore/ChangeLog
Source/WebCore/animation/AnimationEffect.h
Source/WebCore/animation/AnimationTimeline.h
Source/WebCore/animation/DocumentTimeline.cpp
Source/WebCore/animation/DocumentTimeline.h
Source/WebCore/animation/KeyframeEffect.cpp
Source/WebCore/animation/KeyframeEffect.h
Source/WebCore/animation/KeyframeEffect.idl
Source/WebCore/animation/WebAnimation.cpp
Source/WebCore/animation/WebAnimation.h
Source/WebCore/bindings/IDLTypes.h
Source/WebCore/dom/Document.h
Source/WebCore/dom/Element.cpp
Source/WebCore/style/StyleTreeResolver.cpp