[Web Animations] Refactor AnimationEffect and KeyframeEffect into AnimationEffectRead...
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Feb 2018 19:11:32 +0000 (19:11 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Feb 2018 19:11:32 +0000 (19:11 +0000)
commit56279d09f909720fd3298608aa984c0853c28dd5
tree69165e594c274a9a658abb8549d9a84fcc5c360f
parentaab330d18c86776b960a09ec324e1d1d5a008187
[Web Animations] Refactor AnimationEffect and KeyframeEffect into AnimationEffectReadOnly, KeyframeEffectReadOnly and KeyframeEffect
https://bugs.webkit.org/show_bug.cgi?id=182608

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Update WPT expectations with progressions and updated failure points for all tests that involved
either AnimationEffectReadOnly or KeyframeEffectReadOnly.

* web-platform-tests/web-animations/interfaces/Animation/constructor-expected.txt:
* web-platform-tests/web-animations/interfaces/Animation/effect-expected.txt:
* web-platform-tests/web-animations/interfaces/AnimationEffectTiming/idlharness-expected.txt:
* web-platform-tests/web-animations/interfaces/Document/getAnimations-expected.txt:
* web-platform-tests/web-animations/interfaces/KeyframeEffect/constructor-expected.txt:
* web-platform-tests/web-animations/interfaces/KeyframeEffect/copy-constructor-expected.txt:
* web-platform-tests/web-animations/interfaces/KeyframeEffect/idlharness-expected.txt:

Source/WebCore:

Currently, we have an AnimationEffect class with read-write members and a KeyframeEffect subclass with read-write
members. The spec has an AnimationEffectReadOnly class, with read-only members, a KeyframeEffectReadOnly subclass,
with read-only members, and then the KeyframeEffect subclass (of KeyframeEffectReadOnly) with read-write members.

Likewise, currently we have an AnimationEffectTiming class with read-write members. While the spec has this class
as well, it also specifies a read-only AnimationEffectTimingReadOnly superclass.

In this patch we refactor the code to match the spec, which gives us a big boost in our WPT pass rate. The vast
majority of the code is just copied from one class to another verbatim. The limited actual code changes, all related
to the new subclassing, are:

- AnimationEffectTimingReadOnly is not actually read-only as far as WebCore is concerned, it actually exposes setters
for all of its properties, but the IDL for this class specifies all properties as read-only, so we match the spec. The
reason for this is that it is necessary to be able to set members of an AnimationEffectTimingReadOnly object based on
a Variant<double, KeyframeEffectOptions> provided to Element.animate() or the KeyframeEffectReadOnly and KeyframeEffect
constructors, and the logic to handle properties in such dictionaries is the same as the logic required to set individual
members in AnimationEffectTiming. So in essence, the sole role of AnimationTimingEffect is to provide an IDL interface
with read-write members, but the parent class is itself read-write as far as WebCore is concerned.

- AnimationEffectTimingReadOnly exposes a new setProperties() method which takes in a nullable Variant<double, KeyframeEffectOptions>
so that code that was previously specific to KeyframeEffect can be factored into this method and both the constructors of
KeyframeEffectReadOnly and KeyframeEffect can make use of it without code duplication.

- The AnimationEffectReadOnly constructor now takes an AnimationEffectTimingReadOnly as input since that class and
KeyframeEffectReadOnly expose an AnimationEffectTimingReadOnly object, while KeyframeEffect exposes an
AnimationEffectTiming read-write object. This allows the KeyframeEffect constructor to provide the right object type.

* CMakeLists.txt:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* animation/AnimationEffectReadOnly.cpp: Renamed from Source/WebCore/animation/AnimationEffect.cpp.
(WebCore::AnimationEffectReadOnly::AnimationEffectReadOnly):
(WebCore::AnimationEffectReadOnly::localTime const):
(WebCore::AnimationEffectReadOnly::phase const):
(WebCore::AnimationEffectReadOnly::activeTime const):
(WebCore::AnimationEffectReadOnly::overallProgress const):
(WebCore::AnimationEffectReadOnly::simpleIterationProgress const):
(WebCore::AnimationEffectReadOnly::currentIteration const):
(WebCore::AnimationEffectReadOnly::currentDirection const):
(WebCore::AnimationEffectReadOnly::directedProgress const):
(WebCore::AnimationEffectReadOnly::transformedProgress const):
(WebCore::AnimationEffectReadOnly::iterationProgress const):
(WebCore::AnimationEffectReadOnly::getComputedTiming):
* animation/AnimationEffectReadOnly.h: Renamed from Source/WebCore/animation/AnimationEffect.h.
(WebCore::AnimationEffectReadOnly::isKeyframeEffectReadOnly const):
(WebCore::AnimationEffectReadOnly::timing const):
* animation/AnimationEffectReadOnly.idl: Copied from Source/WebCore/animation/AnimationEffect.idl.
* animation/AnimationEffectTiming.cpp:
(WebCore::AnimationEffectTiming::AnimationEffectTiming):
(WebCore::AnimationEffectTiming::setIterationStart): Deleted.
(WebCore::AnimationEffectTiming::setIterations): Deleted.
(WebCore::AnimationEffectTiming::bindingsDuration const): Deleted.
(WebCore::AnimationEffectTiming::setBindingsDuration): Deleted.
(WebCore::AnimationEffectTiming::endTime const): Deleted.
(WebCore::AnimationEffectTiming::activeDuration const): Deleted.
(WebCore::AnimationEffectTiming::setEasing): Deleted.
* animation/AnimationEffectTiming.h:
(): Deleted.
* animation/AnimationEffectTiming.idl:
* animation/AnimationEffectTimingReadOnly.cpp: Copied from Source/WebCore/animation/AnimationEffectTiming.cpp.
(WebCore::AnimationEffectTimingReadOnly::create):
(WebCore::AnimationEffectTimingReadOnly::AnimationEffectTimingReadOnly):
(WebCore::AnimationEffectTimingReadOnly::~AnimationEffectTimingReadOnly):
(WebCore::AnimationEffectTimingReadOnly::setProperties):
(WebCore::AnimationEffectTimingReadOnly::setIterationStart):
(WebCore::AnimationEffectTimingReadOnly::setIterations):
(WebCore::AnimationEffectTimingReadOnly::bindingsDuration const):
(WebCore::AnimationEffectTimingReadOnly::setBindingsDuration):
(WebCore::AnimationEffectTimingReadOnly::setEasing):
(WebCore::AnimationEffectTimingReadOnly::endTime const):
(WebCore::AnimationEffectTimingReadOnly::activeDuration const):
* animation/AnimationEffectTimingReadOnly.h: Copied from Source/WebCore/animation/AnimationEffectTiming.h.
(WebCore::AnimationEffectTimingReadOnly::isAnimationEffectTiming const):
(WebCore::AnimationEffectTimingReadOnly::bindingsDelay const):
(WebCore::AnimationEffectTimingReadOnly::setBindingsDelay):
(WebCore::AnimationEffectTimingReadOnly::bindingsEndDelay const):
(WebCore::AnimationEffectTimingReadOnly::setBindingsEndDelay):
(WebCore::AnimationEffectTimingReadOnly::delay const):
(WebCore::AnimationEffectTimingReadOnly::setDelay):
(WebCore::AnimationEffectTimingReadOnly::endDelay const):
(WebCore::AnimationEffectTimingReadOnly::setEndDelay):
(WebCore::AnimationEffectTimingReadOnly::fill const):
(WebCore::AnimationEffectTimingReadOnly::setFill):
(WebCore::AnimationEffectTimingReadOnly::iterationStart const):
(WebCore::AnimationEffectTimingReadOnly::iterations const):
(WebCore::AnimationEffectTimingReadOnly::iterationDuration const):
(WebCore::AnimationEffectTimingReadOnly::setIterationDuration):
(WebCore::AnimationEffectTimingReadOnly::direction const):
(WebCore::AnimationEffectTimingReadOnly::setDirection):
(WebCore::AnimationEffectTimingReadOnly::easing const):
(WebCore::AnimationEffectTimingReadOnly::timingFunction const):
(WebCore::AnimationEffectTimingReadOnly::classType const):
* animation/AnimationEffectTimingReadOnly.idl: Renamed from Source/WebCore/animation/AnimationEffect.idl.
* animation/AnimationTimeline.h:
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::create):
(WebCore::KeyframeEffect::KeyframeEffect):
(WebCore::IDLAttributeNameToAnimationPropertyName): Deleted.
(WebCore::CSSPropertyIDToIDLAttributeName): Deleted.
(WebCore::computeMissingKeyframeOffsets): Deleted.
(WebCore::processIterableKeyframes): Deleted.
(WebCore::processKeyframeLikeObject): Deleted.
(WebCore::processPropertyIndexedKeyframes): Deleted.
(WebCore::KeyframeEffect::getKeyframes): Deleted.
(WebCore::KeyframeEffect::processKeyframes): Deleted.
(WebCore::KeyframeEffect::computeStackingContextImpact): Deleted.
(WebCore::KeyframeEffect::apply): Deleted.
(WebCore::KeyframeEffect::shouldRunAccelerated): Deleted.
(WebCore::KeyframeEffect::getAnimatedStyle): Deleted.
(WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): Deleted.
(WebCore::KeyframeEffect::startOrStopAccelerated): Deleted.
(WebCore::KeyframeEffect::renderer const): Deleted.
(WebCore::KeyframeEffect::currentStyle const): Deleted.
* animation/KeyframeEffect.h:
* animation/KeyframeEffect.idl:
* animation/KeyframeEffectReadOnly.cpp: Copied from Source/WebCore/animation/KeyframeEffect.cpp.
(WebCore::IDLAttributeNameToAnimationPropertyName):
(WebCore::CSSPropertyIDToIDLAttributeName):
(WebCore::computeMissingKeyframeOffsets):
(WebCore::processIterableKeyframes):
(WebCore::processKeyframeLikeObject):
(WebCore::processPropertyIndexedKeyframes):
(WebCore::KeyframeEffectReadOnly::create):
(WebCore::KeyframeEffectReadOnly::KeyframeEffectReadOnly):
(WebCore::KeyframeEffectReadOnly::getKeyframes):
(WebCore::KeyframeEffectReadOnly::processKeyframes):
(WebCore::KeyframeEffectReadOnly::computeStackingContextImpact):
(WebCore::KeyframeEffectReadOnly::apply):
(WebCore::KeyframeEffectReadOnly::shouldRunAccelerated):
(WebCore::KeyframeEffectReadOnly::getAnimatedStyle):
(WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle):
(WebCore::KeyframeEffectReadOnly::startOrStopAccelerated):
(WebCore::KeyframeEffectReadOnly::renderer const):
(WebCore::KeyframeEffectReadOnly::currentStyle const):
* animation/KeyframeEffectReadOnly.h: Copied from Source/WebCore/animation/KeyframeEffect.h.
(WebCore::KeyframeEffectReadOnly::~KeyframeEffectReadOnly):
(WebCore::KeyframeEffectReadOnly::target const):
(WebCore::KeyframeEffectReadOnly::iterationComposite const):
(WebCore::KeyframeEffectReadOnly::composite const):
(WebCore::KeyframeEffectReadOnly::isRunningAccelerated const):
* animation/KeyframeEffectReadOnly.idl: Copied from Source/WebCore/animation/KeyframeEffect.idl.
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::create):
(WebCore::WebAnimation::setEffect):
* animation/WebAnimation.h:
* animation/WebAnimation.idl:
* bindings/js/JSAnimationEffectReadOnlyCustom.cpp: Copied from Source/WebCore/bindings/js/JSAnimationEffectCustom.cpp.
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp: Renamed from Source/WebCore/bindings/js/JSAnimationEffectCustom.cpp.
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
* bindings/js/JSCustomEventCustom.cpp:
(WebCore::JSCustomEvent::detail const): Fix an error introduced in webkit.org/b/179591.
* bindings/js/JSWebAnimationCustom.cpp:
(WebCore::constructJSWebAnimation):
* bindings/js/WebCoreBuiltinNames.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228333 268f45cc-cd09-0410-ab3c-d52691b4dbfc
37 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/constructor-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/effect-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/AnimationEffectTiming/idlharness-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Document/getAnimations-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/KeyframeEffect/constructor-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/KeyframeEffect/copy-constructor-expected.txt
LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/KeyframeEffect/idlharness-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/animation/AnimationEffectReadOnly.cpp [moved from Source/WebCore/animation/AnimationEffect.cpp with 90% similarity]
Source/WebCore/animation/AnimationEffectReadOnly.h [moved from Source/WebCore/animation/AnimationEffect.h with 79% similarity]
Source/WebCore/animation/AnimationEffectReadOnly.idl [moved from Source/WebCore/animation/AnimationEffect.idl with 88% similarity]
Source/WebCore/animation/AnimationEffectTiming.cpp
Source/WebCore/animation/AnimationEffectTiming.h
Source/WebCore/animation/AnimationEffectTiming.idl
Source/WebCore/animation/AnimationEffectTimingReadOnly.cpp [new file with mode: 0644]
Source/WebCore/animation/AnimationEffectTimingReadOnly.h [new file with mode: 0644]
Source/WebCore/animation/AnimationEffectTimingReadOnly.idl [new file with mode: 0644]
Source/WebCore/animation/AnimationTimeline.h
Source/WebCore/animation/KeyframeEffect.cpp
Source/WebCore/animation/KeyframeEffect.h
Source/WebCore/animation/KeyframeEffect.idl
Source/WebCore/animation/KeyframeEffectReadOnly.cpp [new file with mode: 0644]
Source/WebCore/animation/KeyframeEffectReadOnly.h [new file with mode: 0644]
Source/WebCore/animation/KeyframeEffectReadOnly.idl [new file with mode: 0644]
Source/WebCore/animation/WebAnimation.cpp
Source/WebCore/animation/WebAnimation.h
Source/WebCore/animation/WebAnimation.idl
Source/WebCore/bindings/js/JSAnimationEffectReadOnlyCustom.cpp [moved from Source/WebCore/bindings/js/JSAnimationEffectCustom.cpp with 82% similarity]
Source/WebCore/bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp [new file with mode: 0644]
Source/WebCore/bindings/js/JSCustomEventCustom.cpp
Source/WebCore/bindings/js/JSWebAnimationCustom.cpp
Source/WebCore/bindings/js/WebCoreBuiltinNames.h