| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 #include "core/animation/AnimationStack.h" | 34 #include "core/animation/AnimationStack.h" |
| 35 #include "core/animation/css/CSSAnimations.h" | 35 #include "core/animation/css/CSSAnimations.h" |
| 36 #include "wtf/HashCountedSet.h" | 36 #include "wtf/HashCountedSet.h" |
| 37 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
| 38 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
| 39 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 class CSSAnimations; |
| 43 class RenderObject; | 44 class RenderObject; |
| 44 class Element; | 45 class Element; |
| 45 | 46 |
| 46 // FIXME: Move these to CompositorAnimations | 47 // FIXME: Move these to CompositorAnimations |
| 47 bool shouldCompositeForActiveAnimations(const RenderObject&); | 48 bool shouldCompositeForActiveAnimations(const RenderObject&); |
| 48 bool hasActiveAnimations(const RenderObject&, CSSPropertyID); | 49 bool hasActiveAnimations(const RenderObject&, CSSPropertyID); |
| 49 bool hasActiveAnimationsOnCompositor(const RenderObject&, CSSPropertyID); | 50 bool hasActiveAnimationsOnCompositor(const RenderObject&, CSSPropertyID); |
| 50 | 51 |
| 51 class ActiveAnimations { | 52 class ActiveAnimations { |
| 52 public: | 53 public: |
| 54 ActiveAnimations() |
| 55 : m_animationStyleChange(false) { } |
| 56 |
| 53 // Animations that are currently active for this element, their effects will
be applied | 57 // Animations that are currently active for this element, their effects will
be applied |
| 54 // during a style recalc. CSS Transitions are included in this stack. | 58 // during a style recalc. CSS Transitions are included in this stack. |
| 55 AnimationStack& defaultStack() { return m_defaultStack; } | 59 AnimationStack& defaultStack() { return m_defaultStack; } |
| 56 // Tracks the state of active CSS Animations and Transitions. The individual
animations | 60 // Tracks the state of active CSS Animations and Transitions. The individual
animations |
| 57 // will also be part of the default stack, but the mapping betwen animation
name and | 61 // will also be part of the default stack, but the mapping betwen animation
name and |
| 58 // player is kept here. | 62 // player is kept here. |
| 59 CSSAnimations& cssAnimations() { return m_cssAnimations; } | 63 CSSAnimations& cssAnimations() { return m_cssAnimations; } |
| 60 const CSSAnimations& cssAnimations() const { return m_cssAnimations; } | 64 const CSSAnimations& cssAnimations() const { return m_cssAnimations; } |
| 61 | 65 |
| 62 typedef HashCountedSet<Player*> PlayerSet; | 66 typedef HashCountedSet<Player*> PlayerSet; |
| 63 // Players which have animations targeting this element. | 67 // Players which have animations targeting this element. |
| 64 const PlayerSet& players() const { return m_players; } | 68 const PlayerSet& players() const { return m_players; } |
| 65 PlayerSet& players() { return m_players; } | 69 PlayerSet& players() { return m_players; } |
| 66 | 70 |
| 67 bool isEmpty() const { return m_defaultStack.isEmpty() && m_cssAnimations.is
Empty(); } | 71 bool isEmpty() const { return m_defaultStack.isEmpty() && m_cssAnimations.is
Empty(); } |
| 68 | 72 |
| 69 bool hasActiveAnimations(CSSPropertyID) const; | 73 bool hasActiveAnimations(CSSPropertyID) const; |
| 70 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; | 74 bool hasActiveAnimationsOnCompositor(CSSPropertyID) const; |
| 71 void cancelAnimationOnCompositor(); | 75 void cancelAnimationOnCompositor(); |
| 72 | 76 |
| 77 void setAnimationStyleChange(bool animationStyleChange) { m_animationStyleCh
ange = animationStyleChange; } |
| 78 |
| 73 private: | 79 private: |
| 80 bool isAnimationStyleChange() const { return m_animationStyleChange; } |
| 81 |
| 74 AnimationStack m_defaultStack; | 82 AnimationStack m_defaultStack; |
| 75 CSSAnimations m_cssAnimations; | 83 CSSAnimations m_cssAnimations; |
| 76 PlayerSet m_players; | 84 PlayerSet m_players; |
| 85 bool m_animationStyleChange; |
| 86 |
| 87 // CSSAnimations checks if a style change is due to animation. |
| 88 friend class CSSAnimations; |
| 77 }; | 89 }; |
| 78 | 90 |
| 79 } // namespace WebCore | 91 } // namespace WebCore |
| 80 | 92 |
| 81 #endif | 93 #endif |
| OLD | NEW |