haikuwebkit/Source/WebCore/animation/AnimationEffectPhase.h

33 lines
1.4 KiB
C
Raw Permalink Normal View History

[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
/*
* 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.
*/
#pragma once
namespace WebCore {
enum class AnimationEffectPhase : uint8_t { Before, Active, After, Idle };
} // namespace WebCore