haikuwebkit/Source/WebCore/animation/AnimationEffect.h

137 lines
5.1 KiB
C
Raw Permalink Normal View History

[Web Animations] Add basic timing and target properties https://bugs.webkit.org/show_bug.cgi?id=178674 Patch by Antoine Quint <graouts@apple.com> on 2017-10-24 Reviewed by Dean Jackson. Source/WebCore: We add three new interfaces to expose enough properties to establish basic timing properties, a start time and duration, and the target of an animation. The startTime property is set on the Animation object, the target is set on the KeyframeEffect set as the effect property on the Animation object, and the duration is set on the AnimationEffectTiming set on the effect. Tests: webanimations/animation-effect-timing.html webanimations/animation-effect.html webanimations/animation-interface-effect-property.html webanimations/animation-interface-start-time-property.html webanimations/keyframe-effect-interface-timing-duration.html webanimations/keyframe-effect.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): * animation/AnimationEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. (WebCore::AnimationEffect::isKeyframeEffect const): (WebCore::AnimationEffect::timing const): (WebCore::AnimationEffect::classType const): * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/AnimationEffectTiming.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffectTiming::create): (WebCore::AnimationEffectTiming::AnimationEffectTiming): (WebCore::AnimationEffectTiming::~AnimationEffectTiming): * animation/AnimationEffectTiming.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/AnimationEffectTiming.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffect): * animation/WebAnimation.h: * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectCustom.cpp: Copied from Source/WebCore/animation/WebAnimation.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/WebCoreBuiltinNames.h: LayoutTests: Add new tests to check the behavior of the newly exposed interfaces, constructors and properties. * webanimations/animation-effect-expected.txt: Added. * webanimations/animation-effect-timing-expected.txt: Added. * webanimations/animation-effect-timing.html: Added. * webanimations/animation-effect.html: Added. * webanimations/animation-interface-effect-property-expected.txt: Added. * webanimations/animation-interface-effect-property.html: Added. * webanimations/animation-interface-start-time-property-expected.txt: Added. * webanimations/animation-interface-start-time-property.html: Added. * webanimations/keyframe-effect-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration.html: Added. * webanimations/keyframe-effect.html: Added. Canonical link: https://commits.webkit.org/194879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-24 07:51:59 +00:00
/*
[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: Canonical link: https://commits.webkit.org/198463@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228333 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-02-09 19:11:32 +00:00
* Copyright (C) 2017-2018 Apple Inc. All rights reserved.
[Web Animations] Add basic timing and target properties https://bugs.webkit.org/show_bug.cgi?id=178674 Patch by Antoine Quint <graouts@apple.com> on 2017-10-24 Reviewed by Dean Jackson. Source/WebCore: We add three new interfaces to expose enough properties to establish basic timing properties, a start time and duration, and the target of an animation. The startTime property is set on the Animation object, the target is set on the KeyframeEffect set as the effect property on the Animation object, and the duration is set on the AnimationEffectTiming set on the effect. Tests: webanimations/animation-effect-timing.html webanimations/animation-effect.html webanimations/animation-interface-effect-property.html webanimations/animation-interface-start-time-property.html webanimations/keyframe-effect-interface-timing-duration.html webanimations/keyframe-effect.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): * animation/AnimationEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. (WebCore::AnimationEffect::isKeyframeEffect const): (WebCore::AnimationEffect::timing const): (WebCore::AnimationEffect::classType const): * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/AnimationEffectTiming.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffectTiming::create): (WebCore::AnimationEffectTiming::AnimationEffectTiming): (WebCore::AnimationEffectTiming::~AnimationEffectTiming): * animation/AnimationEffectTiming.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/AnimationEffectTiming.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffect): * animation/WebAnimation.h: * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectCustom.cpp: Copied from Source/WebCore/animation/WebAnimation.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/WebCoreBuiltinNames.h: LayoutTests: Add new tests to check the behavior of the newly exposed interfaces, constructors and properties. * webanimations/animation-effect-expected.txt: Added. * webanimations/animation-effect-timing-expected.txt: Added. * webanimations/animation-effect-timing.html: Added. * webanimations/animation-effect.html: Added. * webanimations/animation-interface-effect-property-expected.txt: Added. * webanimations/animation-interface-effect-property.html: Added. * webanimations/animation-interface-start-time-property-expected.txt: Added. * webanimations/animation-interface-start-time-property.html: Added. * webanimations/keyframe-effect-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration.html: Added. * webanimations/keyframe-effect.html: Added. Canonical link: https://commits.webkit.org/194879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-24 07:51:59 +00:00
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
[Web Animations] Implement getTiming() and updateTiming() https://bugs.webkit.org/show_bug.cgi?id=186511 <rdar://problem/41000677> Reviewed by Dean Jackson. The Web Animations API has been further simplified by removing the AnimationEffectTiming and AnimationEffectTimingReadOnly interfaces, removing the "timing" property on AnimationEffect replacing it with getTiming() and updateTiming() methods. This does not change the features of the API but simply how they are exposed. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::transformedProgress const): (WebCore::AnimationEffect::getTiming): (WebCore::AnimationEffect::getComputedTiming): (WebCore::AnimationEffect::updateTiming): (WebCore::AnimationEffect::setIterationStart): (WebCore::AnimationEffect::setIterations): (WebCore::AnimationEffect::endTime const): (WebCore::AnimationEffect::setDelay): (WebCore::AnimationEffect::setEndDelay): (WebCore::AnimationEffect::setFill): (WebCore::AnimationEffect::setIterationDuration): (WebCore::AnimationEffect::setDirection): (WebCore::AnimationEffect::setTimingFunction): (WebCore::AnimationEffect::activeDuration const): * animation/AnimationEffect.h: (WebCore::AnimationEffect::delay const): (WebCore::AnimationEffect::endDelay const): (WebCore::AnimationEffect::fill const): (WebCore::AnimationEffect::iterationStart const): (WebCore::AnimationEffect::iterations const): (WebCore::AnimationEffect::iterationDuration const): (WebCore::AnimationEffect::direction const): (WebCore::AnimationEffect::timingFunction const): * animation/AnimationEffect.idl: * animation/AnimationEffectTiming.idl: Removed. * animation/AnimationEffectTimingReadOnly.cpp: Removed. * animation/AnimationEffectTimingReadOnly.h: Removed. * animation/AnimationEffectTimingReadOnly.idl: Removed. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/CSSTransition.cpp: (WebCore::CSSTransition::setTimingProperties): * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DocumentTimeline.cpp: * animation/EffectTiming.idl: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): * animation/KeyframeEffect.h: * animation/OptionalEffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTiming.h. * animation/OptionalEffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTiming.cpp. * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectTimingDidChange): (WebCore::WebAnimation::updatePlaybackRate): * animation/WebAnimation.h: (WebCore::WebAnimation::isRelevant const): * bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp: Removed. * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/206102@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 11:15:30 +00:00
#include "AnimationEffect.h"
[Web Animations] Compute animation effect timing properties in batch https://bugs.webkit.org/show_bug.cgi?id=192850 Reviewed by Dean Jackson. We remove a host of functions from AnimationEffect that would allow the computation of various timing properties defined by the Web Animations specification: phase, progress, current iteration, etc. Indeed, a lot of these functions would call each other in a chain, and we would re-compute a lot of the earlier properties in those chains several times when doing something like querying the animation progress. Additionally, some functions, such as WebAnimation::computeRelevance() and WebAnimation::timeToNextTick() would yield the computation of several such properties numerous times. All of those functions are called during each animation frame and are ripe for optimizations. We now compute all timing properties across two functions: 1. the new AnimationEffect::getBasicTiming() which computes the local time, end time, active duration, active time and phase, 2. the existing AnimationEffect::getComputedTiming() which now also exposes the phase and simple iteration progress. To support this we introduce a new BasicEffectTiming struct to contain the values computed in AnimationEffect::getBasicTiming() and spun the AnimationEffect::Phase struct as AnimationEffectPhase so that it may be used across BasicEffectTiming and ComputedEffectTiming. No new test since there is no user-observable change. * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::getTiming const): (WebCore::AnimationEffect::getBasicTiming const): (WebCore::AnimationEffect::getComputedTiming const): (WebCore::AnimationEffect::localTime const): Deleted. (WebCore::AnimationEffect::phase const): Deleted. (WebCore::AnimationEffect::activeTime const): Deleted. (WebCore::AnimationEffect::overallProgress const): Deleted. (WebCore::AnimationEffect::simpleIterationProgress const): Deleted. (WebCore::AnimationEffect::currentIteration const): Deleted. (WebCore::AnimationEffect::currentDirection const): Deleted. (WebCore::AnimationEffect::directedProgress const): Deleted. (WebCore::AnimationEffect::transformedProgress const): Deleted. (WebCore::AnimationEffect::iterationProgress const): Deleted. (WebCore::AnimationEffect::getTiming): Deleted. (WebCore::AnimationEffect::getComputedTiming): Deleted. (WebCore::AnimationEffect::endTime const): Deleted. (WebCore::AnimationEffect::activeDuration const): Deleted. * animation/AnimationEffect.h: * animation/AnimationEffectPhase.h: Copied from Source/WebCore/animation/ComputedEffectTiming.h. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::updateCSSTransitionsForElement): * animation/AnimationTimeline.h: * animation/BasicEffectTiming.h: Copied from Source/WebCore/animation/ComputedEffectTiming.h. * animation/ComputedEffectTiming.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::cancel): (WebCore::DeclarativeAnimation::phaseWithoutEffect const): (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DeclarativeAnimation.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::apply): (WebCore::KeyframeEffect::getAnimatedStyle): * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectEndTime const): (WebCore::WebAnimation::computeRelevance): (WebCore::WebAnimation::timeToNextTick const): Canonical link: https://commits.webkit.org/207736@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239723 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-08 11:31:55 +00:00
#include "AnimationEffectPhase.h"
#include "BasicEffectTiming.h"
[Web Animations] Update the Web Animations API to remove all the ReadOnly interfaces https://bugs.webkit.org/show_bug.cgi?id=186512 <rdar://problem/41000691> Reviewed by Dean Jackson. The Web Animations API has been simplified by removing its various ReadOnly interfaces. In this patch, we make the following changes, not adding code but merely merging and renaming files: - AnimationEffectReadOnly and AnimationEffect are now a single AnimationEffect interface - KeyframeEffectReadOnly and KeyframeEffect are now a single KeyframeEffect interface - ComputedTimingProperties is now named ComputedEffectTiming - AnimationEffectTimingProperties is now named EffectTiming * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: Renamed from Source/WebCore/animation/AnimationEffectReadOnly.cpp. (WebCore::AnimationEffect::~AnimationEffect): (WebCore::AnimationEffect::timingDidChange): (WebCore::AnimationEffect::localTime const): (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::directedProgress const): (WebCore::AnimationEffect::transformedProgress const): (WebCore::AnimationEffect::iterationProgress const): (WebCore::AnimationEffect::getComputedTiming): * animation/AnimationEffect.h: Renamed from Source/WebCore/animation/AnimationEffectReadOnly.h. (WebCore::AnimationEffect::isKeyframeEffect const): * animation/AnimationEffect.idl: Renamed from Source/WebCore/animation/AnimationEffectReadOnly.idl. * animation/AnimationEffectTimingReadOnly.cpp: * animation/AnimationEffectTimingReadOnly.h: (WebCore::AnimationEffectTimingReadOnly::setEffect): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::cssAnimationForElementAndProperty): * animation/CSSTransition.cpp: * animation/ComputedEffectTiming.h: Renamed from Source/WebCore/animation/ComputedTimingProperties.h. * animation/ComputedEffectTiming.idl: Renamed from Source/WebCore/animation/ComputedTimingProperties.idl. * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::initialize): (WebCore::DeclarativeAnimation::flushPendingStyleChanges const): (WebCore::DeclarativeAnimation::phaseWithoutEffect const): (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DeclarativeAnimation.h: * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::getAnimations const): (WebCore::DocumentTimeline::transitionDidComplete): (WebCore::DocumentTimeline::computeExtentOfAnimation const): (WebCore::DocumentTimeline::isRunningAnimationOnRenderer const): (WebCore::DocumentTimeline::isRunningAcceleratedAnimationOnRenderer const): (WebCore::DocumentTimeline::animatedStyleForRenderer): (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange): (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement): (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations): (WebCore::DocumentTimeline::resolveAnimationsForElement): * animation/EffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTimingProperties.h. * animation/EffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTimingProperties.idl. * animation/KeyframeEffect.cpp: (WebCore::invalidateElement): (WebCore::CSSPropertyIDToIDLAttributeName): (WebCore::IDLAttributeNameToAnimationPropertyName): (WebCore::computeMissingKeyframeOffsets): (WebCore::processKeyframeLikeObject): (WebCore::processIterableKeyframes): (WebCore::processPropertyIndexedKeyframes): (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::getKeyframes): (WebCore::KeyframeEffect::processKeyframes): (WebCore::KeyframeEffect::updateBlendingKeyframes): (WebCore::KeyframeEffect::forceLayoutIfNeeded): (WebCore::KeyframeEffect::setBlendingKeyframes): (WebCore::KeyframeEffect::checkForMatchingTransformFunctionLists): (WebCore::KeyframeEffect::checkForMatchingFilterFunctionLists const): (WebCore::KeyframeEffect::checkForMatchingFilterFunctionLists): (WebCore::KeyframeEffect::checkForMatchingBackdropFilterFunctionLists): (WebCore::KeyframeEffect::checkForMatchingColorFilterFunctionLists): (WebCore::KeyframeEffect::computeDeclarativeAnimationBlendingKeyframes): (WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes): (WebCore::KeyframeEffect::computeCSSTransitionBlendingKeyframes): (WebCore::KeyframeEffect::computedNeedsForcedLayout): (WebCore::KeyframeEffect::computeStackingContextImpact): (WebCore::KeyframeEffect::setTarget): (WebCore::KeyframeEffect::apply): (WebCore::KeyframeEffect::invalidate): (WebCore::KeyframeEffect::computeShouldRunAccelerated): (WebCore::KeyframeEffect::getAnimatedStyle): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::timingFunctionForKeyframeAtIndex): (WebCore::KeyframeEffect::updateAcceleratedAnimationState): (WebCore::KeyframeEffect::addPendingAcceleratedAction): (WebCore::KeyframeEffect::animationDidSeek): (WebCore::KeyframeEffect::animationSuspensionStateDidChange): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): (WebCore::KeyframeEffect::renderer const): (WebCore::KeyframeEffect::currentStyle const): (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const): (WebCore::containsRotation): (WebCore::KeyframeEffect::computeTransformedExtentViaTransformList const): (WebCore::KeyframeEffect::computeTransformedExtentViaMatrix const): * animation/KeyframeEffect.h: (WebCore::KeyframeEffect::ParsedKeyframe::ParsedKeyframe): (WebCore::KeyframeEffect::target const): (WebCore::KeyframeEffect::iterationComposite const): (WebCore::KeyframeEffect::composite const): (WebCore::KeyframeEffect::isRunningAccelerated const): (WebCore::KeyframeEffect::hasPendingAcceleratedAction const): (WebCore::KeyframeEffect::hasBlendingKeyframes const): (WebCore::KeyframeEffect::animatedProperties const): * animation/KeyframeEffect.idl: * animation/KeyframeEffectOptions.h: * animation/KeyframeEffectOptions.idl: * animation/KeyframeEffectReadOnly.cpp: Removed. * animation/KeyframeEffectReadOnly.h: Removed. * animation/KeyframeEffectReadOnly.idl: Removed. * animation/WebAnimation.cpp: (WebCore::WebAnimation::create): (WebCore::WebAnimation::setEffect): (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::applyPendingAcceleratedActions): (WebCore::WebAnimation::computeRelevance): * animation/WebAnimation.h: (WebCore::WebAnimation::effect const): * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectCustom.cpp: Renamed from Source/WebCore/bindings/js/JSAnimationEffectReadOnlyCustom.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSWebAnimationCustom.cpp: (WebCore::constructJSWebAnimation): * bindings/js/WebCoreBuiltinNames.h: * dom/Document.cpp: Canonical link: https://commits.webkit.org/206101@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237852 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 11:15:15 +00:00
#include "ComputedEffectTiming.h"
[Web Animations] Implement getTiming() and updateTiming() https://bugs.webkit.org/show_bug.cgi?id=186511 <rdar://problem/41000677> Reviewed by Dean Jackson. The Web Animations API has been further simplified by removing the AnimationEffectTiming and AnimationEffectTimingReadOnly interfaces, removing the "timing" property on AnimationEffect replacing it with getTiming() and updateTiming() methods. This does not change the features of the API but simply how they are exposed. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::transformedProgress const): (WebCore::AnimationEffect::getTiming): (WebCore::AnimationEffect::getComputedTiming): (WebCore::AnimationEffect::updateTiming): (WebCore::AnimationEffect::setIterationStart): (WebCore::AnimationEffect::setIterations): (WebCore::AnimationEffect::endTime const): (WebCore::AnimationEffect::setDelay): (WebCore::AnimationEffect::setEndDelay): (WebCore::AnimationEffect::setFill): (WebCore::AnimationEffect::setIterationDuration): (WebCore::AnimationEffect::setDirection): (WebCore::AnimationEffect::setTimingFunction): (WebCore::AnimationEffect::activeDuration const): * animation/AnimationEffect.h: (WebCore::AnimationEffect::delay const): (WebCore::AnimationEffect::endDelay const): (WebCore::AnimationEffect::fill const): (WebCore::AnimationEffect::iterationStart const): (WebCore::AnimationEffect::iterations const): (WebCore::AnimationEffect::iterationDuration const): (WebCore::AnimationEffect::direction const): (WebCore::AnimationEffect::timingFunction const): * animation/AnimationEffect.idl: * animation/AnimationEffectTiming.idl: Removed. * animation/AnimationEffectTimingReadOnly.cpp: Removed. * animation/AnimationEffectTimingReadOnly.h: Removed. * animation/AnimationEffectTimingReadOnly.idl: Removed. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/CSSTransition.cpp: (WebCore::CSSTransition::setTimingProperties): * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DocumentTimeline.cpp: * animation/EffectTiming.idl: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): * animation/KeyframeEffect.h: * animation/OptionalEffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTiming.h. * animation/OptionalEffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTiming.cpp. * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectTimingDidChange): (WebCore::WebAnimation::updatePlaybackRate): * animation/WebAnimation.h: (WebCore::WebAnimation::isRelevant const): * bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp: Removed. * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/206102@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 11:15:30 +00:00
#include "ExceptionOr.h"
#include "FillMode.h"
#include "KeyframeEffectOptions.h"
#include "OptionalEffectTiming.h"
#include "PlaybackDirection.h"
#include "TimingFunction.h"
[Web Animations] Implement getAnimations() https://bugs.webkit.org/show_bug.cgi?id=179535 <rdar://problem/34932475> Reviewed by Simon Fraser. Source/WebCore: We now allow a list of animations for a document, with Document.getAnimations(), or for an element, with Animatable.getAnimations(), to be returned. In order to support this, we maintain a map on AnimationTimeline of all animations for a given element. This map is invalidated when an animation's timeline changes and when an animation's effect changes. Note that the Web Animations spec mandates that an AnimationEffect can only be a single animation's effect. Tests: http/wpt/wk-web-animations/interfaces/document-get-animations.html http/wpt/wk-web-animations/interfaces/element-get-animations.html http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship.html * CMakeLists.txt: Add Animatable.idl. * DerivedSources.make: Add Animatable.idl. * WebCore.xcodeproj/project.pbxproj: Add Animatable.idl. * animation/Animatable.idl: A new interface that Element implements and which currently only exposes getAnimations(), the animate() method will be added later. * animation/AnimationEffect.h: Add a new m_animation member to reference the animation using this effect. This relationship is required so we guarantee that an effect is associated with a single animation at most. (WebCore::AnimationEffect::animation const): (WebCore::AnimationEffect::setAnimation): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::animationWasAddedToElement): New method to notify the timeline that an animation registered with this timeline has been associated with a new element through its effect. (WebCore::AnimationTimeline::animationWasRemovedFromElement): New method to notify the timeline that an animation registered with this timeline has been disassociated with an element through its effect. (WebCore::AnimationTimeline::animationsForElement): New method returning all animations registered with this timeline for a given element. * animation/AnimationTimeline.h: (WebCore::AnimationTimeline::animations const): All animations registered with this timeline. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::DocumentTimeline): (WebCore::DocumentTimeline::detachFromDocument): Clear the reference between this timeline and its document. (WebCore::DocumentTimeline::currentTime): Protect against a null Document reference. (WebCore::DocumentTimeline::createDisplayRefreshMonitor const): Protect against a null Document reference. * animation/DocumentTimeline.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::create): (WebCore::WebAnimation::setEffect): As an animation's effect changes, we need to ensure that the old effect no longer has an associated animation, and that the new effect is associated with this animation. Additionally, we update the element-to-animations map on the animation's timeline. (WebCore::WebAnimation::setTimeline): Update the element-to-animations map on the former and new timeline. * dom/Document.cpp: (WebCore::Document::prepareForDestruction): Clear the relationship between this document and its timeline. (WebCore::Document::getAnimations): Obtain all animations associated with this document's timeline. * dom/Document.h: * dom/Document.idl: * dom/Element.cpp: (WebCore::Element::getAnimations): Obtain all animations associated with this element. * dom/Element.h: * dom/Element.idl: * testing/Internals.cpp: * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * animation/Animatable.idl: * animation/AnimationEffect.h: (WebCore::AnimationEffect::animation const): (WebCore::AnimationEffect::setAnimation): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::animationWasAddedToElement): (WebCore::AnimationTimeline::animationWasRemovedFromElement): (WebCore::AnimationTimeline::animationsForElement): * animation/AnimationTimeline.h: (WebCore::AnimationTimeline::animations const): * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::DocumentTimeline): (WebCore::DocumentTimeline::detachFromDocument): (WebCore::DocumentTimeline::currentTime): (WebCore::DocumentTimeline::createDisplayRefreshMonitor const): * animation/DocumentTimeline.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::create): (WebCore::WebAnimation::setEffect): (WebCore::WebAnimation::setTimeline): * dom/Document.cpp: (WebCore::Document::prepareForDestruction): (WebCore::Document::getAnimations): * dom/Document.h: * dom/Document.idl: * dom/Element.cpp: (WebCore::Element::getAnimations): * dom/Element.h: * dom/Element.idl: * testing/Internals.cpp: LayoutTests: Update WPT expectations per new progressions and add three new tests that check the behavior of Document.getAnimations(), Element.getAnimations() and the unique relationship between an Animation and an AnimationEffect. * http/wpt/web-animations/interfaces/Animatable/animate-expected.txt: * http/wpt/web-animations/interfaces/Animatable/getAnimations-expected.txt: * http/wpt/web-animations/interfaces/Document/getAnimations-expected.txt: * http/wpt/wk-web-animations/interfaces/document-get-animations-expected.txt: Added. * http/wpt/wk-web-animations/interfaces/document-get-animations.html: Added. * http/wpt/wk-web-animations/interfaces/element-get-animations-expected.txt: Added. * http/wpt/wk-web-animations/interfaces/element-get-animations.html: Added. * http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship-expected.txt: Added. * http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship.html: Added. Canonical link: https://commits.webkit.org/195647@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224760 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-13 19:14:47 +00:00
#include "WebAnimation.h"
[Web Animations] Implement getTiming() and updateTiming() https://bugs.webkit.org/show_bug.cgi?id=186511 <rdar://problem/41000677> Reviewed by Dean Jackson. The Web Animations API has been further simplified by removing the AnimationEffectTiming and AnimationEffectTimingReadOnly interfaces, removing the "timing" property on AnimationEffect replacing it with getTiming() and updateTiming() methods. This does not change the features of the API but simply how they are exposed. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::transformedProgress const): (WebCore::AnimationEffect::getTiming): (WebCore::AnimationEffect::getComputedTiming): (WebCore::AnimationEffect::updateTiming): (WebCore::AnimationEffect::setIterationStart): (WebCore::AnimationEffect::setIterations): (WebCore::AnimationEffect::endTime const): (WebCore::AnimationEffect::setDelay): (WebCore::AnimationEffect::setEndDelay): (WebCore::AnimationEffect::setFill): (WebCore::AnimationEffect::setIterationDuration): (WebCore::AnimationEffect::setDirection): (WebCore::AnimationEffect::setTimingFunction): (WebCore::AnimationEffect::activeDuration const): * animation/AnimationEffect.h: (WebCore::AnimationEffect::delay const): (WebCore::AnimationEffect::endDelay const): (WebCore::AnimationEffect::fill const): (WebCore::AnimationEffect::iterationStart const): (WebCore::AnimationEffect::iterations const): (WebCore::AnimationEffect::iterationDuration const): (WebCore::AnimationEffect::direction const): (WebCore::AnimationEffect::timingFunction const): * animation/AnimationEffect.idl: * animation/AnimationEffectTiming.idl: Removed. * animation/AnimationEffectTimingReadOnly.cpp: Removed. * animation/AnimationEffectTimingReadOnly.h: Removed. * animation/AnimationEffectTimingReadOnly.idl: Removed. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/CSSTransition.cpp: (WebCore::CSSTransition::setTimingProperties): * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DocumentTimeline.cpp: * animation/EffectTiming.idl: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): * animation/KeyframeEffect.h: * animation/OptionalEffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTiming.h. * animation/OptionalEffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTiming.cpp. * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectTimingDidChange): (WebCore::WebAnimation::updatePlaybackRate): * animation/WebAnimation.h: (WebCore::WebAnimation::isRelevant const): * bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp: Removed. * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/206102@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 11:15:30 +00:00
#include "WebAnimationUtilities.h"
[Web Animations] Add basic timing and target properties https://bugs.webkit.org/show_bug.cgi?id=178674 Patch by Antoine Quint <graouts@apple.com> on 2017-10-24 Reviewed by Dean Jackson. Source/WebCore: We add three new interfaces to expose enough properties to establish basic timing properties, a start time and duration, and the target of an animation. The startTime property is set on the Animation object, the target is set on the KeyframeEffect set as the effect property on the Animation object, and the duration is set on the AnimationEffectTiming set on the effect. Tests: webanimations/animation-effect-timing.html webanimations/animation-effect.html webanimations/animation-interface-effect-property.html webanimations/animation-interface-start-time-property.html webanimations/keyframe-effect-interface-timing-duration.html webanimations/keyframe-effect.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): * animation/AnimationEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. (WebCore::AnimationEffect::isKeyframeEffect const): (WebCore::AnimationEffect::timing const): (WebCore::AnimationEffect::classType const): * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/AnimationEffectTiming.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffectTiming::create): (WebCore::AnimationEffectTiming::AnimationEffectTiming): (WebCore::AnimationEffectTiming::~AnimationEffectTiming): * animation/AnimationEffectTiming.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/AnimationEffectTiming.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffect): * animation/WebAnimation.h: * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectCustom.cpp: Copied from Source/WebCore/animation/WebAnimation.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/WebCoreBuiltinNames.h: LayoutTests: Add new tests to check the behavior of the newly exposed interfaces, constructors and properties. * webanimations/animation-effect-expected.txt: Added. * webanimations/animation-effect-timing-expected.txt: Added. * webanimations/animation-effect-timing.html: Added. * webanimations/animation-effect.html: Added. * webanimations/animation-interface-effect-property-expected.txt: Added. * webanimations/animation-interface-effect-property.html: Added. * webanimations/animation-interface-start-time-property-expected.txt: Added. * webanimations/animation-interface-start-time-property.html: Added. * webanimations/keyframe-effect-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration.html: Added. * webanimations/keyframe-effect.html: Added. Canonical link: https://commits.webkit.org/194879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-24 07:51:59 +00:00
#include <wtf/Forward.h>
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
[Web Animations] Implement getTiming() and updateTiming() https://bugs.webkit.org/show_bug.cgi?id=186511 <rdar://problem/41000677> Reviewed by Dean Jackson. The Web Animations API has been further simplified by removing the AnimationEffectTiming and AnimationEffectTimingReadOnly interfaces, removing the "timing" property on AnimationEffect replacing it with getTiming() and updateTiming() methods. This does not change the features of the API but simply how they are exposed. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::transformedProgress const): (WebCore::AnimationEffect::getTiming): (WebCore::AnimationEffect::getComputedTiming): (WebCore::AnimationEffect::updateTiming): (WebCore::AnimationEffect::setIterationStart): (WebCore::AnimationEffect::setIterations): (WebCore::AnimationEffect::endTime const): (WebCore::AnimationEffect::setDelay): (WebCore::AnimationEffect::setEndDelay): (WebCore::AnimationEffect::setFill): (WebCore::AnimationEffect::setIterationDuration): (WebCore::AnimationEffect::setDirection): (WebCore::AnimationEffect::setTimingFunction): (WebCore::AnimationEffect::activeDuration const): * animation/AnimationEffect.h: (WebCore::AnimationEffect::delay const): (WebCore::AnimationEffect::endDelay const): (WebCore::AnimationEffect::fill const): (WebCore::AnimationEffect::iterationStart const): (WebCore::AnimationEffect::iterations const): (WebCore::AnimationEffect::iterationDuration const): (WebCore::AnimationEffect::direction const): (WebCore::AnimationEffect::timingFunction const): * animation/AnimationEffect.idl: * animation/AnimationEffectTiming.idl: Removed. * animation/AnimationEffectTimingReadOnly.cpp: Removed. * animation/AnimationEffectTimingReadOnly.h: Removed. * animation/AnimationEffectTimingReadOnly.idl: Removed. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/CSSTransition.cpp: (WebCore::CSSTransition::setTimingProperties): * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DocumentTimeline.cpp: * animation/EffectTiming.idl: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): * animation/KeyframeEffect.h: * animation/OptionalEffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTiming.h. * animation/OptionalEffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTiming.cpp. * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectTimingDidChange): (WebCore::WebAnimation::updatePlaybackRate): * animation/WebAnimation.h: (WebCore::WebAnimation::isRelevant const): * bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp: Removed. * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/206102@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 11:15:30 +00:00
#include <wtf/Seconds.h>
#include <wtf/Variant.h>
[Web Animations] Querying the current time of a finished CSSAnimation after removing its target leads to a crash https://bugs.webkit.org/show_bug.cgi?id=187906 Reviewed by Dean Jackson. Source/WebCore: Test: webanimations/accessing-current-time-after-finished-css-animation-target-removal.html Because we carelessly look at a CSSAnimation's effect's timing in DeclarativeAnimation::bindingsCurrentTime without checking that the effect is non-null, we can crash in the case where the animation is finished and its target element has been removed, which caused the effect to be set to null. We do not actually fix the lack of a null check, which will be the scope of a different patch, but instead ensure that we do _not_ set the animation's effect to null when its target is removed, which used to be performed via a call to WebAnimation::remove(). Instead, we introduce AnimationTimeline::elementWasRemoved() which notifies the timeline of an element being removed such that we may stop referencing any animation targeting this element from the various data structures holding strong references to the animation in question, and we then cancel the animation silently, which is a new option that ensures promises aren't resolved or rejected as a result. Finally, the WebAnimation and AnimationEffectReadOnly classes established a ref-cycle as WebAnimation has `RefPtr<AnimationEffectReadOnly> m_effect` and AnimationEffectReadOnly has `RefPtr<WebAnimation> m_animation`. While it is correct that WebAnimation owns its effect, which is established by the DOM API, the reverse is not correct since we only hold the reverse internally for the benefit of our implementation. As such, we change AnimationEffectReadOnly's m_animation to be a WeakPtr<WebAnimation>. This means not calling WebAnimation::remove() and simply removing the animation from the animation maps on the timeline is sufficient to guarantee that the document timeline will not leak (and with it the document). * animation/AnimationEffectReadOnly.h: (WebCore::AnimationEffectReadOnly::setAnimation): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::elementWasRemoved): * animation/AnimationTimeline.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::cancel): (WebCore::WebAnimation::resetPendingTasks): * animation/WebAnimation.h: * dom/Element.cpp: (WebCore::Element::removedFromAncestor): * rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::tearDownRenderers): LayoutTests: Add a new test that checks the behavior of a CSSAnimation instance after its completion and removal of its target. * webanimations/accessing-current-time-after-finished-css-animation-target-removal-expected.txt: Added. * webanimations/accessing-current-time-after-finished-css-animation-target-removal.html: Added. Canonical link: https://commits.webkit.org/203089@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234109 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-07-23 20:23:18 +00:00
#include <wtf/WeakPtr.h>
[Web Animations] Add basic timing and target properties https://bugs.webkit.org/show_bug.cgi?id=178674 Patch by Antoine Quint <graouts@apple.com> on 2017-10-24 Reviewed by Dean Jackson. Source/WebCore: We add three new interfaces to expose enough properties to establish basic timing properties, a start time and duration, and the target of an animation. The startTime property is set on the Animation object, the target is set on the KeyframeEffect set as the effect property on the Animation object, and the duration is set on the AnimationEffectTiming set on the effect. Tests: webanimations/animation-effect-timing.html webanimations/animation-effect.html webanimations/animation-interface-effect-property.html webanimations/animation-interface-start-time-property.html webanimations/keyframe-effect-interface-timing-duration.html webanimations/keyframe-effect.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): * animation/AnimationEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. (WebCore::AnimationEffect::isKeyframeEffect const): (WebCore::AnimationEffect::timing const): (WebCore::AnimationEffect::classType const): * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/AnimationEffectTiming.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffectTiming::create): (WebCore::AnimationEffectTiming::AnimationEffectTiming): (WebCore::AnimationEffectTiming::~AnimationEffectTiming): * animation/AnimationEffectTiming.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/AnimationEffectTiming.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffect): * animation/WebAnimation.h: * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectCustom.cpp: Copied from Source/WebCore/animation/WebAnimation.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/WebCoreBuiltinNames.h: LayoutTests: Add new tests to check the behavior of the newly exposed interfaces, constructors and properties. * webanimations/animation-effect-expected.txt: Added. * webanimations/animation-effect-timing-expected.txt: Added. * webanimations/animation-effect-timing.html: Added. * webanimations/animation-effect.html: Added. * webanimations/animation-interface-effect-property-expected.txt: Added. * webanimations/animation-interface-effect-property.html: Added. * webanimations/animation-interface-start-time-property-expected.txt: Added. * webanimations/animation-interface-start-time-property.html: Added. * webanimations/keyframe-effect-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration.html: Added. * webanimations/keyframe-effect.html: Added. Canonical link: https://commits.webkit.org/194879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-24 07:51:59 +00:00
namespace WebCore {
[Web Animations] Use a keyframe effect stack to resolve animations on an element https://bugs.webkit.org/show_bug.cgi?id=204010 Reviewed by Dean Jackson. Until now, when resolving animations for an element, we would call animationsForElement() during each resolution which means doing several hash table lookups to locate the various classes of animations for that given element, sorting each of those animations and inserting them into a new Vector. We now use a KeyframeEffectStack which keeps a list of KeyframeEffect objects that apply to a given target, provided the effect also has a valid animation and that animation has a valid timeline, all pre-conditions for that effect to produce an animated value. Any time one of those pre-conditions change, we update the membership of that effect in the stack. The KeyframeEffectStack is a new member of ElementRareData. Now, each time we resolve an animation for an element, we iterate over the KeyframeEffect objects returned by calling sortEffects() on the KeyframeEffectStack which will sort the stack's effects only if a new effect had been added since the last iteration, which means that simple animations that are not mutated will require sorting of the stack just once, and the addition of several animations in a single animation frame will require sorting just once as well. It was also found while doing this work that Style::TreeResolver::createAnimatedElementUpdate would call RenderStyle::clonePtr() for any element that was part of a document containing a timeline, regardless of whether that element had any animations. Now we check whether that element's KeyframeEffectStack contains any effects prior to cloning the style. No tests or changes to existed test expectations as this should not yield any change in behavior. * Sources.txt: Add the new KeyframeEffectStack. * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.h: (WebCore::AnimationEffect::setAnimation): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Since we need to know the order of CSS @keyframes rules listed in animation-name when sorting effects, we must compile the ordered list of those @keyframe rules as we update CSS animations for an element and store it on its KeyframeEffectStack. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::resolveAnimationsForElement): Deleted. Replaced by Element::applyKeyframeEffects(). * animation/DocumentTimeline.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::animationTimelineDidChange): (WebCore::KeyframeEffect::setAnimation): (WebCore::KeyframeEffect::setTarget): * animation/KeyframeEffect.h: * animation/KeyframeEffectStack.cpp: Added. (WebCore::KeyframeEffectStack::KeyframeEffectStack): (WebCore::KeyframeEffectStack::~KeyframeEffectStack): (WebCore::KeyframeEffectStack::addEffect): (WebCore::KeyframeEffectStack::removeEffect): (WebCore::KeyframeEffectStack::sortedEffects): (WebCore::KeyframeEffectStack::ensureEffectsAreSorted): (WebCore::KeyframeEffectStack::setCSSAnimationNames): * animation/KeyframeEffectStack.h: Added. (WebCore::KeyframeEffectStack::hasEffects const): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setTimelineInternal): (WebCore::WebAnimation::persist): * dom/Element.cpp: (WebCore::Element::ensureKeyframeEffectStack): (WebCore::Element::hasKeyframeEffects const): (WebCore::Element::applyKeyframeEffects): * dom/Element.h: * dom/ElementRareData.cpp: * dom/ElementRareData.h: (WebCore::ElementRareData::keyframeEffectStack): (WebCore::ElementRareData::setKeyframeEffectStack): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Canonical link: https://commits.webkit.org/217343@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-08 20:40:57 +00:00
class AnimationEffect : public RefCounted<AnimationEffect>, public CanMakeWeakPtr<AnimationEffect> {
[Web Animations] Add basic timing and target properties https://bugs.webkit.org/show_bug.cgi?id=178674 Patch by Antoine Quint <graouts@apple.com> on 2017-10-24 Reviewed by Dean Jackson. Source/WebCore: We add three new interfaces to expose enough properties to establish basic timing properties, a start time and duration, and the target of an animation. The startTime property is set on the Animation object, the target is set on the KeyframeEffect set as the effect property on the Animation object, and the duration is set on the AnimationEffectTiming set on the effect. Tests: webanimations/animation-effect-timing.html webanimations/animation-effect.html webanimations/animation-interface-effect-property.html webanimations/animation-interface-start-time-property.html webanimations/keyframe-effect-interface-timing-duration.html webanimations/keyframe-effect.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): * animation/AnimationEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. (WebCore::AnimationEffect::isKeyframeEffect const): (WebCore::AnimationEffect::timing const): (WebCore::AnimationEffect::classType const): * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/AnimationEffectTiming.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffectTiming::create): (WebCore::AnimationEffectTiming::AnimationEffectTiming): (WebCore::AnimationEffectTiming::~AnimationEffectTiming): * animation/AnimationEffectTiming.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/AnimationEffectTiming.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffect): * animation/WebAnimation.h: * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectCustom.cpp: Copied from Source/WebCore/animation/WebAnimation.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/WebCoreBuiltinNames.h: LayoutTests: Add new tests to check the behavior of the newly exposed interfaces, constructors and properties. * webanimations/animation-effect-expected.txt: Added. * webanimations/animation-effect-timing-expected.txt: Added. * webanimations/animation-effect-timing.html: Added. * webanimations/animation-effect.html: Added. * webanimations/animation-interface-effect-property-expected.txt: Added. * webanimations/animation-interface-effect-property.html: Added. * webanimations/animation-interface-start-time-property-expected.txt: Added. * webanimations/animation-interface-start-time-property.html: Added. * webanimations/keyframe-effect-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration.html: Added. * webanimations/keyframe-effect.html: Added. Canonical link: https://commits.webkit.org/194879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-24 07:51:59 +00:00
public:
[Web Animations] Update the Web Animations API to remove all the ReadOnly interfaces https://bugs.webkit.org/show_bug.cgi?id=186512 <rdar://problem/41000691> Reviewed by Dean Jackson. The Web Animations API has been simplified by removing its various ReadOnly interfaces. In this patch, we make the following changes, not adding code but merely merging and renaming files: - AnimationEffectReadOnly and AnimationEffect are now a single AnimationEffect interface - KeyframeEffectReadOnly and KeyframeEffect are now a single KeyframeEffect interface - ComputedTimingProperties is now named ComputedEffectTiming - AnimationEffectTimingProperties is now named EffectTiming * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: Renamed from Source/WebCore/animation/AnimationEffectReadOnly.cpp. (WebCore::AnimationEffect::~AnimationEffect): (WebCore::AnimationEffect::timingDidChange): (WebCore::AnimationEffect::localTime const): (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::directedProgress const): (WebCore::AnimationEffect::transformedProgress const): (WebCore::AnimationEffect::iterationProgress const): (WebCore::AnimationEffect::getComputedTiming): * animation/AnimationEffect.h: Renamed from Source/WebCore/animation/AnimationEffectReadOnly.h. (WebCore::AnimationEffect::isKeyframeEffect const): * animation/AnimationEffect.idl: Renamed from Source/WebCore/animation/AnimationEffectReadOnly.idl. * animation/AnimationEffectTimingReadOnly.cpp: * animation/AnimationEffectTimingReadOnly.h: (WebCore::AnimationEffectTimingReadOnly::setEffect): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::cssAnimationForElementAndProperty): * animation/CSSTransition.cpp: * animation/ComputedEffectTiming.h: Renamed from Source/WebCore/animation/ComputedTimingProperties.h. * animation/ComputedEffectTiming.idl: Renamed from Source/WebCore/animation/ComputedTimingProperties.idl. * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::initialize): (WebCore::DeclarativeAnimation::flushPendingStyleChanges const): (WebCore::DeclarativeAnimation::phaseWithoutEffect const): (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DeclarativeAnimation.h: * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::getAnimations const): (WebCore::DocumentTimeline::transitionDidComplete): (WebCore::DocumentTimeline::computeExtentOfAnimation const): (WebCore::DocumentTimeline::isRunningAnimationOnRenderer const): (WebCore::DocumentTimeline::isRunningAcceleratedAnimationOnRenderer const): (WebCore::DocumentTimeline::animatedStyleForRenderer): (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange): (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement): (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations): (WebCore::DocumentTimeline::resolveAnimationsForElement): * animation/EffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTimingProperties.h. * animation/EffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTimingProperties.idl. * animation/KeyframeEffect.cpp: (WebCore::invalidateElement): (WebCore::CSSPropertyIDToIDLAttributeName): (WebCore::IDLAttributeNameToAnimationPropertyName): (WebCore::computeMissingKeyframeOffsets): (WebCore::processKeyframeLikeObject): (WebCore::processIterableKeyframes): (WebCore::processPropertyIndexedKeyframes): (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::getKeyframes): (WebCore::KeyframeEffect::processKeyframes): (WebCore::KeyframeEffect::updateBlendingKeyframes): (WebCore::KeyframeEffect::forceLayoutIfNeeded): (WebCore::KeyframeEffect::setBlendingKeyframes): (WebCore::KeyframeEffect::checkForMatchingTransformFunctionLists): (WebCore::KeyframeEffect::checkForMatchingFilterFunctionLists const): (WebCore::KeyframeEffect::checkForMatchingFilterFunctionLists): (WebCore::KeyframeEffect::checkForMatchingBackdropFilterFunctionLists): (WebCore::KeyframeEffect::checkForMatchingColorFilterFunctionLists): (WebCore::KeyframeEffect::computeDeclarativeAnimationBlendingKeyframes): (WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes): (WebCore::KeyframeEffect::computeCSSTransitionBlendingKeyframes): (WebCore::KeyframeEffect::computedNeedsForcedLayout): (WebCore::KeyframeEffect::computeStackingContextImpact): (WebCore::KeyframeEffect::setTarget): (WebCore::KeyframeEffect::apply): (WebCore::KeyframeEffect::invalidate): (WebCore::KeyframeEffect::computeShouldRunAccelerated): (WebCore::KeyframeEffect::getAnimatedStyle): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::timingFunctionForKeyframeAtIndex): (WebCore::KeyframeEffect::updateAcceleratedAnimationState): (WebCore::KeyframeEffect::addPendingAcceleratedAction): (WebCore::KeyframeEffect::animationDidSeek): (WebCore::KeyframeEffect::animationSuspensionStateDidChange): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): (WebCore::KeyframeEffect::renderer const): (WebCore::KeyframeEffect::currentStyle const): (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const): (WebCore::containsRotation): (WebCore::KeyframeEffect::computeTransformedExtentViaTransformList const): (WebCore::KeyframeEffect::computeTransformedExtentViaMatrix const): * animation/KeyframeEffect.h: (WebCore::KeyframeEffect::ParsedKeyframe::ParsedKeyframe): (WebCore::KeyframeEffect::target const): (WebCore::KeyframeEffect::iterationComposite const): (WebCore::KeyframeEffect::composite const): (WebCore::KeyframeEffect::isRunningAccelerated const): (WebCore::KeyframeEffect::hasPendingAcceleratedAction const): (WebCore::KeyframeEffect::hasBlendingKeyframes const): (WebCore::KeyframeEffect::animatedProperties const): * animation/KeyframeEffect.idl: * animation/KeyframeEffectOptions.h: * animation/KeyframeEffectOptions.idl: * animation/KeyframeEffectReadOnly.cpp: Removed. * animation/KeyframeEffectReadOnly.h: Removed. * animation/KeyframeEffectReadOnly.idl: Removed. * animation/WebAnimation.cpp: (WebCore::WebAnimation::create): (WebCore::WebAnimation::setEffect): (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::applyPendingAcceleratedActions): (WebCore::WebAnimation::computeRelevance): * animation/WebAnimation.h: (WebCore::WebAnimation::effect const): * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectCustom.cpp: Renamed from Source/WebCore/bindings/js/JSAnimationEffectReadOnlyCustom.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSWebAnimationCustom.cpp: (WebCore::constructJSWebAnimation): * bindings/js/WebCoreBuiltinNames.h: * dom/Document.cpp: Canonical link: https://commits.webkit.org/206101@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237852 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 11:15:15 +00:00
virtual ~AnimationEffect();
[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: Canonical link: https://commits.webkit.org/195776@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224897 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-15 21:35:38 +00:00
[Web Animations] Update the Web Animations API to remove all the ReadOnly interfaces https://bugs.webkit.org/show_bug.cgi?id=186512 <rdar://problem/41000691> Reviewed by Dean Jackson. The Web Animations API has been simplified by removing its various ReadOnly interfaces. In this patch, we make the following changes, not adding code but merely merging and renaming files: - AnimationEffectReadOnly and AnimationEffect are now a single AnimationEffect interface - KeyframeEffectReadOnly and KeyframeEffect are now a single KeyframeEffect interface - ComputedTimingProperties is now named ComputedEffectTiming - AnimationEffectTimingProperties is now named EffectTiming * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: Renamed from Source/WebCore/animation/AnimationEffectReadOnly.cpp. (WebCore::AnimationEffect::~AnimationEffect): (WebCore::AnimationEffect::timingDidChange): (WebCore::AnimationEffect::localTime const): (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::directedProgress const): (WebCore::AnimationEffect::transformedProgress const): (WebCore::AnimationEffect::iterationProgress const): (WebCore::AnimationEffect::getComputedTiming): * animation/AnimationEffect.h: Renamed from Source/WebCore/animation/AnimationEffectReadOnly.h. (WebCore::AnimationEffect::isKeyframeEffect const): * animation/AnimationEffect.idl: Renamed from Source/WebCore/animation/AnimationEffectReadOnly.idl. * animation/AnimationEffectTimingReadOnly.cpp: * animation/AnimationEffectTimingReadOnly.h: (WebCore::AnimationEffectTimingReadOnly::setEffect): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::cssAnimationForElementAndProperty): * animation/CSSTransition.cpp: * animation/ComputedEffectTiming.h: Renamed from Source/WebCore/animation/ComputedTimingProperties.h. * animation/ComputedEffectTiming.idl: Renamed from Source/WebCore/animation/ComputedTimingProperties.idl. * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::initialize): (WebCore::DeclarativeAnimation::flushPendingStyleChanges const): (WebCore::DeclarativeAnimation::phaseWithoutEffect const): (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DeclarativeAnimation.h: * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::getAnimations const): (WebCore::DocumentTimeline::transitionDidComplete): (WebCore::DocumentTimeline::computeExtentOfAnimation const): (WebCore::DocumentTimeline::isRunningAnimationOnRenderer const): (WebCore::DocumentTimeline::isRunningAcceleratedAnimationOnRenderer const): (WebCore::DocumentTimeline::animatedStyleForRenderer): (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange): (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement): (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations): (WebCore::DocumentTimeline::resolveAnimationsForElement): * animation/EffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTimingProperties.h. * animation/EffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTimingProperties.idl. * animation/KeyframeEffect.cpp: (WebCore::invalidateElement): (WebCore::CSSPropertyIDToIDLAttributeName): (WebCore::IDLAttributeNameToAnimationPropertyName): (WebCore::computeMissingKeyframeOffsets): (WebCore::processKeyframeLikeObject): (WebCore::processIterableKeyframes): (WebCore::processPropertyIndexedKeyframes): (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::getKeyframes): (WebCore::KeyframeEffect::processKeyframes): (WebCore::KeyframeEffect::updateBlendingKeyframes): (WebCore::KeyframeEffect::forceLayoutIfNeeded): (WebCore::KeyframeEffect::setBlendingKeyframes): (WebCore::KeyframeEffect::checkForMatchingTransformFunctionLists): (WebCore::KeyframeEffect::checkForMatchingFilterFunctionLists const): (WebCore::KeyframeEffect::checkForMatchingFilterFunctionLists): (WebCore::KeyframeEffect::checkForMatchingBackdropFilterFunctionLists): (WebCore::KeyframeEffect::checkForMatchingColorFilterFunctionLists): (WebCore::KeyframeEffect::computeDeclarativeAnimationBlendingKeyframes): (WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes): (WebCore::KeyframeEffect::computeCSSTransitionBlendingKeyframes): (WebCore::KeyframeEffect::computedNeedsForcedLayout): (WebCore::KeyframeEffect::computeStackingContextImpact): (WebCore::KeyframeEffect::setTarget): (WebCore::KeyframeEffect::apply): (WebCore::KeyframeEffect::invalidate): (WebCore::KeyframeEffect::computeShouldRunAccelerated): (WebCore::KeyframeEffect::getAnimatedStyle): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::timingFunctionForKeyframeAtIndex): (WebCore::KeyframeEffect::updateAcceleratedAnimationState): (WebCore::KeyframeEffect::addPendingAcceleratedAction): (WebCore::KeyframeEffect::animationDidSeek): (WebCore::KeyframeEffect::animationSuspensionStateDidChange): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): (WebCore::KeyframeEffect::renderer const): (WebCore::KeyframeEffect::currentStyle const): (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const): (WebCore::containsRotation): (WebCore::KeyframeEffect::computeTransformedExtentViaTransformList const): (WebCore::KeyframeEffect::computeTransformedExtentViaMatrix const): * animation/KeyframeEffect.h: (WebCore::KeyframeEffect::ParsedKeyframe::ParsedKeyframe): (WebCore::KeyframeEffect::target const): (WebCore::KeyframeEffect::iterationComposite const): (WebCore::KeyframeEffect::composite const): (WebCore::KeyframeEffect::isRunningAccelerated const): (WebCore::KeyframeEffect::hasPendingAcceleratedAction const): (WebCore::KeyframeEffect::hasBlendingKeyframes const): (WebCore::KeyframeEffect::animatedProperties const): * animation/KeyframeEffect.idl: * animation/KeyframeEffectOptions.h: * animation/KeyframeEffectOptions.idl: * animation/KeyframeEffectReadOnly.cpp: Removed. * animation/KeyframeEffectReadOnly.h: Removed. * animation/KeyframeEffectReadOnly.idl: Removed. * animation/WebAnimation.cpp: (WebCore::WebAnimation::create): (WebCore::WebAnimation::setEffect): (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::applyPendingAcceleratedActions): (WebCore::WebAnimation::computeRelevance): * animation/WebAnimation.h: (WebCore::WebAnimation::effect const): * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectCustom.cpp: Renamed from Source/WebCore/bindings/js/JSAnimationEffectReadOnlyCustom.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSWebAnimationCustom.cpp: (WebCore::constructJSWebAnimation): * bindings/js/WebCoreBuiltinNames.h: * dom/Document.cpp: Canonical link: https://commits.webkit.org/206101@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237852 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 11:15:15 +00:00
virtual bool isKeyframeEffect() const { return false; }
[Web Animations] Implement getTiming() and updateTiming() https://bugs.webkit.org/show_bug.cgi?id=186511 <rdar://problem/41000677> Reviewed by Dean Jackson. The Web Animations API has been further simplified by removing the AnimationEffectTiming and AnimationEffectTimingReadOnly interfaces, removing the "timing" property on AnimationEffect replacing it with getTiming() and updateTiming() methods. This does not change the features of the API but simply how they are exposed. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::transformedProgress const): (WebCore::AnimationEffect::getTiming): (WebCore::AnimationEffect::getComputedTiming): (WebCore::AnimationEffect::updateTiming): (WebCore::AnimationEffect::setIterationStart): (WebCore::AnimationEffect::setIterations): (WebCore::AnimationEffect::endTime const): (WebCore::AnimationEffect::setDelay): (WebCore::AnimationEffect::setEndDelay): (WebCore::AnimationEffect::setFill): (WebCore::AnimationEffect::setIterationDuration): (WebCore::AnimationEffect::setDirection): (WebCore::AnimationEffect::setTimingFunction): (WebCore::AnimationEffect::activeDuration const): * animation/AnimationEffect.h: (WebCore::AnimationEffect::delay const): (WebCore::AnimationEffect::endDelay const): (WebCore::AnimationEffect::fill const): (WebCore::AnimationEffect::iterationStart const): (WebCore::AnimationEffect::iterations const): (WebCore::AnimationEffect::iterationDuration const): (WebCore::AnimationEffect::direction const): (WebCore::AnimationEffect::timingFunction const): * animation/AnimationEffect.idl: * animation/AnimationEffectTiming.idl: Removed. * animation/AnimationEffectTimingReadOnly.cpp: Removed. * animation/AnimationEffectTimingReadOnly.h: Removed. * animation/AnimationEffectTimingReadOnly.idl: Removed. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/CSSTransition.cpp: (WebCore::CSSTransition::setTimingProperties): * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DocumentTimeline.cpp: * animation/EffectTiming.idl: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): * animation/KeyframeEffect.h: * animation/OptionalEffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTiming.h. * animation/OptionalEffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTiming.cpp. * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectTimingDidChange): (WebCore::WebAnimation::updatePlaybackRate): * animation/WebAnimation.h: (WebCore::WebAnimation::isRelevant const): * bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp: Removed. * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/206102@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 11:15:30 +00:00
[Web Animations] Ensure calling Web Animations APIs override future CSS Animations style properties https://bugs.webkit.org/show_bug.cgi?id=210988 Reviewed by Dean Jackson. LayoutTests/imported/w3c: Mark all WPT tests related to Web Animations APIs overrides for CSS Animations as PASS, save for one failing assertion which is caused by AnimationTimeline::updateCSSAnimations() not updating the animation when the underlying @keyframes rule changed. This is due to Animation::animationsMatch() not checking on the actual keyframes, tracked by webkit.org/b/210989. * web-platform-tests/css/css-animations/AnimationEffect-updateTiming.tentative-expected.txt: * web-platform-tests/css/css-animations/CSSAnimation-effect.tentative-expected.txt: * web-platform-tests/css/css-animations/CSSAnimation-pausing.tentative-expected.txt: * web-platform-tests/css/css-animations/KeyframeEffect-setKeyframes.tentative-expected.txt: Source/WebCore: The CSS Animations Level 2 spec specifies how the Web Animations APIs and the CSS Animations style properties should interact in https://drafts.csswg.org/css-animations-2/#animations. This patch implements the specified behavior and this is reflected by progress on the relevant WPT tests. The gist of this change is that once a Web Animations API is called on an animation created using CSS Animations, any changes made to related CSS Animations style properties on the target element will be ignored so that the overrides applied via the Web Animations API remain in effect. For instance, calling pause() or play() in a way that changes the playback state of the CSS Animation will mean that future changes to the CSS animation-play-state property are ignored. To do this we make more IDL properties and methods use dedicated methods to distinguish between the bindings entry-point and internal usage of the same methods to integrate the behavior only when the API itself is being used. * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::getBindingsTiming const): Ensure we flush styles when animation.effect.getTiming() is called. (WebCore::AnimationEffect::getBindingsComputedTiming const): Ensure we flush styles when animation.effect.getComputedTiming() is called. (WebCore::AnimationEffect::bindingsUpdateTiming): Notify the associated CSSAnimation object, if any, when animation.effect.updateTiming() is called such that the CSSAnimation may apply the relevant overrides. * animation/AnimationEffect.h: * animation/AnimationEffect.idl: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Only apply new values of CSS Animations style properties if there are no overrides for them resulting from calling related Web Animations APIs. (WebCore::CSSAnimation::bindingsPlay): Mark animation-play-state as overridden if play() is called. (WebCore::CSSAnimation::bindingsPause): Mark animation-play-state as overridden if pause() is called. (WebCore::CSSAnimation::setBindingsEffect): Mark all animation style properties, except for animation-name and animation-play-state as overridden if animation.effect is set. (WebCore::CSSAnimation::setBindingsStartTime): Mark animation-play-state as overridden if animation.startTime is set. (WebCore::CSSAnimation::bindingsReverse): Mark animation-play-state as overridden if reverse() is called. (WebCore::CSSAnimation::effectTimingWasUpdatedUsingBindings): Mark each CSS property associated with a key found on the timing object passed to animation.effect.updateTiming() as overridden. (WebCore::CSSAnimation::effectKeyframesWereSetUsingBindings): Mark animation-timing-function as overridden if animation.effect.setKeyframes() is called. * animation/CSSAnimation.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::bindingsStartTime const): (WebCore::DeclarativeAnimation::setBindingsStartTime): (WebCore::DeclarativeAnimation::startTime const): Deleted. (WebCore::DeclarativeAnimation::setStartTime): Deleted. * animation/DeclarativeAnimation.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::getBindingsKeyframes): Ensure we flush styles when animation.effect.getKeyframes() is called. (WebCore::KeyframeEffect::getKeyframes): Only use the CSS-originated animation path if we don't have JS-originated keyframes. (WebCore::KeyframeEffect::setBindingsKeyframes): Notify the associated CSSAnimation object, if any, when animation.effect.setKeyframes() is called such that the CSSAnimation may apply the relevant overrides. (WebCore::KeyframeEffect::processKeyframes): Correctly return early if part of the processing yields an exception. * animation/KeyframeEffect.h: * animation/KeyframeEffect.idl: * animation/WebAnimation.cpp: (WebCore::WebAnimation::setBindingsEffect): (WebCore::WebAnimation::setBindingsStartTime): (WebCore::WebAnimation::bindingsReverse): * animation/WebAnimation.h: (WebCore::WebAnimation::bindingsEffect const): (WebCore::WebAnimation::bindingsStartTime const): * animation/WebAnimation.idl: Canonical link: https://commits.webkit.org/223879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260671 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-24 21:42:50 +00:00
EffectTiming getBindingsTiming() const;
[Web Animations] Compute animation effect timing properties in batch https://bugs.webkit.org/show_bug.cgi?id=192850 Reviewed by Dean Jackson. We remove a host of functions from AnimationEffect that would allow the computation of various timing properties defined by the Web Animations specification: phase, progress, current iteration, etc. Indeed, a lot of these functions would call each other in a chain, and we would re-compute a lot of the earlier properties in those chains several times when doing something like querying the animation progress. Additionally, some functions, such as WebAnimation::computeRelevance() and WebAnimation::timeToNextTick() would yield the computation of several such properties numerous times. All of those functions are called during each animation frame and are ripe for optimizations. We now compute all timing properties across two functions: 1. the new AnimationEffect::getBasicTiming() which computes the local time, end time, active duration, active time and phase, 2. the existing AnimationEffect::getComputedTiming() which now also exposes the phase and simple iteration progress. To support this we introduce a new BasicEffectTiming struct to contain the values computed in AnimationEffect::getBasicTiming() and spun the AnimationEffect::Phase struct as AnimationEffectPhase so that it may be used across BasicEffectTiming and ComputedEffectTiming. No new test since there is no user-observable change. * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::getTiming const): (WebCore::AnimationEffect::getBasicTiming const): (WebCore::AnimationEffect::getComputedTiming const): (WebCore::AnimationEffect::localTime const): Deleted. (WebCore::AnimationEffect::phase const): Deleted. (WebCore::AnimationEffect::activeTime const): Deleted. (WebCore::AnimationEffect::overallProgress const): Deleted. (WebCore::AnimationEffect::simpleIterationProgress const): Deleted. (WebCore::AnimationEffect::currentIteration const): Deleted. (WebCore::AnimationEffect::currentDirection const): Deleted. (WebCore::AnimationEffect::directedProgress const): Deleted. (WebCore::AnimationEffect::transformedProgress const): Deleted. (WebCore::AnimationEffect::iterationProgress const): Deleted. (WebCore::AnimationEffect::getTiming): Deleted. (WebCore::AnimationEffect::getComputedTiming): Deleted. (WebCore::AnimationEffect::endTime const): Deleted. (WebCore::AnimationEffect::activeDuration const): Deleted. * animation/AnimationEffect.h: * animation/AnimationEffectPhase.h: Copied from Source/WebCore/animation/ComputedEffectTiming.h. * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::updateCSSTransitionsForElement): * animation/AnimationTimeline.h: * animation/BasicEffectTiming.h: Copied from Source/WebCore/animation/ComputedEffectTiming.h. * animation/ComputedEffectTiming.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::cancel): (WebCore::DeclarativeAnimation::phaseWithoutEffect const): (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DeclarativeAnimation.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::apply): (WebCore::KeyframeEffect::getAnimatedStyle): * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectEndTime const): (WebCore::WebAnimation::computeRelevance): (WebCore::WebAnimation::timeToNextTick const): Canonical link: https://commits.webkit.org/207736@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239723 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-08 11:31:55 +00:00
EffectTiming getTiming() const;
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
BasicEffectTiming getBasicTiming(std::optional<Seconds> = std::nullopt) const;
[Web Animations] Ensure calling Web Animations APIs override future CSS Animations style properties https://bugs.webkit.org/show_bug.cgi?id=210988 Reviewed by Dean Jackson. LayoutTests/imported/w3c: Mark all WPT tests related to Web Animations APIs overrides for CSS Animations as PASS, save for one failing assertion which is caused by AnimationTimeline::updateCSSAnimations() not updating the animation when the underlying @keyframes rule changed. This is due to Animation::animationsMatch() not checking on the actual keyframes, tracked by webkit.org/b/210989. * web-platform-tests/css/css-animations/AnimationEffect-updateTiming.tentative-expected.txt: * web-platform-tests/css/css-animations/CSSAnimation-effect.tentative-expected.txt: * web-platform-tests/css/css-animations/CSSAnimation-pausing.tentative-expected.txt: * web-platform-tests/css/css-animations/KeyframeEffect-setKeyframes.tentative-expected.txt: Source/WebCore: The CSS Animations Level 2 spec specifies how the Web Animations APIs and the CSS Animations style properties should interact in https://drafts.csswg.org/css-animations-2/#animations. This patch implements the specified behavior and this is reflected by progress on the relevant WPT tests. The gist of this change is that once a Web Animations API is called on an animation created using CSS Animations, any changes made to related CSS Animations style properties on the target element will be ignored so that the overrides applied via the Web Animations API remain in effect. For instance, calling pause() or play() in a way that changes the playback state of the CSS Animation will mean that future changes to the CSS animation-play-state property are ignored. To do this we make more IDL properties and methods use dedicated methods to distinguish between the bindings entry-point and internal usage of the same methods to integrate the behavior only when the API itself is being used. * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::getBindingsTiming const): Ensure we flush styles when animation.effect.getTiming() is called. (WebCore::AnimationEffect::getBindingsComputedTiming const): Ensure we flush styles when animation.effect.getComputedTiming() is called. (WebCore::AnimationEffect::bindingsUpdateTiming): Notify the associated CSSAnimation object, if any, when animation.effect.updateTiming() is called such that the CSSAnimation may apply the relevant overrides. * animation/AnimationEffect.h: * animation/AnimationEffect.idl: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Only apply new values of CSS Animations style properties if there are no overrides for them resulting from calling related Web Animations APIs. (WebCore::CSSAnimation::bindingsPlay): Mark animation-play-state as overridden if play() is called. (WebCore::CSSAnimation::bindingsPause): Mark animation-play-state as overridden if pause() is called. (WebCore::CSSAnimation::setBindingsEffect): Mark all animation style properties, except for animation-name and animation-play-state as overridden if animation.effect is set. (WebCore::CSSAnimation::setBindingsStartTime): Mark animation-play-state as overridden if animation.startTime is set. (WebCore::CSSAnimation::bindingsReverse): Mark animation-play-state as overridden if reverse() is called. (WebCore::CSSAnimation::effectTimingWasUpdatedUsingBindings): Mark each CSS property associated with a key found on the timing object passed to animation.effect.updateTiming() as overridden. (WebCore::CSSAnimation::effectKeyframesWereSetUsingBindings): Mark animation-timing-function as overridden if animation.effect.setKeyframes() is called. * animation/CSSAnimation.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::bindingsStartTime const): (WebCore::DeclarativeAnimation::setBindingsStartTime): (WebCore::DeclarativeAnimation::startTime const): Deleted. (WebCore::DeclarativeAnimation::setStartTime): Deleted. * animation/DeclarativeAnimation.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::getBindingsKeyframes): Ensure we flush styles when animation.effect.getKeyframes() is called. (WebCore::KeyframeEffect::getKeyframes): Only use the CSS-originated animation path if we don't have JS-originated keyframes. (WebCore::KeyframeEffect::setBindingsKeyframes): Notify the associated CSSAnimation object, if any, when animation.effect.setKeyframes() is called such that the CSSAnimation may apply the relevant overrides. (WebCore::KeyframeEffect::processKeyframes): Correctly return early if part of the processing yields an exception. * animation/KeyframeEffect.h: * animation/KeyframeEffect.idl: * animation/WebAnimation.cpp: (WebCore::WebAnimation::setBindingsEffect): (WebCore::WebAnimation::setBindingsStartTime): (WebCore::WebAnimation::bindingsReverse): * animation/WebAnimation.h: (WebCore::WebAnimation::bindingsEffect const): (WebCore::WebAnimation::bindingsStartTime const): * animation/WebAnimation.idl: Canonical link: https://commits.webkit.org/223879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260671 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-24 21:42:50 +00:00
ComputedEffectTiming getBindingsComputedTiming() const;
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
ComputedEffectTiming getComputedTiming(std::optional<Seconds> = std::nullopt) const;
ExceptionOr<void> bindingsUpdateTiming(std::optional<OptionalEffectTiming>);
ExceptionOr<void> updateTiming(std::optional<OptionalEffectTiming>);
[Web Animations] Implement getTiming() and updateTiming() https://bugs.webkit.org/show_bug.cgi?id=186511 <rdar://problem/41000677> Reviewed by Dean Jackson. The Web Animations API has been further simplified by removing the AnimationEffectTiming and AnimationEffectTimingReadOnly interfaces, removing the "timing" property on AnimationEffect replacing it with getTiming() and updateTiming() methods. This does not change the features of the API but simply how they are exposed. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::transformedProgress const): (WebCore::AnimationEffect::getTiming): (WebCore::AnimationEffect::getComputedTiming): (WebCore::AnimationEffect::updateTiming): (WebCore::AnimationEffect::setIterationStart): (WebCore::AnimationEffect::setIterations): (WebCore::AnimationEffect::endTime const): (WebCore::AnimationEffect::setDelay): (WebCore::AnimationEffect::setEndDelay): (WebCore::AnimationEffect::setFill): (WebCore::AnimationEffect::setIterationDuration): (WebCore::AnimationEffect::setDirection): (WebCore::AnimationEffect::setTimingFunction): (WebCore::AnimationEffect::activeDuration const): * animation/AnimationEffect.h: (WebCore::AnimationEffect::delay const): (WebCore::AnimationEffect::endDelay const): (WebCore::AnimationEffect::fill const): (WebCore::AnimationEffect::iterationStart const): (WebCore::AnimationEffect::iterations const): (WebCore::AnimationEffect::iterationDuration const): (WebCore::AnimationEffect::direction const): (WebCore::AnimationEffect::timingFunction const): * animation/AnimationEffect.idl: * animation/AnimationEffectTiming.idl: Removed. * animation/AnimationEffectTimingReadOnly.cpp: Removed. * animation/AnimationEffectTimingReadOnly.h: Removed. * animation/AnimationEffectTimingReadOnly.idl: Removed. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/CSSTransition.cpp: (WebCore::CSSTransition::setTimingProperties): * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DocumentTimeline.cpp: * animation/EffectTiming.idl: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): * animation/KeyframeEffect.h: * animation/OptionalEffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTiming.h. * animation/OptionalEffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTiming.cpp. * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectTimingDidChange): (WebCore::WebAnimation::updatePlaybackRate): * animation/WebAnimation.h: (WebCore::WebAnimation::isRelevant const): * bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp: Removed. * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/206102@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 11:15:30 +00:00
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
virtual void apply(RenderStyle& targetStyle, const RenderStyle* parentElementStyle, std::optional<Seconds> = std::nullopt) = 0;
[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: Canonical link: https://commits.webkit.org/198602@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228537 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-02-15 23:33:44 +00:00
virtual void invalidate() = 0;
There's an event loop cycle between an animation finishing, and it being removed from GraphicsLayerCA https://bugs.webkit.org/show_bug.cgi?id=207361 <rdar://problem/59280370> Reviewed by Simon Fraser. Source/WebCore: Animations should be removed from GraphicsLayersCAs in the same rendering update that changes the playState of the animation to "finished", to avoid layer flush where a GraphicsLayersCAs has no extent set, but thinks there is an active transform animation. To do this, instead of enqueuing accelerated actions when resolving animations during style resolution, in KeyframeAnimation::apply(), we enqueue them as soon as an animation's current time may have changed: in WebAnimation::tick() and WebAnimation::play() with supporting functions newly exposed on AnimationEffect. Now, accelerated animations are enqueued and applied during the "update animations and send events" procedure. * animation/AnimationEffect.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::apply): (WebCore::KeyframeEffect::updateAcceleratedActions): (WebCore::KeyframeEffect::animationDidTick): (WebCore::KeyframeEffect::animationDidPlay): * animation/KeyframeEffect.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::play): (WebCore::WebAnimation::tick): LayoutTests: Lower the number of frames to wait after an animation completes by one to check that the accelerated animation has been removed to show that we enqueue accelerated actions as part of the "update animations and send events" procedure. * webanimations/accelerated-animation-removal-upon-transition-completion.html: Added. Canonical link: https://commits.webkit.org/220463@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@256181 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-02-10 17:24:49 +00:00
virtual void animationDidTick() = 0;
virtual void animationDidPlay() = 0;
[Web Animations] Calling reverse() on an accelerated animation has no effect https://bugs.webkit.org/show_bug.cgi?id=204717 <rdar://problem/62503582> Patch by Antoine Quint <graouts@apple.com> on 2020-05-13 Reviewed by Dean Jackson. Source/WebCore: Test: webanimations/accelerated-animation-playback-rate.html We completely ignored the playbackRate set on a WebAnimation object when considering whether we could run an accelerated animation. To address this we do several things. First, we now add a playbackRate() on Animation objects such that we can make GraphicsLayerCA aware of the originating WebAnimation's playback rate and use this data to opt out of running CA animations for animations with a playbackRate other than 1 in GraphicsLayerCA::animationCanBeAccelerated(). We'll be looking to add support for variable playback rates for CA animations in https://bugs.webkit.org/show_bug.cgi?id=211839. Then, we make sure to completely replace an accelerated animation whenever one of the properties affected timing would change. Up until now we would onyl do this for a change in the effective currentTime, but this needs to also happen when the current time doesn't change but the animation may have changed playback rate or any of its timing properties that could change the duration of the animation. So we remove the "Seek" command and instead use an "UpdateTiming" command that will remove the existing animation and add a new one. This allows us to remove any notion of seeking in GraphicsLayer since now we'll just create a new animation when its timing attributes changed. This revealed an issue where if we called animationFinished() and startAnimation() on a RenderLayerModelObject in succession, theanimation removal would not occur on the GraphicsLayerCA because we disregarded any pending accelerated action for an animation we knew would be replaced. We now ensure we honor the removal in GraphicsLayerCA::appendToUncommittedAnimations(). * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::updateTiming): * animation/AnimationEffect.h: * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::addPendingAcceleratedAction): (WebCore::KeyframeEffect::animationDidChangeTimingProperties): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): (WebCore::KeyframeEffect::animationDidSeek): Deleted. * animation/KeyframeEffect.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectTimingDidChange): (WebCore::WebAnimation::setCurrentTime): (WebCore::WebAnimation::setPlaybackRate): (WebCore::WebAnimation::updatePlaybackRate): (WebCore::WebAnimation::reverse): * animation/WebAnimation.h: * platform/animation/Animation.h: (WebCore::Animation::playbackRate const): (WebCore::Animation::setPlaybackRate): * platform/graphics/GraphicsLayer.h: (WebCore::GraphicsLayer::pauseAnimation): (WebCore::GraphicsLayer::seekAnimation): Deleted. * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::animationCanBeAccelerated const): (WebCore::GraphicsLayerCA::updateAnimations): (WebCore::GraphicsLayerCA::pauseCAAnimationOnLayer): (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): (WebCore::GraphicsLayerCA::seekAnimation): Deleted. (WebCore::GraphicsLayerCA::seekCAAnimationOnLayer): Deleted. * platform/graphics/ca/GraphicsLayerCA.h: * rendering/RenderElement.h: (WebCore::RenderElement::animationPaused): (WebCore::RenderElement::animationSeeked): Deleted. * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::animationSeeked): Deleted. * rendering/RenderLayerBacking.h: * rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::animationSeeked): Deleted. * rendering/RenderLayerModelObject.h: LayoutTests: Add a test where we play an animation for an accelerated property in reverse. * webanimations/accelerated-animation-playback-rate-expected.html: Added. * webanimations/accelerated-animation-playback-rate.html: Added. Canonical link: https://commits.webkit.org/224743@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261637 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-13 19:26:58 +00:00
virtual void animationDidChangeTimingProperties() = 0;
virtual void animationWasCanceled() = 0;
[Web Animations] Handle relative length units https://bugs.webkit.org/show_bug.cgi?id=186047 Reviewed by Dean Jackson. LayoutTests/imported/w3c: Record WPT test progressions. * web-platform-tests/web-animations/animation-model/keyframe-effects/effect-value-context-expected.txt: Source/WebCore: In order to correctly handle relative units, such as "em", "vw" and "vh", we need to do two things. First, because we need to apply the cascade to correctly compute relative lengths, we need to delay the computation of "blending keyframes" to when we have both keyframes data and a valid target. This also means that we need to reset blending keyframes when the target changes. As a result, old call sites of updateBlendingKeyframes() have been replaced by a call to m_blendingKeyframes.clear() and the method now gets called as part of apply() with the RenderStyle of the targeted element as a parameter. Second, and as a result of the first change, we need to update the accelerated animation state based on animation progress rather than when calling specific methods, such as Animation.play() and Animation.pause(), since blending keyframes may not be available at those more specific call sites. We now have a new updateAcceleratedAnimationState() method that gets called as part of apply(). We also rename animationPlayStateDidChange() to animationSuspensionStateDidChange() since this method was specific to suspension and had a confusing name. * animation/AnimationEffectReadOnly.h: Rename animationPlayStateDidChange() to animationSuspensionStateDidChange(). * animation/KeyframeEffectReadOnly.cpp: (WebCore::KeyframeEffectReadOnly::getKeyframes): Fix a crash that revealed itself after other changes in this patch. We would later call into ComputedStyleExtractor::animationSuspensionStateDidChange() and this would yield an assertion because we'd call potentially call it with a custom CSS property. (WebCore::KeyframeEffectReadOnly::processKeyframes): Reset blending keyframes instead of calling updateBlendingKeyframes() since blending keyframes is now performed asynchronously upon style resolution. (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes): Take the target's RenderStyle as a parameter and use it to reset the associated StyleResolver's state, just like we do in StyleResolver::keyframeStylesForAnimation(), so that the CSS cascade is correctly accounted for when computing values using relative length units. Since blending keyframes can now be computed several times for a given set of keyframes, since the effect's target may change, we also need to create a copy of the MutableStyleProperties to pass to StyleRuleKeyframe::create(). (WebCore::KeyframeEffectReadOnly::setTarget): Reset blending keyframes instead of calling updateBlendingKeyframes() since blending keyframes is now performed asynchronously upon style resolution. (WebCore::KeyframeEffectReadOnly::apply): Update blending keyframes and the accelerated animation state. (WebCore::KeyframeEffectReadOnly::getAnimatedStyle): Make sure we have blending keyframes with a call to updateBlendingKeyframes() in case the animation hasn't naturally progressed when this method is called. (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): Make sure we have blending keyframes with a call to updateBlendingKeyframes() in case the animation hasn't naturally progressed when this method is called. (WebCore::KeyframeEffectReadOnly::updateAcceleratedAnimationState): Account for the animation's local time and play state to update the accelerated animation state. (WebCore::KeyframeEffectReadOnly::addPendingAcceleratedAction): Record the last accelerated action in a member variable which we can use to determine if we're running accelerated accounting for uncommited changes. (WebCore::KeyframeEffectReadOnly::animationDidSeek): Only record an AcceleratedAction::Seek action if we're already running accelerated. (WebCore::KeyframeEffectReadOnly::animationSuspensionStateDidChange): Only record an AcceleratedAction::Pause or AcceleratedAction::Play action if we're already running accelerated. (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Ensure we clone and clear the list of accelerated actions and check that we have any cloned actions before proceeding any further. Then we can stop accounting for m_startedAccelerated since the list of accelerated actions already account for animation state changes. (WebCore::KeyframeEffectReadOnly::animationPlayStateDidChange): Deleted. * animation/KeyframeEffectReadOnly.h: (WebCore::KeyframeEffectReadOnly::isRunningAccelerated const): Account for the m_lastRecordedAcceleratedAction to identify whether we're running. * animation/WebAnimation.cpp: (WebCore::WebAnimation::play): Stop calling animationPlayStateDidChange() directly since the accelerated animation state is now updated when the animation's effect is applied. (WebCore::WebAnimation::pause): Stop calling animationPlayStateDidChange() directly since the accelerated animation state is now updated when the animation's effect is applied. (WebCore::WebAnimation::resolve): Make sure we update the finished state prior to applying the animation's effect since the play state can change when updating the finished state and KeyframeEffectReadOnly::updateAcceleratedAnimationState(), which is called when calling into KeyframeEffectReadOnly::apply(), relies on it to correctly update the accelerated animation state. (WebCore::WebAnimation::setSuspended): Rename animationPlayStateDidChange() to animationSuspensionStateDidChange(). * css/StyleResolver.cpp: (WebCore::StyleResolver::setNewStateWithElement): Add a new public method to reset a StyleResolver's state such that we can call it when creating blending keyframes for JS-originated animations just like we do when creating blending keyframes for CSS Animations in keyframeStylesForAnimation(). (WebCore::StyleResolver::keyframeStylesForAnimation): Use the new setNewStateWithElement() method. * css/StyleResolver.h: LayoutTests: Record WPT test progressions and updated failures. * platform/ios/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt: * platform/ios/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt: * platform/ios/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt: * platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt: * platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt: * platform/mac/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt: * platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-expected.txt: * platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-expected.txt: * platform/mac-sierra/imported/w3c/web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-expected.txt: Canonical link: https://commits.webkit.org/201479@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232255 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-05-29 11:59:56 +00:00
virtual void animationSuspensionStateDidChange(bool) = 0;
[Web Animations] Use a keyframe effect stack to resolve animations on an element https://bugs.webkit.org/show_bug.cgi?id=204010 Reviewed by Dean Jackson. Until now, when resolving animations for an element, we would call animationsForElement() during each resolution which means doing several hash table lookups to locate the various classes of animations for that given element, sorting each of those animations and inserting them into a new Vector. We now use a KeyframeEffectStack which keeps a list of KeyframeEffect objects that apply to a given target, provided the effect also has a valid animation and that animation has a valid timeline, all pre-conditions for that effect to produce an animated value. Any time one of those pre-conditions change, we update the membership of that effect in the stack. The KeyframeEffectStack is a new member of ElementRareData. Now, each time we resolve an animation for an element, we iterate over the KeyframeEffect objects returned by calling sortEffects() on the KeyframeEffectStack which will sort the stack's effects only if a new effect had been added since the last iteration, which means that simple animations that are not mutated will require sorting of the stack just once, and the addition of several animations in a single animation frame will require sorting just once as well. It was also found while doing this work that Style::TreeResolver::createAnimatedElementUpdate would call RenderStyle::clonePtr() for any element that was part of a document containing a timeline, regardless of whether that element had any animations. Now we check whether that element's KeyframeEffectStack contains any effects prior to cloning the style. No tests or changes to existed test expectations as this should not yield any change in behavior. * Sources.txt: Add the new KeyframeEffectStack. * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.h: (WebCore::AnimationEffect::setAnimation): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Since we need to know the order of CSS @keyframes rules listed in animation-name when sorting effects, we must compile the ordered list of those @keyframe rules as we update CSS animations for an element and store it on its KeyframeEffectStack. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::resolveAnimationsForElement): Deleted. Replaced by Element::applyKeyframeEffects(). * animation/DocumentTimeline.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::animationTimelineDidChange): (WebCore::KeyframeEffect::setAnimation): (WebCore::KeyframeEffect::setTarget): * animation/KeyframeEffect.h: * animation/KeyframeEffectStack.cpp: Added. (WebCore::KeyframeEffectStack::KeyframeEffectStack): (WebCore::KeyframeEffectStack::~KeyframeEffectStack): (WebCore::KeyframeEffectStack::addEffect): (WebCore::KeyframeEffectStack::removeEffect): (WebCore::KeyframeEffectStack::sortedEffects): (WebCore::KeyframeEffectStack::ensureEffectsAreSorted): (WebCore::KeyframeEffectStack::setCSSAnimationNames): * animation/KeyframeEffectStack.h: Added. (WebCore::KeyframeEffectStack::hasEffects const): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setTimelineInternal): (WebCore::WebAnimation::persist): * dom/Element.cpp: (WebCore::Element::ensureKeyframeEffectStack): (WebCore::Element::hasKeyframeEffects const): (WebCore::Element::applyKeyframeEffects): * dom/Element.h: * dom/ElementRareData.cpp: * dom/ElementRareData.h: (WebCore::ElementRareData::keyframeEffectStack): (WebCore::ElementRareData::setKeyframeEffectStack): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Canonical link: https://commits.webkit.org/217343@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-08 20:40:57 +00:00
virtual void animationTimelineDidChange(AnimationTimeline*) = 0;
[Web Animations] Add basic timing and target properties https://bugs.webkit.org/show_bug.cgi?id=178674 Patch by Antoine Quint <graouts@apple.com> on 2017-10-24 Reviewed by Dean Jackson. Source/WebCore: We add three new interfaces to expose enough properties to establish basic timing properties, a start time and duration, and the target of an animation. The startTime property is set on the Animation object, the target is set on the KeyframeEffect set as the effect property on the Animation object, and the duration is set on the AnimationEffectTiming set on the effect. Tests: webanimations/animation-effect-timing.html webanimations/animation-effect.html webanimations/animation-interface-effect-property.html webanimations/animation-interface-start-time-property.html webanimations/keyframe-effect-interface-timing-duration.html webanimations/keyframe-effect.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): * animation/AnimationEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. (WebCore::AnimationEffect::isKeyframeEffect const): (WebCore::AnimationEffect::timing const): (WebCore::AnimationEffect::classType const): * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/AnimationEffectTiming.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffectTiming::create): (WebCore::AnimationEffectTiming::AnimationEffectTiming): (WebCore::AnimationEffectTiming::~AnimationEffectTiming): * animation/AnimationEffectTiming.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/AnimationEffectTiming.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffect): * animation/WebAnimation.h: * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectCustom.cpp: Copied from Source/WebCore/animation/WebAnimation.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/WebCoreBuiltinNames.h: LayoutTests: Add new tests to check the behavior of the newly exposed interfaces, constructors and properties. * webanimations/animation-effect-expected.txt: Added. * webanimations/animation-effect-timing-expected.txt: Added. * webanimations/animation-effect-timing.html: Added. * webanimations/animation-effect.html: Added. * webanimations/animation-interface-effect-property-expected.txt: Added. * webanimations/animation-interface-effect-property.html: Added. * webanimations/animation-interface-start-time-property-expected.txt: Added. * webanimations/animation-interface-start-time-property.html: Added. * webanimations/keyframe-effect-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration.html: Added. * webanimations/keyframe-effect.html: Added. Canonical link: https://commits.webkit.org/194879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-24 07:51:59 +00:00
[Web Animations] Implement getAnimations() https://bugs.webkit.org/show_bug.cgi?id=179535 <rdar://problem/34932475> Reviewed by Simon Fraser. Source/WebCore: We now allow a list of animations for a document, with Document.getAnimations(), or for an element, with Animatable.getAnimations(), to be returned. In order to support this, we maintain a map on AnimationTimeline of all animations for a given element. This map is invalidated when an animation's timeline changes and when an animation's effect changes. Note that the Web Animations spec mandates that an AnimationEffect can only be a single animation's effect. Tests: http/wpt/wk-web-animations/interfaces/document-get-animations.html http/wpt/wk-web-animations/interfaces/element-get-animations.html http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship.html * CMakeLists.txt: Add Animatable.idl. * DerivedSources.make: Add Animatable.idl. * WebCore.xcodeproj/project.pbxproj: Add Animatable.idl. * animation/Animatable.idl: A new interface that Element implements and which currently only exposes getAnimations(), the animate() method will be added later. * animation/AnimationEffect.h: Add a new m_animation member to reference the animation using this effect. This relationship is required so we guarantee that an effect is associated with a single animation at most. (WebCore::AnimationEffect::animation const): (WebCore::AnimationEffect::setAnimation): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::animationWasAddedToElement): New method to notify the timeline that an animation registered with this timeline has been associated with a new element through its effect. (WebCore::AnimationTimeline::animationWasRemovedFromElement): New method to notify the timeline that an animation registered with this timeline has been disassociated with an element through its effect. (WebCore::AnimationTimeline::animationsForElement): New method returning all animations registered with this timeline for a given element. * animation/AnimationTimeline.h: (WebCore::AnimationTimeline::animations const): All animations registered with this timeline. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::DocumentTimeline): (WebCore::DocumentTimeline::detachFromDocument): Clear the reference between this timeline and its document. (WebCore::DocumentTimeline::currentTime): Protect against a null Document reference. (WebCore::DocumentTimeline::createDisplayRefreshMonitor const): Protect against a null Document reference. * animation/DocumentTimeline.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::create): (WebCore::WebAnimation::setEffect): As an animation's effect changes, we need to ensure that the old effect no longer has an associated animation, and that the new effect is associated with this animation. Additionally, we update the element-to-animations map on the animation's timeline. (WebCore::WebAnimation::setTimeline): Update the element-to-animations map on the former and new timeline. * dom/Document.cpp: (WebCore::Document::prepareForDestruction): Clear the relationship between this document and its timeline. (WebCore::Document::getAnimations): Obtain all animations associated with this document's timeline. * dom/Document.h: * dom/Document.idl: * dom/Element.cpp: (WebCore::Element::getAnimations): Obtain all animations associated with this element. * dom/Element.h: * dom/Element.idl: * testing/Internals.cpp: * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * animation/Animatable.idl: * animation/AnimationEffect.h: (WebCore::AnimationEffect::animation const): (WebCore::AnimationEffect::setAnimation): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::animationWasAddedToElement): (WebCore::AnimationTimeline::animationWasRemovedFromElement): (WebCore::AnimationTimeline::animationsForElement): * animation/AnimationTimeline.h: (WebCore::AnimationTimeline::animations const): * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::DocumentTimeline): (WebCore::DocumentTimeline::detachFromDocument): (WebCore::DocumentTimeline::currentTime): (WebCore::DocumentTimeline::createDisplayRefreshMonitor const): * animation/DocumentTimeline.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::create): (WebCore::WebAnimation::setEffect): (WebCore::WebAnimation::setTimeline): * dom/Document.cpp: (WebCore::Document::prepareForDestruction): (WebCore::Document::getAnimations): * dom/Document.h: * dom/Document.idl: * dom/Element.cpp: (WebCore::Element::getAnimations): * dom/Element.h: * dom/Element.idl: * testing/Internals.cpp: LayoutTests: Update WPT expectations per new progressions and add three new tests that check the behavior of Document.getAnimations(), Element.getAnimations() and the unique relationship between an Animation and an AnimationEffect. * http/wpt/web-animations/interfaces/Animatable/animate-expected.txt: * http/wpt/web-animations/interfaces/Animatable/getAnimations-expected.txt: * http/wpt/web-animations/interfaces/Document/getAnimations-expected.txt: * http/wpt/wk-web-animations/interfaces/document-get-animations-expected.txt: Added. * http/wpt/wk-web-animations/interfaces/document-get-animations.html: Added. * http/wpt/wk-web-animations/interfaces/element-get-animations-expected.txt: Added. * http/wpt/wk-web-animations/interfaces/element-get-animations.html: Added. * http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship-expected.txt: Added. * http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship.html: Added. Canonical link: https://commits.webkit.org/195647@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224760 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-13 19:14:47 +00:00
WebAnimation* animation() const { return m_animation.get(); }
[Web Animations] Use a keyframe effect stack to resolve animations on an element https://bugs.webkit.org/show_bug.cgi?id=204010 Reviewed by Dean Jackson. Until now, when resolving animations for an element, we would call animationsForElement() during each resolution which means doing several hash table lookups to locate the various classes of animations for that given element, sorting each of those animations and inserting them into a new Vector. We now use a KeyframeEffectStack which keeps a list of KeyframeEffect objects that apply to a given target, provided the effect also has a valid animation and that animation has a valid timeline, all pre-conditions for that effect to produce an animated value. Any time one of those pre-conditions change, we update the membership of that effect in the stack. The KeyframeEffectStack is a new member of ElementRareData. Now, each time we resolve an animation for an element, we iterate over the KeyframeEffect objects returned by calling sortEffects() on the KeyframeEffectStack which will sort the stack's effects only if a new effect had been added since the last iteration, which means that simple animations that are not mutated will require sorting of the stack just once, and the addition of several animations in a single animation frame will require sorting just once as well. It was also found while doing this work that Style::TreeResolver::createAnimatedElementUpdate would call RenderStyle::clonePtr() for any element that was part of a document containing a timeline, regardless of whether that element had any animations. Now we check whether that element's KeyframeEffectStack contains any effects prior to cloning the style. No tests or changes to existed test expectations as this should not yield any change in behavior. * Sources.txt: Add the new KeyframeEffectStack. * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.h: (WebCore::AnimationEffect::setAnimation): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Since we need to know the order of CSS @keyframes rules listed in animation-name when sorting effects, we must compile the ordered list of those @keyframe rules as we update CSS animations for an element and store it on its KeyframeEffectStack. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::resolveAnimationsForElement): Deleted. Replaced by Element::applyKeyframeEffects(). * animation/DocumentTimeline.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::animationTimelineDidChange): (WebCore::KeyframeEffect::setAnimation): (WebCore::KeyframeEffect::setTarget): * animation/KeyframeEffect.h: * animation/KeyframeEffectStack.cpp: Added. (WebCore::KeyframeEffectStack::KeyframeEffectStack): (WebCore::KeyframeEffectStack::~KeyframeEffectStack): (WebCore::KeyframeEffectStack::addEffect): (WebCore::KeyframeEffectStack::removeEffect): (WebCore::KeyframeEffectStack::sortedEffects): (WebCore::KeyframeEffectStack::ensureEffectsAreSorted): (WebCore::KeyframeEffectStack::setCSSAnimationNames): * animation/KeyframeEffectStack.h: Added. (WebCore::KeyframeEffectStack::hasEffects const): * animation/WebAnimation.cpp: (WebCore::WebAnimation::setTimelineInternal): (WebCore::WebAnimation::persist): * dom/Element.cpp: (WebCore::Element::ensureKeyframeEffectStack): (WebCore::Element::hasKeyframeEffects const): (WebCore::Element::applyKeyframeEffects): * dom/Element.h: * dom/ElementRareData.cpp: * dom/ElementRareData.h: (WebCore::ElementRareData::keyframeEffectStack): (WebCore::ElementRareData::setKeyframeEffectStack): * style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Canonical link: https://commits.webkit.org/217343@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-08 20:40:57 +00:00
virtual void setAnimation(WebAnimation* animation) { m_animation = makeWeakPtr(animation); }
[Web Animations] Implement getAnimations() https://bugs.webkit.org/show_bug.cgi?id=179535 <rdar://problem/34932475> Reviewed by Simon Fraser. Source/WebCore: We now allow a list of animations for a document, with Document.getAnimations(), or for an element, with Animatable.getAnimations(), to be returned. In order to support this, we maintain a map on AnimationTimeline of all animations for a given element. This map is invalidated when an animation's timeline changes and when an animation's effect changes. Note that the Web Animations spec mandates that an AnimationEffect can only be a single animation's effect. Tests: http/wpt/wk-web-animations/interfaces/document-get-animations.html http/wpt/wk-web-animations/interfaces/element-get-animations.html http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship.html * CMakeLists.txt: Add Animatable.idl. * DerivedSources.make: Add Animatable.idl. * WebCore.xcodeproj/project.pbxproj: Add Animatable.idl. * animation/Animatable.idl: A new interface that Element implements and which currently only exposes getAnimations(), the animate() method will be added later. * animation/AnimationEffect.h: Add a new m_animation member to reference the animation using this effect. This relationship is required so we guarantee that an effect is associated with a single animation at most. (WebCore::AnimationEffect::animation const): (WebCore::AnimationEffect::setAnimation): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::animationWasAddedToElement): New method to notify the timeline that an animation registered with this timeline has been associated with a new element through its effect. (WebCore::AnimationTimeline::animationWasRemovedFromElement): New method to notify the timeline that an animation registered with this timeline has been disassociated with an element through its effect. (WebCore::AnimationTimeline::animationsForElement): New method returning all animations registered with this timeline for a given element. * animation/AnimationTimeline.h: (WebCore::AnimationTimeline::animations const): All animations registered with this timeline. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::DocumentTimeline): (WebCore::DocumentTimeline::detachFromDocument): Clear the reference between this timeline and its document. (WebCore::DocumentTimeline::currentTime): Protect against a null Document reference. (WebCore::DocumentTimeline::createDisplayRefreshMonitor const): Protect against a null Document reference. * animation/DocumentTimeline.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::create): (WebCore::WebAnimation::setEffect): As an animation's effect changes, we need to ensure that the old effect no longer has an associated animation, and that the new effect is associated with this animation. Additionally, we update the element-to-animations map on the animation's timeline. (WebCore::WebAnimation::setTimeline): Update the element-to-animations map on the former and new timeline. * dom/Document.cpp: (WebCore::Document::prepareForDestruction): Clear the relationship between this document and its timeline. (WebCore::Document::getAnimations): Obtain all animations associated with this document's timeline. * dom/Document.h: * dom/Document.idl: * dom/Element.cpp: (WebCore::Element::getAnimations): Obtain all animations associated with this element. * dom/Element.h: * dom/Element.idl: * testing/Internals.cpp: * CMakeLists.txt: * DerivedSources.make: * WebCore.xcodeproj/project.pbxproj: * animation/Animatable.idl: * animation/AnimationEffect.h: (WebCore::AnimationEffect::animation const): (WebCore::AnimationEffect::setAnimation): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::animationWasAddedToElement): (WebCore::AnimationTimeline::animationWasRemovedFromElement): (WebCore::AnimationTimeline::animationsForElement): * animation/AnimationTimeline.h: (WebCore::AnimationTimeline::animations const): * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::DocumentTimeline): (WebCore::DocumentTimeline::detachFromDocument): (WebCore::DocumentTimeline::currentTime): (WebCore::DocumentTimeline::createDisplayRefreshMonitor const): * animation/DocumentTimeline.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::create): (WebCore::WebAnimation::setEffect): (WebCore::WebAnimation::setTimeline): * dom/Document.cpp: (WebCore::Document::prepareForDestruction): (WebCore::Document::getAnimations): * dom/Document.h: * dom/Document.idl: * dom/Element.cpp: (WebCore::Element::getAnimations): * dom/Element.h: * dom/Element.idl: * testing/Internals.cpp: LayoutTests: Update WPT expectations per new progressions and add three new tests that check the behavior of Document.getAnimations(), Element.getAnimations() and the unique relationship between an Animation and an AnimationEffect. * http/wpt/web-animations/interfaces/Animatable/animate-expected.txt: * http/wpt/web-animations/interfaces/Animatable/getAnimations-expected.txt: * http/wpt/web-animations/interfaces/Document/getAnimations-expected.txt: * http/wpt/wk-web-animations/interfaces/document-get-animations-expected.txt: Added. * http/wpt/wk-web-animations/interfaces/document-get-animations.html: Added. * http/wpt/wk-web-animations/interfaces/element-get-animations-expected.txt: Added. * http/wpt/wk-web-animations/interfaces/element-get-animations.html: Added. * http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship-expected.txt: Added. * http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship.html: Added. Canonical link: https://commits.webkit.org/195647@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224760 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-11-13 19:14:47 +00:00
[Web Animations] Implement getTiming() and updateTiming() https://bugs.webkit.org/show_bug.cgi?id=186511 <rdar://problem/41000677> Reviewed by Dean Jackson. The Web Animations API has been further simplified by removing the AnimationEffectTiming and AnimationEffectTimingReadOnly interfaces, removing the "timing" property on AnimationEffect replacing it with getTiming() and updateTiming() methods. This does not change the features of the API but simply how they are exposed. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::transformedProgress const): (WebCore::AnimationEffect::getTiming): (WebCore::AnimationEffect::getComputedTiming): (WebCore::AnimationEffect::updateTiming): (WebCore::AnimationEffect::setIterationStart): (WebCore::AnimationEffect::setIterations): (WebCore::AnimationEffect::endTime const): (WebCore::AnimationEffect::setDelay): (WebCore::AnimationEffect::setEndDelay): (WebCore::AnimationEffect::setFill): (WebCore::AnimationEffect::setIterationDuration): (WebCore::AnimationEffect::setDirection): (WebCore::AnimationEffect::setTimingFunction): (WebCore::AnimationEffect::activeDuration const): * animation/AnimationEffect.h: (WebCore::AnimationEffect::delay const): (WebCore::AnimationEffect::endDelay const): (WebCore::AnimationEffect::fill const): (WebCore::AnimationEffect::iterationStart const): (WebCore::AnimationEffect::iterations const): (WebCore::AnimationEffect::iterationDuration const): (WebCore::AnimationEffect::direction const): (WebCore::AnimationEffect::timingFunction const): * animation/AnimationEffect.idl: * animation/AnimationEffectTiming.idl: Removed. * animation/AnimationEffectTimingReadOnly.cpp: Removed. * animation/AnimationEffectTimingReadOnly.h: Removed. * animation/AnimationEffectTimingReadOnly.idl: Removed. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/CSSTransition.cpp: (WebCore::CSSTransition::setTimingProperties): * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DocumentTimeline.cpp: * animation/EffectTiming.idl: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): * animation/KeyframeEffect.h: * animation/OptionalEffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTiming.h. * animation/OptionalEffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTiming.cpp. * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectTimingDidChange): (WebCore::WebAnimation::updatePlaybackRate): * animation/WebAnimation.h: (WebCore::WebAnimation::isRelevant const): * bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp: Removed. * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/206102@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 11:15:30 +00:00
Seconds delay() const { return m_delay; }
void setDelay(const Seconds&);
Seconds endDelay() const { return m_endDelay; }
void setEndDelay(const Seconds&);
FillMode fill() const { return m_fill; }
void setFill(FillMode);
double iterationStart() const { return m_iterationStart; }
ExceptionOr<void> setIterationStart(double);
double iterations() const { return m_iterations; }
ExceptionOr<void> setIterations(double);
Seconds iterationDuration() const { return m_iterationDuration; }
void setIterationDuration(const Seconds&);
PlaybackDirection direction() const { return m_direction; }
void setDirection(PlaybackDirection);
TimingFunction* timingFunction() const { return m_timingFunction.get(); }
void setTimingFunction(const RefPtr<TimingFunction>&);
[Web Animations] Precompute an animation effect's active duration and end time https://bugs.webkit.org/show_bug.cgi?id=203611 Reviewed by Dean Jackson. We would compute an animation effect's active duration and end time in AnimationEffect::getBasicTiming() but these two properties could be computed ahead of time when the other static timing properties of an animation effect are changed. This allows several calls sites to WebAnimation::effectEndTime() to no longer require the dynamic computation of all the other timing properties in AnimationEffect::getBasicTiming(), (local time, active time and phase) which need to be computed dynamically as they rely on the current timeline time. * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::getBasicTiming const): (WebCore::AnimationEffect::getComputedTiming const): (WebCore::AnimationEffect::updateTiming): (WebCore::AnimationEffect::updateStaticTimingProperties): * animation/AnimationEffect.h: (WebCore::AnimationEffect::activeDuration const): (WebCore::AnimationEffect::endTime const): * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/CSSTransition.cpp: (WebCore::CSSTransition::setTimingProperties): * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::copyPropertiesFromSource): * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectEndTime const): (WebCore::WebAnimation::timeToNextTick const): Canonical link: https://commits.webkit.org/216984@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251785 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-30 18:29:56 +00:00
Seconds activeDuration() const { return m_activeDuration; }
Seconds endTime() const { return m_endTime; }
void updateStaticTimingProperties();
virtual Seconds timeToNextTick() const { return Seconds::infinity(); }
[Web Animations] Animation engine should not wake up every tick for steps timing functions https://bugs.webkit.org/show_bug.cgi?id=212103 <rdar://problem/62737868> Reviewed by Simon Fraser. Source/WebCore: Tests: webanimations/scheduling-of-animation-with-steps-timing-function-on-effect.html webanimations/scheduling-of-animation-with-steps-timing-function-on-keyframe.html webanimations/scheduling-of-css-animation-with-explicit-steps-timing-function-on-some-keyframes.html webanimations/scheduling-of-css-animation-with-implicit-steps-timing-function.html When an animation uses a steps() timing function, it will appear to animate discretely between values such that there is only n visual changes, where n is the number of steps provided. This gives us an opportunity to be more efficient when scheduling animations using steps() timing functions. In WebAnimation::timeToNextTick() we now ask the associated effect for the amount of progress until the next step. For an effect-wide steps() timing function, we can use the provided iteration progress. For animations with a linear effect-wide timing function (the default), we have to map the provided iteration progress to a keyframe interval, provided that interval uses a steps() timing function. The new {Animation|Keyframe}Effect::progressUntilNextStep() method returns WTF::nullopt for any other case. In order to test this, we add a new internals.timeToNextAnimationTick(animation) method which we use in the two new tests. * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::progressUntilNextStep const): * animation/AnimationEffect.h: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::setBlendingKeyframes): (WebCore::KeyframeEffect::computeSomeKeyframesUseStepsTimingFunction): (WebCore::KeyframeEffect::timingFunctionForKeyframeAtIndex const): Avoid any out-of-bounds use of the underlying data structures by returning nullptr for cases where we don't have an explicit keyframe. We also make the function const such that it may be called from progressUntilNextStep(), it always was const but wasn't marked as such. (WebCore::KeyframeEffect::progressUntilNextStep const): * animation/KeyframeEffect.h: * animation/WebAnimation.cpp: (WebCore::WebAnimation::timeToNextTick const): * animation/WebAnimation.h: * animation/WebAnimation.idl: * testing/Internals.cpp: (WebCore::Internals::timeToNextAnimationTick const): * testing/Internals.h: * testing/Internals.idl: Source/WTF: Allow Seconds to be divided or multiplied by a double with operands in any order. * wtf/Seconds.h: (WTF::operator*): (WTF::operator/): LayoutTests: Add tests that check that an animation using a steps() timing function correctly computes the time to the next tick accouning for the fact that it won't compute a different iteration progress until the next step. * webanimations/scheduling-of-animation-with-steps-timing-function-on-effect-expected.txt: Added. * webanimations/scheduling-of-animation-with-steps-timing-function-on-effect.html: Added. * webanimations/scheduling-of-animation-with-steps-timing-function-on-keyframe-expected.txt: Added. * webanimations/scheduling-of-animation-with-steps-timing-function-on-keyframe.html: Added. * webanimations/scheduling-of-css-animation-with-explicit-steps-timing-function-on-some-keyframes-expected.txt: Added. * webanimations/scheduling-of-css-animation-with-explicit-steps-timing-function-on-some-keyframes.html: Added. * webanimations/scheduling-of-css-animation-with-implicit-steps-timing-function-expected.txt: Added. * webanimations/scheduling-of-css-animation-with-implicit-steps-timing-function.html: Added. Canonical link: https://commits.webkit.org/225012@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261926 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-20 16:26:16 +00:00
[Web Animations] Add basic timing and target properties https://bugs.webkit.org/show_bug.cgi?id=178674 Patch by Antoine Quint <graouts@apple.com> on 2017-10-24 Reviewed by Dean Jackson. Source/WebCore: We add three new interfaces to expose enough properties to establish basic timing properties, a start time and duration, and the target of an animation. The startTime property is set on the Animation object, the target is set on the KeyframeEffect set as the effect property on the Animation object, and the duration is set on the AnimationEffectTiming set on the effect. Tests: webanimations/animation-effect-timing.html webanimations/animation-effect.html webanimations/animation-interface-effect-property.html webanimations/animation-interface-start-time-property.html webanimations/keyframe-effect-interface-timing-duration.html webanimations/keyframe-effect.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): * animation/AnimationEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. (WebCore::AnimationEffect::isKeyframeEffect const): (WebCore::AnimationEffect::timing const): (WebCore::AnimationEffect::classType const): * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/AnimationEffectTiming.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffectTiming::create): (WebCore::AnimationEffectTiming::AnimationEffectTiming): (WebCore::AnimationEffectTiming::~AnimationEffectTiming): * animation/AnimationEffectTiming.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/AnimationEffectTiming.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffect): * animation/WebAnimation.h: * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectCustom.cpp: Copied from Source/WebCore/animation/WebAnimation.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/WebCoreBuiltinNames.h: LayoutTests: Add new tests to check the behavior of the newly exposed interfaces, constructors and properties. * webanimations/animation-effect-expected.txt: Added. * webanimations/animation-effect-timing-expected.txt: Added. * webanimations/animation-effect-timing.html: Added. * webanimations/animation-effect.html: Added. * webanimations/animation-interface-effect-property-expected.txt: Added. * webanimations/animation-interface-effect-property.html: Added. * webanimations/animation-interface-start-time-property-expected.txt: Added. * webanimations/animation-interface-start-time-property.html: Added. * webanimations/keyframe-effect-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration.html: Added. * webanimations/keyframe-effect.html: Added. Canonical link: https://commits.webkit.org/194879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-24 07:51:59 +00:00
protected:
[Web Animations] Implement getTiming() and updateTiming() https://bugs.webkit.org/show_bug.cgi?id=186511 <rdar://problem/41000677> Reviewed by Dean Jackson. The Web Animations API has been further simplified by removing the AnimationEffectTiming and AnimationEffectTimingReadOnly interfaces, removing the "timing" property on AnimationEffect replacing it with getTiming() and updateTiming() methods. This does not change the features of the API but simply how they are exposed. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::transformedProgress const): (WebCore::AnimationEffect::getTiming): (WebCore::AnimationEffect::getComputedTiming): (WebCore::AnimationEffect::updateTiming): (WebCore::AnimationEffect::setIterationStart): (WebCore::AnimationEffect::setIterations): (WebCore::AnimationEffect::endTime const): (WebCore::AnimationEffect::setDelay): (WebCore::AnimationEffect::setEndDelay): (WebCore::AnimationEffect::setFill): (WebCore::AnimationEffect::setIterationDuration): (WebCore::AnimationEffect::setDirection): (WebCore::AnimationEffect::setTimingFunction): (WebCore::AnimationEffect::activeDuration const): * animation/AnimationEffect.h: (WebCore::AnimationEffect::delay const): (WebCore::AnimationEffect::endDelay const): (WebCore::AnimationEffect::fill const): (WebCore::AnimationEffect::iterationStart const): (WebCore::AnimationEffect::iterations const): (WebCore::AnimationEffect::iterationDuration const): (WebCore::AnimationEffect::direction const): (WebCore::AnimationEffect::timingFunction const): * animation/AnimationEffect.idl: * animation/AnimationEffectTiming.idl: Removed. * animation/AnimationEffectTimingReadOnly.cpp: Removed. * animation/AnimationEffectTimingReadOnly.h: Removed. * animation/AnimationEffectTimingReadOnly.idl: Removed. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/CSSTransition.cpp: (WebCore::CSSTransition::setTimingProperties): * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DocumentTimeline.cpp: * animation/EffectTiming.idl: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): * animation/KeyframeEffect.h: * animation/OptionalEffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTiming.h. * animation/OptionalEffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTiming.cpp. * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectTimingDidChange): (WebCore::WebAnimation::updatePlaybackRate): * animation/WebAnimation.h: (WebCore::WebAnimation::isRelevant const): * bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp: Removed. * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/206102@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 11:15:30 +00:00
explicit AnimationEffect();
[Web Animations] Add basic timing and target properties https://bugs.webkit.org/show_bug.cgi?id=178674 Patch by Antoine Quint <graouts@apple.com> on 2017-10-24 Reviewed by Dean Jackson. Source/WebCore: We add three new interfaces to expose enough properties to establish basic timing properties, a start time and duration, and the target of an animation. The startTime property is set on the Animation object, the target is set on the KeyframeEffect set as the effect property on the Animation object, and the duration is set on the AnimationEffectTiming set on the effect. Tests: webanimations/animation-effect-timing.html webanimations/animation-effect.html webanimations/animation-interface-effect-property.html webanimations/animation-interface-start-time-property.html webanimations/keyframe-effect-interface-timing-duration.html webanimations/keyframe-effect.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): * animation/AnimationEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. (WebCore::AnimationEffect::isKeyframeEffect const): (WebCore::AnimationEffect::timing const): (WebCore::AnimationEffect::classType const): * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/AnimationEffectTiming.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffectTiming::create): (WebCore::AnimationEffectTiming::AnimationEffectTiming): (WebCore::AnimationEffectTiming::~AnimationEffectTiming): * animation/AnimationEffectTiming.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/AnimationEffectTiming.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffect): * animation/WebAnimation.h: * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectCustom.cpp: Copied from Source/WebCore/animation/WebAnimation.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/WebCoreBuiltinNames.h: LayoutTests: Add new tests to check the behavior of the newly exposed interfaces, constructors and properties. * webanimations/animation-effect-expected.txt: Added. * webanimations/animation-effect-timing-expected.txt: Added. * webanimations/animation-effect-timing.html: Added. * webanimations/animation-effect.html: Added. * webanimations/animation-interface-effect-property-expected.txt: Added. * webanimations/animation-interface-effect-property.html: Added. * webanimations/animation-interface-start-time-property-expected.txt: Added. * webanimations/animation-interface-start-time-property.html: Added. * webanimations/keyframe-effect-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration.html: Added. * webanimations/keyframe-effect.html: Added. Canonical link: https://commits.webkit.org/194879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-24 07:51:59 +00:00
Remove WTF::Optional synonym for std::optional, using that class template directly instead https://bugs.webkit.org/show_bug.cgi?id=226433 Reviewed by Chris Dumez. Source/JavaScriptCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator._generate_init_method_for_payload): Use auto instead of Optional<>. Also use * instead of value() and nest the definition of the local inside an if statement in the case where it's an optional. * inspector/scripts/tests/expected/*: Regenerated these results. Source/WebCore: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebCore/PAL: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebDriver: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKit: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * Scripts/webkit/tests: Regenerated expected results, by running the command "python Scripts/webkit/messages_unittest.py -r". (How am I supposed to know to do that?) Source/WebKitLegacy/ios: * WebCoreSupport/WebChromeClientIOS.h: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/mac: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WebKitLegacy/win: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Source/WTF: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. * wtf/Optional.h: Remove WTF::Optional. Tools: * <many files>: Let the do-webcore-rename script rename Optional<> to std::optional<>. Canonical link: https://commits.webkit.org/238290@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-05-30 16:11:40 +00:00
virtual std::optional<double> progressUntilNextStep(double) const;
[Web Animations] Add basic timing and target properties https://bugs.webkit.org/show_bug.cgi?id=178674 Patch by Antoine Quint <graouts@apple.com> on 2017-10-24 Reviewed by Dean Jackson. Source/WebCore: We add three new interfaces to expose enough properties to establish basic timing properties, a start time and duration, and the target of an animation. The startTime property is set on the Animation object, the target is set on the KeyframeEffect set as the effect property on the Animation object, and the duration is set on the AnimationEffectTiming set on the effect. Tests: webanimations/animation-effect-timing.html webanimations/animation-effect.html webanimations/animation-interface-effect-property.html webanimations/animation-interface-start-time-property.html webanimations/keyframe-effect-interface-timing-duration.html webanimations/keyframe-effect.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): * animation/AnimationEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. (WebCore::AnimationEffect::isKeyframeEffect const): (WebCore::AnimationEffect::timing const): (WebCore::AnimationEffect::classType const): * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/AnimationEffectTiming.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffectTiming::create): (WebCore::AnimationEffectTiming::AnimationEffectTiming): (WebCore::AnimationEffectTiming::~AnimationEffectTiming): * animation/AnimationEffectTiming.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/AnimationEffectTiming.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffect): * animation/WebAnimation.h: * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectCustom.cpp: Copied from Source/WebCore/animation/WebAnimation.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/WebCoreBuiltinNames.h: LayoutTests: Add new tests to check the behavior of the newly exposed interfaces, constructors and properties. * webanimations/animation-effect-expected.txt: Added. * webanimations/animation-effect-timing-expected.txt: Added. * webanimations/animation-effect-timing.html: Added. * webanimations/animation-effect.html: Added. * webanimations/animation-interface-effect-property-expected.txt: Added. * webanimations/animation-interface-effect-property.html: Added. * webanimations/animation-interface-start-time-property-expected.txt: Added. * webanimations/animation-interface-start-time-property.html: Added. * webanimations/keyframe-effect-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration.html: Added. * webanimations/keyframe-effect.html: Added. Canonical link: https://commits.webkit.org/194879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-24 07:51:59 +00:00
private:
[Web Animations] Audit Web Animations classes for memory reduction https://bugs.webkit.org/show_bug.cgi?id=193195 Reviewed by Simon Fraser and Yusuke Suzuki. The classes, enums and structs added to support Web Animations were not as memory-efficient as they could be. We now order members in a way that reduces padding, use Markable<T, Traits> instead of Optional<T> where applicable, declare enums as uint8_t and removed unnecessary members. As a result, classes and structs have shrunk as follows: WebAnimation: 256 > 216 DeclarativeAnimation: 392 > 344 CSSAnimation: 416 > 368 CSSTransition: 440 > 392 AnimationEffect: 88 > 72 KeyframeEffect: 208 > 184 AnimationPlaybackEvent: 104 > 88 EffectTiming: 72 > 64 ComputedEffectTiming: 136 > 112 AnimationTimeline: 264 > 248 DocumentTimeline: 496 > 464 OptionalEffectTiming: 112 > 80 BaseKeyframe: 32 > 24 ParsedKeyframe: 80 > 72 BaseComputedKeyframe: 40 > 32 * animation/AnimationEffect.h: Order members in decreasing size, except for m_fill and m_direction, which we put at the top to save 8 bytes (2 bytes of padding instead of 4 before m_animation and saving 6 bytes of padding at the end). * animation/AnimationPlaybackEvent.cpp: (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent): * animation/AnimationPlaybackEvent.h: * animation/AnimationPlaybackEventInit.h: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::AnimationTimeline): (WebCore::AnimationTimeline::updateCSSTransitionsForElement): * animation/AnimationTimeline.h: We remove the m_classType member and instead make isDocumentTimeline() virtual. (WebCore::AnimationTimeline::isDocumentTimeline const): (): Deleted. (WebCore::AnimationTimeline::classType const): Deleted. * animation/CompositeOperation.h: * animation/CompositeOperationOrAuto.h: * animation/ComputedEffectTiming.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::DeclarativeAnimation): (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DeclarativeAnimation.h: We keep m_wasPending and m_previousPhase at the top to save some padding at the end. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::DocumentTimeline): * animation/DocumentTimeline.h: * animation/EffectTiming.h: * animation/FillMode.h: * animation/IterationCompositeOperation.h: * animation/KeyframeEffect.cpp: (WebCore::computeMissingKeyframeOffsets): (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): * animation/KeyframeEffect.h: * animation/OptionalEffectTiming.h: * animation/PlaybackDirection.h: * animation/WebAnimation.h: * animation/WebAnimationUtilities.h: (WebCore::WebAnimationsMarkableDoubleTraits::isEmptyValue): (WebCore::WebAnimationsMarkableDoubleTraits::emptyValue): Canonical link: https://commits.webkit.org/207806@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239820 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-10 08:19:39 +00:00
enum class ComputedDirection : uint8_t { Forwards, Reverse };
[Web Animations] Compute the progress and currentIteration properties on getComputedTiming() https://bugs.webkit.org/show_bug.cgi?id=182039 <rdar://problem/36813568> Reviewed by Dean Jackson. Source/WebCore: Compute the "progress" and "currentIteration" properties on the dictionary returned by getComputedTiming(). To support this we implement several procedures from the specification implemented separately with links and steps copied from the specification. There is one last procedure we don't implement, which is to obtain the transformed time following the application of the provided easing, which will be the next patch. * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::directedProgress const): (WebCore::AnimationEffect::iterationProgress const): (WebCore::AnimationEffect::getComputedTiming): * animation/AnimationEffect.h: LayoutTests: Update expectations with progressions as we expose more of the API. * http/wpt/web-animations/interfaces/AnimationEffectTiming/delay-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/easing-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/iterationStart-expected.txt: * http/wpt/web-animations/timing-model/animation-effects/active-time-expected.txt: * http/wpt/web-animations/timing-model/animation-effects/current-iteration-expected.txt: * http/wpt/web-animations/timing-model/animation-effects/phases-and-states-expected.txt: * http/wpt/web-animations/timing-model/animation-effects/simple-iteration-progress-expected.txt: * http/wpt/web-animations/timing-model/animations/set-the-target-effect-of-an-animation-expected.txt: * http/wpt/web-animations/timing-model/time-transformations/transformed-progress-expected.txt: Canonical link: https://commits.webkit.org/197886@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227534 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-24 19:29:53 +00:00
[Web Animations] Implement getTiming() and updateTiming() https://bugs.webkit.org/show_bug.cgi?id=186511 <rdar://problem/41000677> Reviewed by Dean Jackson. The Web Animations API has been further simplified by removing the AnimationEffectTiming and AnimationEffectTimingReadOnly interfaces, removing the "timing" property on AnimationEffect replacing it with getTiming() and updateTiming() methods. This does not change the features of the API but simply how they are exposed. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::transformedProgress const): (WebCore::AnimationEffect::getTiming): (WebCore::AnimationEffect::getComputedTiming): (WebCore::AnimationEffect::updateTiming): (WebCore::AnimationEffect::setIterationStart): (WebCore::AnimationEffect::setIterations): (WebCore::AnimationEffect::endTime const): (WebCore::AnimationEffect::setDelay): (WebCore::AnimationEffect::setEndDelay): (WebCore::AnimationEffect::setFill): (WebCore::AnimationEffect::setIterationDuration): (WebCore::AnimationEffect::setDirection): (WebCore::AnimationEffect::setTimingFunction): (WebCore::AnimationEffect::activeDuration const): * animation/AnimationEffect.h: (WebCore::AnimationEffect::delay const): (WebCore::AnimationEffect::endDelay const): (WebCore::AnimationEffect::fill const): (WebCore::AnimationEffect::iterationStart const): (WebCore::AnimationEffect::iterations const): (WebCore::AnimationEffect::iterationDuration const): (WebCore::AnimationEffect::direction const): (WebCore::AnimationEffect::timingFunction const): * animation/AnimationEffect.idl: * animation/AnimationEffectTiming.idl: Removed. * animation/AnimationEffectTimingReadOnly.cpp: Removed. * animation/AnimationEffectTimingReadOnly.h: Removed. * animation/AnimationEffectTimingReadOnly.idl: Removed. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/CSSTransition.cpp: (WebCore::CSSTransition::setTimingProperties): * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DocumentTimeline.cpp: * animation/EffectTiming.idl: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): * animation/KeyframeEffect.h: * animation/OptionalEffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTiming.h. * animation/OptionalEffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTiming.cpp. * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectTimingDidChange): (WebCore::WebAnimation::updatePlaybackRate): * animation/WebAnimation.h: (WebCore::WebAnimation::isRelevant const): * bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp: Removed. * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/206102@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 11:15:30 +00:00
FillMode m_fill { FillMode::Auto };
[Web Animations] Audit Web Animations classes for memory reduction https://bugs.webkit.org/show_bug.cgi?id=193195 Reviewed by Simon Fraser and Yusuke Suzuki. The classes, enums and structs added to support Web Animations were not as memory-efficient as they could be. We now order members in a way that reduces padding, use Markable<T, Traits> instead of Optional<T> where applicable, declare enums as uint8_t and removed unnecessary members. As a result, classes and structs have shrunk as follows: WebAnimation: 256 > 216 DeclarativeAnimation: 392 > 344 CSSAnimation: 416 > 368 CSSTransition: 440 > 392 AnimationEffect: 88 > 72 KeyframeEffect: 208 > 184 AnimationPlaybackEvent: 104 > 88 EffectTiming: 72 > 64 ComputedEffectTiming: 136 > 112 AnimationTimeline: 264 > 248 DocumentTimeline: 496 > 464 OptionalEffectTiming: 112 > 80 BaseKeyframe: 32 > 24 ParsedKeyframe: 80 > 72 BaseComputedKeyframe: 40 > 32 * animation/AnimationEffect.h: Order members in decreasing size, except for m_fill and m_direction, which we put at the top to save 8 bytes (2 bytes of padding instead of 4 before m_animation and saving 6 bytes of padding at the end). * animation/AnimationPlaybackEvent.cpp: (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent): * animation/AnimationPlaybackEvent.h: * animation/AnimationPlaybackEventInit.h: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::AnimationTimeline): (WebCore::AnimationTimeline::updateCSSTransitionsForElement): * animation/AnimationTimeline.h: We remove the m_classType member and instead make isDocumentTimeline() virtual. (WebCore::AnimationTimeline::isDocumentTimeline const): (): Deleted. (WebCore::AnimationTimeline::classType const): Deleted. * animation/CompositeOperation.h: * animation/CompositeOperationOrAuto.h: * animation/ComputedEffectTiming.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::DeclarativeAnimation): (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DeclarativeAnimation.h: We keep m_wasPending and m_previousPhase at the top to save some padding at the end. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::DocumentTimeline): * animation/DocumentTimeline.h: * animation/EffectTiming.h: * animation/FillMode.h: * animation/IterationCompositeOperation.h: * animation/KeyframeEffect.cpp: (WebCore::computeMissingKeyframeOffsets): (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): * animation/KeyframeEffect.h: * animation/OptionalEffectTiming.h: * animation/PlaybackDirection.h: * animation/WebAnimation.h: * animation/WebAnimationUtilities.h: (WebCore::WebAnimationsMarkableDoubleTraits::isEmptyValue): (WebCore::WebAnimationsMarkableDoubleTraits::emptyValue): Canonical link: https://commits.webkit.org/207806@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239820 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-10 08:19:39 +00:00
PlaybackDirection m_direction { PlaybackDirection::Normal };
WeakPtr<WebAnimation> m_animation;
RefPtr<TimingFunction> m_timingFunction;
[Web Animations] Implement getTiming() and updateTiming() https://bugs.webkit.org/show_bug.cgi?id=186511 <rdar://problem/41000677> Reviewed by Dean Jackson. The Web Animations API has been further simplified by removing the AnimationEffectTiming and AnimationEffectTimingReadOnly interfaces, removing the "timing" property on AnimationEffect replacing it with getTiming() and updateTiming() methods. This does not change the features of the API but simply how they are exposed. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::transformedProgress const): (WebCore::AnimationEffect::getTiming): (WebCore::AnimationEffect::getComputedTiming): (WebCore::AnimationEffect::updateTiming): (WebCore::AnimationEffect::setIterationStart): (WebCore::AnimationEffect::setIterations): (WebCore::AnimationEffect::endTime const): (WebCore::AnimationEffect::setDelay): (WebCore::AnimationEffect::setEndDelay): (WebCore::AnimationEffect::setFill): (WebCore::AnimationEffect::setIterationDuration): (WebCore::AnimationEffect::setDirection): (WebCore::AnimationEffect::setTimingFunction): (WebCore::AnimationEffect::activeDuration const): * animation/AnimationEffect.h: (WebCore::AnimationEffect::delay const): (WebCore::AnimationEffect::endDelay const): (WebCore::AnimationEffect::fill const): (WebCore::AnimationEffect::iterationStart const): (WebCore::AnimationEffect::iterations const): (WebCore::AnimationEffect::iterationDuration const): (WebCore::AnimationEffect::direction const): (WebCore::AnimationEffect::timingFunction const): * animation/AnimationEffect.idl: * animation/AnimationEffectTiming.idl: Removed. * animation/AnimationEffectTimingReadOnly.cpp: Removed. * animation/AnimationEffectTimingReadOnly.h: Removed. * animation/AnimationEffectTimingReadOnly.idl: Removed. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/CSSTransition.cpp: (WebCore::CSSTransition::setTimingProperties): * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DocumentTimeline.cpp: * animation/EffectTiming.idl: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): * animation/KeyframeEffect.h: * animation/OptionalEffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTiming.h. * animation/OptionalEffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTiming.cpp. * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectTimingDidChange): (WebCore::WebAnimation::updatePlaybackRate): * animation/WebAnimation.h: (WebCore::WebAnimation::isRelevant const): * bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp: Removed. * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/206102@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 11:15:30 +00:00
double m_iterationStart { 0 };
double m_iterations { 1 };
[Web Animations] Audit Web Animations classes for memory reduction https://bugs.webkit.org/show_bug.cgi?id=193195 Reviewed by Simon Fraser and Yusuke Suzuki. The classes, enums and structs added to support Web Animations were not as memory-efficient as they could be. We now order members in a way that reduces padding, use Markable<T, Traits> instead of Optional<T> where applicable, declare enums as uint8_t and removed unnecessary members. As a result, classes and structs have shrunk as follows: WebAnimation: 256 > 216 DeclarativeAnimation: 392 > 344 CSSAnimation: 416 > 368 CSSTransition: 440 > 392 AnimationEffect: 88 > 72 KeyframeEffect: 208 > 184 AnimationPlaybackEvent: 104 > 88 EffectTiming: 72 > 64 ComputedEffectTiming: 136 > 112 AnimationTimeline: 264 > 248 DocumentTimeline: 496 > 464 OptionalEffectTiming: 112 > 80 BaseKeyframe: 32 > 24 ParsedKeyframe: 80 > 72 BaseComputedKeyframe: 40 > 32 * animation/AnimationEffect.h: Order members in decreasing size, except for m_fill and m_direction, which we put at the top to save 8 bytes (2 bytes of padding instead of 4 before m_animation and saving 6 bytes of padding at the end). * animation/AnimationPlaybackEvent.cpp: (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent): * animation/AnimationPlaybackEvent.h: * animation/AnimationPlaybackEventInit.h: * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::AnimationTimeline): (WebCore::AnimationTimeline::updateCSSTransitionsForElement): * animation/AnimationTimeline.h: We remove the m_classType member and instead make isDocumentTimeline() virtual. (WebCore::AnimationTimeline::isDocumentTimeline const): (): Deleted. (WebCore::AnimationTimeline::classType const): Deleted. * animation/CompositeOperation.h: * animation/CompositeOperationOrAuto.h: * animation/ComputedEffectTiming.h: * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::DeclarativeAnimation): (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DeclarativeAnimation.h: We keep m_wasPending and m_previousPhase at the top to save some padding at the end. * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::DocumentTimeline): * animation/DocumentTimeline.h: * animation/EffectTiming.h: * animation/FillMode.h: * animation/IterationCompositeOperation.h: * animation/KeyframeEffect.cpp: (WebCore::computeMissingKeyframeOffsets): (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): * animation/KeyframeEffect.h: * animation/OptionalEffectTiming.h: * animation/PlaybackDirection.h: * animation/WebAnimation.h: * animation/WebAnimationUtilities.h: (WebCore::WebAnimationsMarkableDoubleTraits::isEmptyValue): (WebCore::WebAnimationsMarkableDoubleTraits::emptyValue): Canonical link: https://commits.webkit.org/207806@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239820 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-10 08:19:39 +00:00
Seconds m_delay { 0_s };
Seconds m_endDelay { 0_s };
[Web Animations] Implement getTiming() and updateTiming() https://bugs.webkit.org/show_bug.cgi?id=186511 <rdar://problem/41000677> Reviewed by Dean Jackson. The Web Animations API has been further simplified by removing the AnimationEffectTiming and AnimationEffectTimingReadOnly interfaces, removing the "timing" property on AnimationEffect replacing it with getTiming() and updateTiming() methods. This does not change the features of the API but simply how they are exposed. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::transformedProgress const): (WebCore::AnimationEffect::getTiming): (WebCore::AnimationEffect::getComputedTiming): (WebCore::AnimationEffect::updateTiming): (WebCore::AnimationEffect::setIterationStart): (WebCore::AnimationEffect::setIterations): (WebCore::AnimationEffect::endTime const): (WebCore::AnimationEffect::setDelay): (WebCore::AnimationEffect::setEndDelay): (WebCore::AnimationEffect::setFill): (WebCore::AnimationEffect::setIterationDuration): (WebCore::AnimationEffect::setDirection): (WebCore::AnimationEffect::setTimingFunction): (WebCore::AnimationEffect::activeDuration const): * animation/AnimationEffect.h: (WebCore::AnimationEffect::delay const): (WebCore::AnimationEffect::endDelay const): (WebCore::AnimationEffect::fill const): (WebCore::AnimationEffect::iterationStart const): (WebCore::AnimationEffect::iterations const): (WebCore::AnimationEffect::iterationDuration const): (WebCore::AnimationEffect::direction const): (WebCore::AnimationEffect::timingFunction const): * animation/AnimationEffect.idl: * animation/AnimationEffectTiming.idl: Removed. * animation/AnimationEffectTimingReadOnly.cpp: Removed. * animation/AnimationEffectTimingReadOnly.h: Removed. * animation/AnimationEffectTimingReadOnly.idl: Removed. * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/CSSTransition.cpp: (WebCore::CSSTransition::setTimingProperties): * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DocumentTimeline.cpp: * animation/EffectTiming.idl: * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): * animation/KeyframeEffect.h: * animation/OptionalEffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTiming.h. * animation/OptionalEffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTiming.cpp. * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectTimingDidChange): (WebCore::WebAnimation::updatePlaybackRate): * animation/WebAnimation.h: (WebCore::WebAnimation::isRelevant const): * bindings/js/JSAnimationEffectTimingReadOnlyCustom.cpp: Removed. * bindings/js/WebCoreBuiltinNames.h: Canonical link: https://commits.webkit.org/206102@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237853 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 11:15:30 +00:00
Seconds m_iterationDuration { 0_s };
[Web Animations] Precompute an animation effect's active duration and end time https://bugs.webkit.org/show_bug.cgi?id=203611 Reviewed by Dean Jackson. We would compute an animation effect's active duration and end time in AnimationEffect::getBasicTiming() but these two properties could be computed ahead of time when the other static timing properties of an animation effect are changed. This allows several calls sites to WebAnimation::effectEndTime() to no longer require the dynamic computation of all the other timing properties in AnimationEffect::getBasicTiming(), (local time, active time and phase) which need to be computed dynamically as they rely on the current timeline time. * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::getBasicTiming const): (WebCore::AnimationEffect::getComputedTiming const): (WebCore::AnimationEffect::updateTiming): (WebCore::AnimationEffect::updateStaticTimingProperties): * animation/AnimationEffect.h: (WebCore::AnimationEffect::activeDuration const): (WebCore::AnimationEffect::endTime const): * animation/CSSAnimation.cpp: (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): * animation/CSSTransition.cpp: (WebCore::CSSTransition::setTimingProperties): * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::copyPropertiesFromSource): * animation/WebAnimation.cpp: (WebCore::WebAnimation::effectEndTime const): (WebCore::WebAnimation::timeToNextTick const): Canonical link: https://commits.webkit.org/216984@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251785 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-10-30 18:29:56 +00:00
Seconds m_activeDuration { 0_s };
Seconds m_endTime { 0_s };
[Web Animations] Add basic timing and target properties https://bugs.webkit.org/show_bug.cgi?id=178674 Patch by Antoine Quint <graouts@apple.com> on 2017-10-24 Reviewed by Dean Jackson. Source/WebCore: We add three new interfaces to expose enough properties to establish basic timing properties, a start time and duration, and the target of an animation. The startTime property is set on the Animation object, the target is set on the KeyframeEffect set as the effect property on the Animation object, and the duration is set on the AnimationEffectTiming set on the effect. Tests: webanimations/animation-effect-timing.html webanimations/animation-effect.html webanimations/animation-interface-effect-property.html webanimations/animation-interface-start-time-property.html webanimations/keyframe-effect-interface-timing-duration.html webanimations/keyframe-effect.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): * animation/AnimationEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. (WebCore::AnimationEffect::isKeyframeEffect const): (WebCore::AnimationEffect::timing const): (WebCore::AnimationEffect::classType const): * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/AnimationEffectTiming.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffectTiming::create): (WebCore::AnimationEffectTiming::AnimationEffectTiming): (WebCore::AnimationEffectTiming::~AnimationEffectTiming): * animation/AnimationEffectTiming.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/AnimationEffectTiming.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffect): * animation/WebAnimation.h: * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectCustom.cpp: Copied from Source/WebCore/animation/WebAnimation.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/WebCoreBuiltinNames.h: LayoutTests: Add new tests to check the behavior of the newly exposed interfaces, constructors and properties. * webanimations/animation-effect-expected.txt: Added. * webanimations/animation-effect-timing-expected.txt: Added. * webanimations/animation-effect-timing.html: Added. * webanimations/animation-effect.html: Added. * webanimations/animation-interface-effect-property-expected.txt: Added. * webanimations/animation-interface-effect-property.html: Added. * webanimations/animation-interface-start-time-property-expected.txt: Added. * webanimations/animation-interface-start-time-property.html: Added. * webanimations/keyframe-effect-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration.html: Added. * webanimations/keyframe-effect.html: Added. Canonical link: https://commits.webkit.org/194879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-24 07:51:59 +00:00
};
} // namespace WebCore
#define SPECIALIZE_TYPE_TRAITS_ANIMATION_EFFECT(ToValueTypeName, predicate) \
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToValueTypeName) \
[Web Animations] Update the Web Animations API to remove all the ReadOnly interfaces https://bugs.webkit.org/show_bug.cgi?id=186512 <rdar://problem/41000691> Reviewed by Dean Jackson. The Web Animations API has been simplified by removing its various ReadOnly interfaces. In this patch, we make the following changes, not adding code but merely merging and renaming files: - AnimationEffectReadOnly and AnimationEffect are now a single AnimationEffect interface - KeyframeEffectReadOnly and KeyframeEffect are now a single KeyframeEffect interface - ComputedTimingProperties is now named ComputedEffectTiming - AnimationEffectTimingProperties is now named EffectTiming * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: Renamed from Source/WebCore/animation/AnimationEffectReadOnly.cpp. (WebCore::AnimationEffect::~AnimationEffect): (WebCore::AnimationEffect::timingDidChange): (WebCore::AnimationEffect::localTime const): (WebCore::AnimationEffect::phase const): (WebCore::AnimationEffect::activeTime const): (WebCore::AnimationEffect::overallProgress const): (WebCore::AnimationEffect::simpleIterationProgress const): (WebCore::AnimationEffect::currentIteration const): (WebCore::AnimationEffect::currentDirection const): (WebCore::AnimationEffect::directedProgress const): (WebCore::AnimationEffect::transformedProgress const): (WebCore::AnimationEffect::iterationProgress const): (WebCore::AnimationEffect::getComputedTiming): * animation/AnimationEffect.h: Renamed from Source/WebCore/animation/AnimationEffectReadOnly.h. (WebCore::AnimationEffect::isKeyframeEffect const): * animation/AnimationEffect.idl: Renamed from Source/WebCore/animation/AnimationEffectReadOnly.idl. * animation/AnimationEffectTimingReadOnly.cpp: * animation/AnimationEffectTimingReadOnly.h: (WebCore::AnimationEffectTimingReadOnly::setEffect): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::removeAnimation): (WebCore::AnimationTimeline::cssAnimationForElementAndProperty): * animation/CSSTransition.cpp: * animation/ComputedEffectTiming.h: Renamed from Source/WebCore/animation/ComputedTimingProperties.h. * animation/ComputedEffectTiming.idl: Renamed from Source/WebCore/animation/ComputedTimingProperties.idl. * animation/DeclarativeAnimation.cpp: (WebCore::DeclarativeAnimation::initialize): (WebCore::DeclarativeAnimation::flushPendingStyleChanges const): (WebCore::DeclarativeAnimation::phaseWithoutEffect const): (WebCore::DeclarativeAnimation::invalidateDOMEvents): * animation/DeclarativeAnimation.h: * animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::getAnimations const): (WebCore::DocumentTimeline::transitionDidComplete): (WebCore::DocumentTimeline::computeExtentOfAnimation const): (WebCore::DocumentTimeline::isRunningAnimationOnRenderer const): (WebCore::DocumentTimeline::isRunningAcceleratedAnimationOnRenderer const): (WebCore::DocumentTimeline::animatedStyleForRenderer): (WebCore::DocumentTimeline::animationAcceleratedRunningStateDidChange): (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement): (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations): (WebCore::DocumentTimeline::resolveAnimationsForElement): * animation/EffectTiming.h: Renamed from Source/WebCore/animation/AnimationEffectTimingProperties.h. * animation/EffectTiming.idl: Renamed from Source/WebCore/animation/AnimationEffectTimingProperties.idl. * animation/KeyframeEffect.cpp: (WebCore::invalidateElement): (WebCore::CSSPropertyIDToIDLAttributeName): (WebCore::IDLAttributeNameToAnimationPropertyName): (WebCore::computeMissingKeyframeOffsets): (WebCore::processKeyframeLikeObject): (WebCore::processIterableKeyframes): (WebCore::processPropertyIndexedKeyframes): (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): (WebCore::KeyframeEffect::copyPropertiesFromSource): (WebCore::KeyframeEffect::getKeyframes): (WebCore::KeyframeEffect::processKeyframes): (WebCore::KeyframeEffect::updateBlendingKeyframes): (WebCore::KeyframeEffect::forceLayoutIfNeeded): (WebCore::KeyframeEffect::setBlendingKeyframes): (WebCore::KeyframeEffect::checkForMatchingTransformFunctionLists): (WebCore::KeyframeEffect::checkForMatchingFilterFunctionLists const): (WebCore::KeyframeEffect::checkForMatchingFilterFunctionLists): (WebCore::KeyframeEffect::checkForMatchingBackdropFilterFunctionLists): (WebCore::KeyframeEffect::checkForMatchingColorFilterFunctionLists): (WebCore::KeyframeEffect::computeDeclarativeAnimationBlendingKeyframes): (WebCore::KeyframeEffect::computeCSSAnimationBlendingKeyframes): (WebCore::KeyframeEffect::computeCSSTransitionBlendingKeyframes): (WebCore::KeyframeEffect::computedNeedsForcedLayout): (WebCore::KeyframeEffect::computeStackingContextImpact): (WebCore::KeyframeEffect::setTarget): (WebCore::KeyframeEffect::apply): (WebCore::KeyframeEffect::invalidate): (WebCore::KeyframeEffect::computeShouldRunAccelerated): (WebCore::KeyframeEffect::getAnimatedStyle): (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): (WebCore::KeyframeEffect::timingFunctionForKeyframeAtIndex): (WebCore::KeyframeEffect::updateAcceleratedAnimationState): (WebCore::KeyframeEffect::addPendingAcceleratedAction): (WebCore::KeyframeEffect::animationDidSeek): (WebCore::KeyframeEffect::animationSuspensionStateDidChange): (WebCore::KeyframeEffect::applyPendingAcceleratedActions): (WebCore::KeyframeEffect::backingAnimationForCompositedRenderer const): (WebCore::KeyframeEffect::renderer const): (WebCore::KeyframeEffect::currentStyle const): (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const): (WebCore::containsRotation): (WebCore::KeyframeEffect::computeTransformedExtentViaTransformList const): (WebCore::KeyframeEffect::computeTransformedExtentViaMatrix const): * animation/KeyframeEffect.h: (WebCore::KeyframeEffect::ParsedKeyframe::ParsedKeyframe): (WebCore::KeyframeEffect::target const): (WebCore::KeyframeEffect::iterationComposite const): (WebCore::KeyframeEffect::composite const): (WebCore::KeyframeEffect::isRunningAccelerated const): (WebCore::KeyframeEffect::hasPendingAcceleratedAction const): (WebCore::KeyframeEffect::hasBlendingKeyframes const): (WebCore::KeyframeEffect::animatedProperties const): * animation/KeyframeEffect.idl: * animation/KeyframeEffectOptions.h: * animation/KeyframeEffectOptions.idl: * animation/KeyframeEffectReadOnly.cpp: Removed. * animation/KeyframeEffectReadOnly.h: Removed. * animation/KeyframeEffectReadOnly.idl: Removed. * animation/WebAnimation.cpp: (WebCore::WebAnimation::create): (WebCore::WebAnimation::setEffect): (WebCore::WebAnimation::setEffectInternal): (WebCore::WebAnimation::setTimeline): (WebCore::WebAnimation::applyPendingAcceleratedActions): (WebCore::WebAnimation::computeRelevance): * animation/WebAnimation.h: (WebCore::WebAnimation::effect const): * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectCustom.cpp: Renamed from Source/WebCore/bindings/js/JSAnimationEffectReadOnlyCustom.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/JSWebAnimationCustom.cpp: (WebCore::constructJSWebAnimation): * bindings/js/WebCoreBuiltinNames.h: * dom/Document.cpp: Canonical link: https://commits.webkit.org/206101@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237852 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-11-06 11:15:15 +00:00
static bool isType(const WebCore::AnimationEffect& value) { return value.predicate; } \
[Web Animations] Add basic timing and target properties https://bugs.webkit.org/show_bug.cgi?id=178674 Patch by Antoine Quint <graouts@apple.com> on 2017-10-24 Reviewed by Dean Jackson. Source/WebCore: We add three new interfaces to expose enough properties to establish basic timing properties, a start time and duration, and the target of an animation. The startTime property is set on the Animation object, the target is set on the KeyframeEffect set as the effect property on the Animation object, and the duration is set on the AnimationEffectTiming set on the effect. Tests: webanimations/animation-effect-timing.html webanimations/animation-effect.html webanimations/animation-interface-effect-property.html webanimations/animation-interface-start-time-property.html webanimations/keyframe-effect-interface-timing-duration.html webanimations/keyframe-effect.html * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffect::AnimationEffect): (WebCore::AnimationEffect::~AnimationEffect): * animation/AnimationEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. (WebCore::AnimationEffect::isKeyframeEffect const): (WebCore::AnimationEffect::timing const): (WebCore::AnimationEffect::classType const): * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/AnimationEffectTiming.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::AnimationEffectTiming::create): (WebCore::AnimationEffectTiming::AnimationEffectTiming): (WebCore::AnimationEffectTiming::~AnimationEffectTiming): * animation/AnimationEffectTiming.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/AnimationEffectTiming.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl. (WebCore::KeyframeEffect::create): (WebCore::KeyframeEffect::KeyframeEffect): * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/WebAnimation.h. * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl. * animation/WebAnimation.cpp: (WebCore::WebAnimation::setEffect): * animation/WebAnimation.h: * animation/WebAnimation.idl: * bindings/js/JSAnimationEffectCustom.cpp: Copied from Source/WebCore/animation/WebAnimation.cpp. (WebCore::toJSNewlyCreated): (WebCore::toJS): * bindings/js/WebCoreBuiltinNames.h: LayoutTests: Add new tests to check the behavior of the newly exposed interfaces, constructors and properties. * webanimations/animation-effect-expected.txt: Added. * webanimations/animation-effect-timing-expected.txt: Added. * webanimations/animation-effect-timing.html: Added. * webanimations/animation-effect.html: Added. * webanimations/animation-interface-effect-property-expected.txt: Added. * webanimations/animation-interface-effect-property.html: Added. * webanimations/animation-interface-start-time-property-expected.txt: Added. * webanimations/animation-interface-start-time-property.html: Added. * webanimations/keyframe-effect-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration-expected.txt: Added. * webanimations/keyframe-effect-interface-timing-duration.html: Added. * webanimations/keyframe-effect.html: Added. Canonical link: https://commits.webkit.org/194879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223883 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-24 07:51:59 +00:00
SPECIALIZE_TYPE_TRAITS_END()