| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #ifndef SKY_ENGINE_CORE_ANIMATION_ANIMATION_H_ | |
| 32 #define SKY_ENGINE_CORE_ANIMATION_ANIMATION_H_ | |
| 33 | |
| 34 #include "sky/engine/core/animation/AnimationEffect.h" | |
| 35 #include "sky/engine/core/animation/AnimationNode.h" | |
| 36 #include "sky/engine/core/animation/EffectInput.h" | |
| 37 #include "sky/engine/core/animation/TimingInput.h" | |
| 38 #include "sky/engine/wtf/RefPtr.h" | |
| 39 | |
| 40 namespace blink { | |
| 41 | |
| 42 class Element; | |
| 43 class ExceptionState; | |
| 44 class SampledEffect; | |
| 45 | |
| 46 class Animation final : public AnimationNode { | |
| 47 DEFINE_WRAPPERTYPEINFO(); | |
| 48 public: | |
| 49 enum Priority { DefaultPriority, TransitionPriority }; | |
| 50 | |
| 51 static PassRefPtr<Animation> create(Element*, PassRefPtr<AnimationEffect> ef
fect, const Timing&, Priority = DefaultPriority, PassOwnPtr<EventDelegate> = nul
lptr); | |
| 52 // Web Animations API Bindings constructors. | |
| 53 static PassRefPtr<Animation> create(Element*, ExceptionState&); | |
| 54 static PassRefPtr<Animation> create(Element*, double duration, ExceptionStat
e&); | |
| 55 | |
| 56 virtual ~Animation(); | |
| 57 | |
| 58 virtual bool isAnimation() const override { return true; } | |
| 59 | |
| 60 bool affects(CSSPropertyID) const; | |
| 61 const AnimationEffect* effect() const { return m_effect.get(); } | |
| 62 AnimationEffect* effect() { return m_effect.get(); } | |
| 63 Priority priority() const { return m_priority; } | |
| 64 Element* target() { return m_target; } | |
| 65 | |
| 66 void notifySampledEffectRemovedFromAnimationStack(); | |
| 67 void notifyElementDestroyed(); | |
| 68 | |
| 69 protected: | |
| 70 void applyEffects(); | |
| 71 void clearEffects(); | |
| 72 virtual void updateChildrenAndEffects() const override; | |
| 73 virtual void attach(AnimationPlayer*) override; | |
| 74 virtual void detach() override; | |
| 75 virtual void specifiedTimingChanged() override; | |
| 76 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi
me, double timeToNextIteration) const override; | |
| 77 | |
| 78 private: | |
| 79 Animation(Element*, PassRefPtr<AnimationEffect> effect, const Timing&, Prior
ity, PassOwnPtr<EventDelegate>); | |
| 80 | |
| 81 RawPtr<Element> m_target; | |
| 82 RefPtr<AnimationEffect> m_effect; | |
| 83 RawPtr<SampledEffect> m_sampledEffect; | |
| 84 | |
| 85 Priority m_priority; | |
| 86 | |
| 87 friend class AnimationAnimationV8Test; | |
| 88 }; | |
| 89 | |
| 90 DEFINE_TYPE_CASTS(Animation, AnimationNode, animationNode, animationNode->isAnim
ation(), animationNode.isAnimation()); | |
| 91 | |
| 92 } // namespace blink | |
| 93 | |
| 94 #endif // SKY_ENGINE_CORE_ANIMATION_ANIMATION_H_ | |
| OLD | NEW |