diff options
Diffstat (limited to 'Source/WebCore/page/animation/CompositeAnimation.h')
-rw-r--r-- | Source/WebCore/page/animation/CompositeAnimation.h | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/Source/WebCore/page/animation/CompositeAnimation.h b/Source/WebCore/page/animation/CompositeAnimation.h index 48c679ef2..715de586d 100644 --- a/Source/WebCore/page/animation/CompositeAnimation.h +++ b/Source/WebCore/page/animation/CompositeAnimation.h @@ -10,7 +10,7 @@ * 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. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * 3. Neither the name of Apple Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -26,8 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef CompositeAnimation_h -#define CompositeAnimation_h +#pragma once #include "ImplicitAnimation.h" #include "KeyframeAnimation.h" @@ -37,30 +36,32 @@ namespace WebCore { -class AnimationControllerPrivate; -class AnimationController; +class CSSAnimationControllerPrivate; +class CSSAnimationController; class RenderElement; class RenderStyle; // A CompositeAnimation represents a collection of animations that are running // on a single RenderElement, such as a number of properties transitioning at once. class CompositeAnimation : public RefCounted<CompositeAnimation> { + WTF_MAKE_FAST_ALLOCATED; public: - static PassRefPtr<CompositeAnimation> create(AnimationControllerPrivate* animationController) + static Ref<CompositeAnimation> create(CSSAnimationControllerPrivate& animationController) { - return adoptRef(new CompositeAnimation(animationController)); + return adoptRef(*new CompositeAnimation(animationController)); }; ~CompositeAnimation(); void clearRenderer(); - PassRef<RenderStyle> animate(RenderElement&, RenderStyle* currentStyle, RenderStyle& targetStyle); - PassRefPtr<RenderStyle> getAnimatedStyle() const; + bool animate(RenderElement&, const RenderStyle* currentStyle, const RenderStyle& targetStyle, std::unique_ptr<RenderStyle>& blendedStyle); + std::unique_ptr<RenderStyle> getAnimatedStyle() const; + bool computeExtentOfTransformAnimation(LayoutRect&) const; double timeToNextService() const; - AnimationControllerPrivate* animationController() const { return m_animationController; } + CSSAnimationControllerPrivate& animationController() const { return m_animationController; } void suspendAnimations(); void resumeAnimations(); @@ -68,9 +69,9 @@ public: bool hasAnimations() const { return !m_transitions.isEmpty() || !m_keyframeAnimations.isEmpty(); } - bool isAnimatingProperty(CSSPropertyID, bool acceleratedOnly, bool isRunningNow) const; + bool isAnimatingProperty(CSSPropertyID, bool acceleratedOnly, AnimationBase::RunningState) const; - PassRefPtr<KeyframeAnimation> getAnimationForProperty(CSSPropertyID) const; + KeyframeAnimation* animationForProperty(CSSPropertyID) const; void overrideImplicitAnimations(CSSPropertyID); void resumeOverriddenImplicitAnimations(CSSPropertyID); @@ -79,22 +80,30 @@ public: bool pauseTransitionAtTime(CSSPropertyID, double); unsigned numberOfActiveAnimations() const; +#if ENABLE(CSS_ANIMATIONS_LEVEL_2) + bool hasScrollTriggeredAnimation() const { return m_hasScrollTriggeredAnimation; } +#endif + + bool hasAnimationThatDependsOnLayout() const { return m_hasAnimationThatDependsOnLayout; } + private: - CompositeAnimation(AnimationControllerPrivate*); + CompositeAnimation(CSSAnimationControllerPrivate&); - void updateTransitions(RenderElement*, RenderStyle* currentStyle, RenderStyle* targetStyle); - void updateKeyframeAnimations(RenderElement*, RenderStyle* currentStyle, RenderStyle* targetStyle); + void updateTransitions(RenderElement*, const RenderStyle* currentStyle, const RenderStyle* targetStyle); + void updateKeyframeAnimations(RenderElement*, const RenderStyle* currentStyle, const RenderStyle* targetStyle); typedef HashMap<int, RefPtr<ImplicitAnimation>> CSSPropertyTransitionsMap; - typedef HashMap<AtomicStringImpl*, RefPtr<KeyframeAnimation>> AnimationNameMap; + typedef HashMap<AtomicStringImpl*, RefPtr<KeyframeAnimation>> AnimationNameMap; - AnimationControllerPrivate* m_animationController; + CSSAnimationControllerPrivate& m_animationController; CSSPropertyTransitionsMap m_transitions; AnimationNameMap m_keyframeAnimations; Vector<AtomicStringImpl*> m_keyframeAnimationOrderMap; bool m_suspended; + bool m_hasAnimationThatDependsOnLayout { false }; +#if ENABLE(CSS_ANIMATIONS_LEVEL_2) + bool m_hasScrollTriggeredAnimation { false }; +#endif }; } // namespace WebCore - -#endif // CompositeAnimation_h |