| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 // 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 |
| 58 // during a style recalc. CSS Transitions are included in this stack. | 58 // during a style recalc. CSS Transitions are included in this stack. |
| 59 AnimationStack& defaultStack() { return m_defaultStack; } | 59 AnimationStack& defaultStack() { return m_defaultStack; } |
| 60 // 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 |
| 61 // 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 |
| 62 // player is kept here. | 62 // player is kept here. |
| 63 CSSAnimations& cssAnimations() { return m_cssAnimations; } | 63 CSSAnimations& cssAnimations() { return m_cssAnimations; } |
| 64 const CSSAnimations& cssAnimations() const { return m_cssAnimations; } | 64 const CSSAnimations& cssAnimations() const { return m_cssAnimations; } |
| 65 | 65 |
| 66 typedef HashMap<AnimationPlayer*, int> AnimationPlayerCountedSet; | 66 typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<AnimationPlayer>, int> Anim
ationPlayerCountedSet; |
| 67 // AnimationPlayers which have animations targeting this element. | 67 // AnimationPlayers which have animations targeting this element. |
| 68 const AnimationPlayerCountedSet& players() const { return m_players; } | 68 const AnimationPlayerCountedSet& players() const { return m_players; } |
| 69 void addPlayer(AnimationPlayer*); | 69 void addPlayer(AnimationPlayer*); |
| 70 void removePlayer(AnimationPlayer*); | 70 void removePlayer(AnimationPlayer*); |
| 71 | 71 |
| 72 #if ENABLE(OILPAN) |
| 73 bool isEmpty() const { return m_defaultStack.isEmpty() && m_cssAnimations.is
Empty(); } |
| 74 #else |
| 72 bool isEmpty() const { return m_defaultStack.isEmpty() && m_cssAnimations.is
Empty() && m_animations.isEmpty(); } | 75 bool isEmpty() const { return m_defaultStack.isEmpty() && m_cssAnimations.is
Empty() && m_animations.isEmpty(); } |
| 76 #endif |
| 73 | 77 |
| 74 void cancelAnimationOnCompositor(); | 78 void cancelAnimationOnCompositor(); |
| 75 | 79 |
| 76 void updateAnimationFlags(RenderStyle&); | 80 void updateAnimationFlags(RenderStyle&); |
| 77 void setAnimationStyleChange(bool animationStyleChange) { m_animationStyleCh
ange = animationStyleChange; } | 81 void setAnimationStyleChange(bool animationStyleChange) { m_animationStyleCh
ange = animationStyleChange; } |
| 78 | 82 |
| 83 #if !ENABLE(OILPAN) |
| 79 void addAnimation(Animation* animation) { m_animations.append(animation); } | 84 void addAnimation(Animation* animation) { m_animations.append(animation); } |
| 80 void notifyAnimationDestroyed(Animation* animation) { m_animations.remove(m_
animations.find(animation)); } | 85 void notifyAnimationDestroyed(Animation* animation) { m_animations.remove(m_
animations.find(animation)); } |
| 86 #endif |
| 81 | 87 |
| 82 void trace(Visitor*); | 88 void trace(Visitor*); |
| 83 | 89 |
| 84 private: | 90 private: |
| 85 bool isAnimationStyleChange() const { return m_animationStyleChange; } | 91 bool isAnimationStyleChange() const { return m_animationStyleChange; } |
| 86 | 92 |
| 87 AnimationStack m_defaultStack; | 93 AnimationStack m_defaultStack; |
| 88 CSSAnimations m_cssAnimations; | 94 CSSAnimations m_cssAnimations; |
| 89 AnimationPlayerCountedSet m_players; | 95 AnimationPlayerCountedSet m_players; |
| 90 bool m_animationStyleChange; | 96 bool m_animationStyleChange; |
| 91 | 97 |
| 92 // This is to avoid a reference cycle that keeps Elements alive and | 98 #if !ENABLE(OILPAN) |
| 93 // won't be needed once Element and Animation are moved to Oilpan. | 99 // FIXME: Oilpan: This is to avoid a reference cycle that keeps Elements ali
ve |
| 100 // and won't be needed once the Node hierarchy becomes traceable. |
| 94 Vector<Animation*> m_animations; | 101 Vector<Animation*> m_animations; |
| 95 | |
| 96 #if ENABLE(OILPAN) | |
| 97 // Keep a back reference to the target Element, so that this object | |
| 98 // will be finalized during the same GC sweep as the target (as the | |
| 99 // Element keeps a reference in the other direction via its | |
| 100 // rare data.) This is done so that we can accurately notify the | |
| 101 // the Element as destroyed to the above vector of Animations in | |
| 102 // the ActiveAnimations finalizer. | |
| 103 Member<Element> m_target; | |
| 104 #endif | 102 #endif |
| 105 | 103 |
| 106 // CSSAnimations checks if a style change is due to animation. | 104 // CSSAnimations checks if a style change is due to animation. |
| 107 friend class CSSAnimations; | 105 friend class CSSAnimations; |
| 108 }; | 106 }; |
| 109 | 107 |
| 110 } // namespace WebCore | 108 } // namespace WebCore |
| 111 | 109 |
| 112 #endif | 110 #endif |
| OLD | NEW |