haikuwebkit/Source/WebCore/animation/ComputedEffectTiming.idl

35 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

[Web Animations] Expose timing properties (delay, endDelay, fill, iterationStart, iterations, direction) and getComputedTiming() https://bugs.webkit.org/show_bug.cgi?id=181857 <rdar://problem/36660081> Reviewed by Dean Jackson. Source/WebCore: We start the work to implement the rest of the Web Animations timing and animation model by exposing more properties on AnimationEffectTiming to control delay (delay, endDelay), looping (iterationStart, iterations), fill and direction. Additionally, we expose the getComputedTiming() method on AnimationEffect, although it currently lacks some computed properties that will come in later patch as we implement various processes defined by the spec. We also update the existing duration() method on AnimationEffectTiming to be called iterationDuration() to match the terms used in the specification. Finally, we make all new properties, and update existing ones, that expose a time value go through the new utility function secondsToWebAnimationsAPITime() to guarantee rounded values with microseconds precision, as advised by the Web Animations specification. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::localTime const): (WebCore::AnimationEffect::getComputedTiming): * animation/AnimationEffect.h: * animation/AnimationEffect.idl: * animation/AnimationEffectTiming.cpp: (WebCore::AnimationEffectTiming::AnimationEffectTiming): (WebCore::AnimationEffectTiming::setIterationStart): (WebCore::AnimationEffectTiming::setIterations): (WebCore::AnimationEffectTiming::bindingsDuration const): (WebCore::AnimationEffectTiming::setBindingsDuration): (WebCore::AnimationEffectTiming::endTime const): (WebCore::AnimationEffectTiming::activeDuration const): * animation/AnimationEffectTiming.h: * animation/AnimationEffectTiming.idl: * animation/AnimationPlaybackEvent.cpp: (WebCore::AnimationPlaybackEvent::bindingsCurrentTime const): (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::bindingsCurrentTime): * animation/ComputedTimingProperties.h: Added. * animation/ComputedTimingProperties.idl: Added. We set nullable double values to a default value of "null" since otherwise setting those properties to a null value would not set the properties in the converted JS dictionary. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): Handle new timing properties passed in the KeyframeEffectOptions dictionary. (WebCore::KeyframeEffect::applyAtLocalTime): (WebCore::KeyframeEffect::getAnimatedStyle): (WebCore::KeyframeEffect::startOrStopAccelerated): * animation/WebAnimation.cpp: (WebCore::WebAnimation::bindingsStartTime const): (WebCore::WebAnimation::bindingsCurrentTime const): (WebCore::WebAnimation::effectEndTime const): (WebCore::WebAnimation::timeToNextRequiredTick const): * animation/WebAnimationUtilities.h: Added. (WebCore::secondsToWebAnimationsAPITime): LayoutTests: Update expectations with progressions and new failure points now we expose more of the API. * http/wpt/web-animations/animation-model/animation-types/discrete-animation-expected.txt: * http/wpt/web-animations/interfaces/Animatable/animate-expected.txt: * http/wpt/web-animations/interfaces/Animation/finish-expected.txt: * http/wpt/web-animations/interfaces/Animation/finished-expected.txt: * http/wpt/web-animations/interfaces/Animation/pause-expected.txt: * http/wpt/web-animations/interfaces/Animation/play-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/delay-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/direction-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/duration-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/easing-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/endDelay-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/fill-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/iterationStart-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/iterations-expected.txt: * http/wpt/web-animations/interfaces/AnimationTimeline/document-timeline-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/local-time-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-animation-start-time-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: * http/wpt/wk-web-animations/timing-model/keyframe-effect-interface-timing-duration.html: Canonical link: https://commits.webkit.org/197684@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227208 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-19 17:56:53 +00:00
/*
* Copyright (C) 2018 Apple Inc. All rights reserved.
*
* 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.
*/
[
JSGenerateToJSObject
[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
] dictionary ComputedEffectTiming : EffectTiming {
[Web Animations] Expose timing properties (delay, endDelay, fill, iterationStart, iterations, direction) and getComputedTiming() https://bugs.webkit.org/show_bug.cgi?id=181857 <rdar://problem/36660081> Reviewed by Dean Jackson. Source/WebCore: We start the work to implement the rest of the Web Animations timing and animation model by exposing more properties on AnimationEffectTiming to control delay (delay, endDelay), looping (iterationStart, iterations), fill and direction. Additionally, we expose the getComputedTiming() method on AnimationEffect, although it currently lacks some computed properties that will come in later patch as we implement various processes defined by the spec. We also update the existing duration() method on AnimationEffectTiming to be called iterationDuration() to match the terms used in the specification. Finally, we make all new properties, and update existing ones, that expose a time value go through the new utility function secondsToWebAnimationsAPITime() to guarantee rounded values with microseconds precision, as advised by the Web Animations specification. * CMakeLists.txt: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * animation/AnimationEffect.cpp: (WebCore::AnimationEffect::localTime const): (WebCore::AnimationEffect::getComputedTiming): * animation/AnimationEffect.h: * animation/AnimationEffect.idl: * animation/AnimationEffectTiming.cpp: (WebCore::AnimationEffectTiming::AnimationEffectTiming): (WebCore::AnimationEffectTiming::setIterationStart): (WebCore::AnimationEffectTiming::setIterations): (WebCore::AnimationEffectTiming::bindingsDuration const): (WebCore::AnimationEffectTiming::setBindingsDuration): (WebCore::AnimationEffectTiming::endTime const): (WebCore::AnimationEffectTiming::activeDuration const): * animation/AnimationEffectTiming.h: * animation/AnimationEffectTiming.idl: * animation/AnimationPlaybackEvent.cpp: (WebCore::AnimationPlaybackEvent::bindingsCurrentTime const): (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const): * animation/AnimationTimeline.cpp: (WebCore::AnimationTimeline::bindingsCurrentTime): * animation/ComputedTimingProperties.h: Added. * animation/ComputedTimingProperties.idl: Added. We set nullable double values to a default value of "null" since otherwise setting those properties to a null value would not set the properties in the converted JS dictionary. * animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::create): Handle new timing properties passed in the KeyframeEffectOptions dictionary. (WebCore::KeyframeEffect::applyAtLocalTime): (WebCore::KeyframeEffect::getAnimatedStyle): (WebCore::KeyframeEffect::startOrStopAccelerated): * animation/WebAnimation.cpp: (WebCore::WebAnimation::bindingsStartTime const): (WebCore::WebAnimation::bindingsCurrentTime const): (WebCore::WebAnimation::effectEndTime const): (WebCore::WebAnimation::timeToNextRequiredTick const): * animation/WebAnimationUtilities.h: Added. (WebCore::secondsToWebAnimationsAPITime): LayoutTests: Update expectations with progressions and new failure points now we expose more of the API. * http/wpt/web-animations/animation-model/animation-types/discrete-animation-expected.txt: * http/wpt/web-animations/interfaces/Animatable/animate-expected.txt: * http/wpt/web-animations/interfaces/Animation/finish-expected.txt: * http/wpt/web-animations/interfaces/Animation/finished-expected.txt: * http/wpt/web-animations/interfaces/Animation/pause-expected.txt: * http/wpt/web-animations/interfaces/Animation/play-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/delay-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/direction-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/duration-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/easing-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/endDelay-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/fill-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/iterationStart-expected.txt: * http/wpt/web-animations/interfaces/AnimationEffectTiming/iterations-expected.txt: * http/wpt/web-animations/interfaces/AnimationTimeline/document-timeline-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/local-time-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-animation-start-time-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: * http/wpt/wk-web-animations/timing-model/keyframe-effect-interface-timing-duration.html: Canonical link: https://commits.webkit.org/197684@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227208 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-19 17:56:53 +00:00
unrestricted double endTime;
unrestricted double activeDuration;
double? localTime = null;
double? progress = null;
unrestricted double? currentIteration = null;
};