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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 ElementAnimations::ElementAnimations() | 38 ElementAnimations::ElementAnimations() |
39 : m_animationStyleChange(false) | 39 : m_animationStyleChange(false) |
40 { | 40 { |
41 } | 41 } |
42 | 42 |
43 ElementAnimations::~ElementAnimations() | 43 ElementAnimations::~ElementAnimations() |
44 { | 44 { |
| 45 #if !ENABLE(OILPAN) |
| 46 ASSERT(m_effects.isEmpty()); |
| 47 #endif |
45 } | 48 } |
46 | 49 |
| 50 #if !ENABLE(OILPAN) |
| 51 void ElementAnimations::dispose() |
| 52 { |
| 53 // The notifyElementDestroyed() is called for elements that happen to live |
| 54 // longer than the KeyframeEffect. This undeterminism is fine because |
| 55 // all the notifyElementDestroyed() does is to clear the raw pointers |
| 56 // held by the KeyframeEffect. |
| 57 for (KeyframeEffect* effect : m_effects) |
| 58 effect->notifyElementDestroyed(); |
| 59 m_effects.clear(); |
| 60 } |
| 61 #endif |
| 62 |
47 void ElementAnimations::updateAnimationFlags(ComputedStyle& style) | 63 void ElementAnimations::updateAnimationFlags(ComputedStyle& style) |
48 { | 64 { |
49 for (const auto& entry : m_animations) { | 65 for (const auto& entry : m_animations) { |
50 const Animation& animation = *entry.key; | 66 const Animation& animation = *entry.key; |
51 ASSERT(animation.effect()); | 67 ASSERT(animation.effect()); |
52 // FIXME: Needs to consider AnimationGroup once added. | 68 // FIXME: Needs to consider AnimationGroup once added. |
53 ASSERT(animation.effect()->isKeyframeEffect()); | 69 ASSERT(animation.effect()->isKeyframeEffect()); |
54 const KeyframeEffect& effect = *toKeyframeEffect(animation.effect()); | 70 const KeyframeEffect& effect = *toKeyframeEffect(animation.effect()); |
55 if (effect.isCurrent()) { | 71 if (effect.isCurrent()) { |
56 if (effect.affects(PropertyHandle(CSSPropertyOpacity))) | 72 if (effect.affects(PropertyHandle(CSSPropertyOpacity))) |
(...skipping 24 matching lines...) Expand all Loading... |
81 { | 97 { |
82 for (const auto& entry : m_animations) | 98 for (const auto& entry : m_animations) |
83 entry.key->restartAnimationOnCompositor(); | 99 entry.key->restartAnimationOnCompositor(); |
84 } | 100 } |
85 | 101 |
86 DEFINE_TRACE(ElementAnimations) | 102 DEFINE_TRACE(ElementAnimations) |
87 { | 103 { |
88 visitor->trace(m_cssAnimations); | 104 visitor->trace(m_cssAnimations); |
89 visitor->trace(m_defaultStack); | 105 visitor->trace(m_defaultStack); |
90 visitor->trace(m_animations); | 106 visitor->trace(m_animations); |
| 107 #if !ENABLE(OILPAN) |
| 108 visitor->trace(m_effects); |
| 109 #endif |
91 } | 110 } |
92 | 111 |
93 const ComputedStyle* ElementAnimations::baseComputedStyle() const | 112 const ComputedStyle* ElementAnimations::baseComputedStyle() const |
94 { | 113 { |
95 #if !ENABLE(ASSERT) | 114 #if !ENABLE(ASSERT) |
96 if (isAnimationStyleChange()) | 115 if (isAnimationStyleChange()) |
97 return m_baseComputedStyle.get(); | 116 return m_baseComputedStyle.get(); |
98 #endif | 117 #endif |
99 return nullptr; | 118 return nullptr; |
100 } | 119 } |
(...skipping 21 matching lines...) Expand all Loading... |
122 // TODO(rune@opera.com): The FontFaceCache version number may be increased w
ithout forcing | 141 // TODO(rune@opera.com): The FontFaceCache version number may be increased w
ithout forcing |
123 // a style recalc (see crbug.com/471079). ComputedStyle objects created with
different cache | 142 // a style recalc (see crbug.com/471079). ComputedStyle objects created with
different cache |
124 // versions will not be considered equal as Font::operator== will compare ve
rsions, hence | 143 // versions will not be considered equal as Font::operator== will compare ve
rsions, hence |
125 // ComputedStyle::operator== will return false. We avoid using baseComputedS
tyle (the check for | 144 // ComputedStyle::operator== will return false. We avoid using baseComputedS
tyle (the check for |
126 // isFallbackValid()) in that case to avoid triggering the ComputedStyle com
parison ASSERT | 145 // isFallbackValid()) in that case to avoid triggering the ComputedStyle com
parison ASSERT |
127 // in updateBaseComputedStyle. | 146 // in updateBaseComputedStyle. |
128 return m_animationStyleChange && (!m_baseComputedStyle || m_baseComputedStyl
e->font().isFallbackValid()); | 147 return m_animationStyleChange && (!m_baseComputedStyle || m_baseComputedStyl
e->font().isFallbackValid()); |
129 } | 148 } |
130 | 149 |
131 } // namespace blink | 150 } // namespace blink |
OLD | NEW |