| 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 25 matching lines...) Expand all Loading... |
| 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) | 45 #if !ENABLE(OILPAN) |
| 46 for (Animation* animation : m_animations) | 46 for (KeyframeEffect* effect : m_effects) |
| 47 animation->notifyElementDestroyed(); | 47 effect->notifyElementDestroyed(); |
| 48 m_animations.clear(); | 48 m_effects.clear(); |
| 49 #endif | 49 #endif |
| 50 } | 50 } |
| 51 | 51 |
| 52 void ElementAnimations::updateAnimationFlags(ComputedStyle& style) | 52 void ElementAnimations::updateAnimationFlags(ComputedStyle& style) |
| 53 { | 53 { |
| 54 for (const auto& entry : m_players) { | 54 for (const auto& entry : m_animations) { |
| 55 const AnimationPlayer& player = *entry.key; | 55 const Animation& animation = *entry.key; |
| 56 ASSERT(player.source()); | 56 ASSERT(animation.source()); |
| 57 // FIXME: Needs to consider AnimationGroup once added. | 57 // FIXME: Needs to consider AnimationGroup once added. |
| 58 ASSERT(player.source()->isAnimation()); | 58 ASSERT(animation.source()->isAnimation()); |
| 59 const Animation& animation = *toAnimation(player.source()); | 59 const KeyframeEffect& effect = *toKeyframeEffect(animation.source()); |
| 60 if (animation.isCurrent()) { | 60 if (effect.isCurrent()) { |
| 61 if (animation.affects(PropertyHandle(CSSPropertyOpacity))) | 61 if (effect.affects(PropertyHandle(CSSPropertyOpacity))) |
| 62 style.setHasCurrentOpacityAnimation(true); | 62 style.setHasCurrentOpacityAnimation(true); |
| 63 if (animation.affects(PropertyHandle(CSSPropertyTransform))) | 63 if (effect.affects(PropertyHandle(CSSPropertyTransform))) |
| 64 style.setHasCurrentTransformAnimation(true); | 64 style.setHasCurrentTransformAnimation(true); |
| 65 if (animation.affects(PropertyHandle(CSSPropertyWebkitFilter))) | 65 if (effect.affects(PropertyHandle(CSSPropertyWebkitFilter))) |
| 66 style.setHasCurrentFilterAnimation(true); | 66 style.setHasCurrentFilterAnimation(true); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 if (style.hasCurrentOpacityAnimation()) | 70 if (style.hasCurrentOpacityAnimation()) |
| 71 style.setIsRunningOpacityAnimationOnCompositor(m_defaultStack.hasActiveA
nimationsOnCompositor(CSSPropertyOpacity)); | 71 style.setIsRunningOpacityAnimationOnCompositor(m_defaultStack.hasActiveA
nimationsOnCompositor(CSSPropertyOpacity)); |
| 72 if (style.hasCurrentTransformAnimation()) | 72 if (style.hasCurrentTransformAnimation()) |
| 73 style.setIsRunningTransformAnimationOnCompositor(m_defaultStack.hasActiv
eAnimationsOnCompositor(CSSPropertyTransform)); | 73 style.setIsRunningTransformAnimationOnCompositor(m_defaultStack.hasActiv
eAnimationsOnCompositor(CSSPropertyTransform)); |
| 74 if (style.hasCurrentFilterAnimation()) | 74 if (style.hasCurrentFilterAnimation()) |
| 75 style.setIsRunningFilterAnimationOnCompositor(m_defaultStack.hasActiveAn
imationsOnCompositor(CSSPropertyWebkitFilter)); | 75 style.setIsRunningFilterAnimationOnCompositor(m_defaultStack.hasActiveAn
imationsOnCompositor(CSSPropertyWebkitFilter)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void ElementAnimations::restartAnimationOnCompositor() | 78 void ElementAnimations::restartAnimationOnCompositor() |
| 79 { | 79 { |
| 80 for (const auto& entry : m_players) | 80 for (const auto& entry : m_animations) |
| 81 entry.key->restartAnimationOnCompositor(); | 81 entry.key->restartAnimationOnCompositor(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 DEFINE_TRACE(ElementAnimations) | 84 DEFINE_TRACE(ElementAnimations) |
| 85 { | 85 { |
| 86 #if ENABLE(OILPAN) | 86 #if ENABLE(OILPAN) |
| 87 visitor->trace(m_cssAnimations); | 87 visitor->trace(m_cssAnimations); |
| 88 visitor->trace(m_defaultStack); | 88 visitor->trace(m_defaultStack); |
| 89 visitor->trace(m_players); | 89 visitor->trace(m_animations); |
| 90 #endif | 90 #endif |
| 91 } | 91 } |
| 92 | 92 |
| 93 const ComputedStyle* ElementAnimations::baseComputedStyle() const | 93 const ComputedStyle* ElementAnimations::baseComputedStyle() const |
| 94 { | 94 { |
| 95 #if !ENABLE(ASSERT) | 95 #if !ENABLE(ASSERT) |
| 96 if (isAnimationStyleChange()) | 96 if (isAnimationStyleChange()) |
| 97 return m_baseComputedStyle.get(); | 97 return m_baseComputedStyle.get(); |
| 98 #endif | 98 #endif |
| 99 return nullptr; | 99 return nullptr; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 122 // TODO(rune@opera.com): The FontFaceCache version number may be increased w
ithout forcing | 122 // 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 | 123 // 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 | 124 // 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 | 125 // 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 | 126 // isFallbackValid()) in that case to avoid triggering the ComputedStyle com
parison ASSERT |
| 127 // in updateBaseComputedStyle. | 127 // in updateBaseComputedStyle. |
| 128 return m_animationStyleChange && (!m_baseComputedStyle || m_baseComputedStyl
e->font().isFallbackValid()); | 128 return m_animationStyleChange && (!m_baseComputedStyle || m_baseComputedStyl
e->font().isFallbackValid()); |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace blink | 131 } // namespace blink |
| OLD | NEW |