[Web Animations] Make KeyframeEffect target nullable and read-write
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Feb 2018 00:36:19 +0000 (00:36 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Feb 2018 00:36:19 +0000 (00:36 +0000)
commitc5265c2cb3ca0c57e7c6733a214d4125a128b885
tree4c420c02eb44ead7a1370e03b924cf38b85890d4
parent26ba67f34a675fc717af94b00d07a853770053ba
[Web Animations] Make KeyframeEffect target nullable and read-write
https://bugs.webkit.org/show_bug.cgi?id=182741

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Update test expectations with progressions resulting from handling null values for a keyframe effect's target
as well as making the KeyframeEffect target a read-write property.

* web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt:
* web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt:
* web-platform-tests/web-animations/interfaces/KeyframeEffect/idlharness-expected.txt:
* web-platform-tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-001-expected.txt:
* web-platform-tests/web-animations/interfaces/KeyframeEffect/target-expected.txt:

Source/WebCore:

We used to completely disregard null targets, for instance not parsing keyframes, but targets
can be null and are also supposed to be read-write for KeyframeEffect. We now update the IDL
for KeyframeEffect to mark the target property as read-write and update the implementation
to correctly handle null targets.

This revealed a few issues in our implementation by allowing more WPT tests to run. So we also
ensure that:

- we don't crash when parsing font-related properties by calling update() on the generated
RenderStyle's FontCascade when parsing keyframes.

- CSS properties are provided as camel-case and not as hyphenated form

- values provided in keyframes dictionaries are only read for valid properties

- styles for effect targets are invalidated as soon as the timing model for that animation
is changed

* animation/KeyframeEffect.idl:
* animation/KeyframeEffectReadOnly.cpp:
(WebCore::invalidateElement): Add a new utility method to invalidate a given element since
we may want to invalidate not only the current target (m_target) but also a previous target.
(WebCore::IDLAttributeNameToAnimationPropertyName): Move this function below CSSPropertyIDToIDLAttributeName
so that it can call that function. We also check that we reject CSS properties that are not provided in
camel-case form (eg. "font-size" vs. "fontSize").
(WebCore::processIterableKeyframes): Only read the JS values if we know that the provided JS property name
maps to a valid CSS property.
(WebCore::KeyframeEffectReadOnly::processKeyframes): Allow keyframes to be processed even if the effect's
target is null.
(WebCore::KeyframeEffectReadOnly::setTarget): Notify the animation that the effect target has changed and
invalidate the style of the new target and the old targets, if any. We also update the blending keyframes
since this task may not have been completed in a previous call to processKeyframes() due to the target being
null at that time.
(WebCore::KeyframeEffectReadOnly::invalidate): Use the invalidateElement() utility.
* animation/KeyframeEffectReadOnly.h:
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::effectTargetDidChange): This method is called in KeyframeEffectReadOnly::setTarget()
to inform the animation of the previous effect target and the new one upon a target change. This allows us to
forward this information onto the timeline so that we correctly add or remove the targets from the list of
animated elements.
* animation/WebAnimation.h:

LayoutTests:

Add some platform-specific results for Sierra where we don't support the "font-variation-settings" property.

* platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt: Added.
* platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt: Added.
* platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228717 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/KeyframeEffect/idlharness-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-001-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/KeyframeEffect/target-expected.txt
LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/animation/KeyframeEffect.idl
Source/WebCore/animation/KeyframeEffectReadOnly.cpp
Source/WebCore/animation/KeyframeEffectReadOnly.h
Source/WebCore/animation/WebAnimation.cpp
Source/WebCore/animation/WebAnimation.h