| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 bool CSSAnimations::isTransitionAnimationForInspector( | 225 bool CSSAnimations::isTransitionAnimationForInspector( |
| 226 const Animation& animation) const { | 226 const Animation& animation) const { |
| 227 for (const auto& it : m_transitions) { | 227 for (const auto& it : m_transitions) { |
| 228 if (it.value.animation->sequenceNumber() == animation.sequenceNumber()) | 228 if (it.value.animation->sequenceNumber() == animation.sequenceNumber()) |
| 229 return true; | 229 return true; |
| 230 } | 230 } |
| 231 return false; | 231 return false; |
| 232 } | 232 } |
| 233 | 233 |
| 234 void CSSAnimations::calculateUpdate(const Element* animatingElement, | 234 void CSSAnimations::calculateCompositorAndTransitionUpdate( |
| 235 Element& element, | 235 const Element* animatingElement, |
| 236 const ComputedStyle& style, | 236 Element& element, |
| 237 ComputedStyle* parentStyle, | 237 const ComputedStyle& style, |
| 238 CSSAnimationUpdate& animationUpdate, | 238 ComputedStyle* parentStyle, |
| 239 StyleResolver* resolver) { | 239 CSSAnimationUpdate& animationUpdate) { |
| 240 calculateCompositorAnimationUpdate(animationUpdate, animatingElement, element, | 240 calculateCompositorAnimationUpdate(animationUpdate, animatingElement, element, |
| 241 style, parentStyle); | 241 style, parentStyle); |
| 242 calculateAnimationUpdate(animationUpdate, animatingElement, element, style, | |
| 243 parentStyle, resolver); | |
| 244 calculateAnimationActiveInterpolations(animationUpdate, animatingElement); | |
| 245 calculateTransitionUpdate(animationUpdate, animatingElement, style); | 242 calculateTransitionUpdate(animationUpdate, animatingElement, style); |
| 246 calculateTransitionActiveInterpolations(animationUpdate, animatingElement); | |
| 247 } | 243 } |
| 248 | 244 |
| 249 static const KeyframeEffectModelBase* getKeyframeEffectModelBase( | 245 static const KeyframeEffectModelBase* getKeyframeEffectModelBase( |
| 250 const AnimationEffectReadOnly* effect) { | 246 const AnimationEffectReadOnly* effect) { |
| 251 if (!effect) | 247 if (!effect) |
| 252 return nullptr; | 248 return nullptr; |
| 253 const EffectModel* model = nullptr; | 249 const EffectModel* model = nullptr; |
| 254 if (effect->isKeyframeEffectReadOnly()) | 250 if (effect->isKeyframeEffectReadOnly()) |
| 255 model = toKeyframeEffectReadOnly(effect)->model(); | 251 model = toKeyframeEffectReadOnly(effect)->model(); |
| 256 else if (effect->isInertEffect()) | 252 else if (effect->isInertEffect()) |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 } | 416 } |
| 421 } | 417 } |
| 422 | 418 |
| 423 for (size_t i = 0; i < cancelRunningAnimationFlags.size(); i++) { | 419 for (size_t i = 0; i < cancelRunningAnimationFlags.size(); i++) { |
| 424 if (cancelRunningAnimationFlags[i]) { | 420 if (cancelRunningAnimationFlags[i]) { |
| 425 DCHECK(cssAnimations && !isAnimationStyleChange); | 421 DCHECK(cssAnimations && !isAnimationStyleChange); |
| 426 update.cancelAnimation(i, | 422 update.cancelAnimation(i, |
| 427 *cssAnimations->m_runningAnimations[i]->animation); | 423 *cssAnimations->m_runningAnimations[i]->animation); |
| 428 } | 424 } |
| 429 } | 425 } |
| 426 calculateAnimationActiveInterpolations(update, animatingElement); |
| 430 } | 427 } |
| 431 | 428 |
| 432 void CSSAnimations::snapshotCompositorKeyframes( | 429 void CSSAnimations::snapshotCompositorKeyframes( |
| 433 Element& element, | 430 Element& element, |
| 434 CSSAnimationUpdate& update, | 431 CSSAnimationUpdate& update, |
| 435 const ComputedStyle& style, | 432 const ComputedStyle& style, |
| 436 const ComputedStyle* parentStyle) { | 433 const ComputedStyle* parentStyle) { |
| 437 const auto& snapshot = [&element, &style, | 434 const auto& snapshot = [&element, &style, |
| 438 parentStyle](const AnimationEffectReadOnly* effect) { | 435 parentStyle](const AnimationEffectReadOnly* effect) { |
| 439 const KeyframeEffectModelBase* keyframeEffect = | 436 const KeyframeEffectModelBase* keyframeEffect = |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 for (const auto& entry : *activeTransitions) { | 816 for (const auto& entry : *activeTransitions) { |
| 820 CSSPropertyID id = entry.key; | 817 CSSPropertyID id = entry.key; |
| 821 if (!anyTransitionHadTransitionAll && !animationStyleRecalc && | 818 if (!anyTransitionHadTransitionAll && !animationStyleRecalc && |
| 822 !listedProperties.test(id - firstCSSProperty)) { | 819 !listedProperties.test(id - firstCSSProperty)) { |
| 823 update.cancelTransition(id); | 820 update.cancelTransition(id); |
| 824 } else if (entry.value.animation->finishedInternal()) { | 821 } else if (entry.value.animation->finishedInternal()) { |
| 825 update.finishTransition(id); | 822 update.finishTransition(id); |
| 826 } | 823 } |
| 827 } | 824 } |
| 828 } | 825 } |
| 826 calculateTransitionActiveInterpolations(update, animatingElement); |
| 829 } | 827 } |
| 830 | 828 |
| 831 void CSSAnimations::cancel() { | 829 void CSSAnimations::cancel() { |
| 832 for (const auto& runningAnimation : m_runningAnimations) { | 830 for (const auto& runningAnimation : m_runningAnimations) { |
| 833 runningAnimation->animation->cancel(); | 831 runningAnimation->animation->cancel(); |
| 834 runningAnimation->animation->update(TimingUpdateOnDemand); | 832 runningAnimation->animation->update(TimingUpdateOnDemand); |
| 835 } | 833 } |
| 836 | 834 |
| 837 for (const auto& entry : m_transitions) { | 835 for (const auto& entry : m_transitions) { |
| 838 entry.value.animation->cancel(); | 836 entry.value.animation->cancel(); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 // and from their shadow sub-trees if they are shadow hosts. | 1085 // and from their shadow sub-trees if they are shadow hosts. |
| 1088 if (element.treeScope() == treeScope) | 1086 if (element.treeScope() == treeScope) |
| 1089 return true; | 1087 return true; |
| 1090 if (!isShadowHost(element)) | 1088 if (!isShadowHost(element)) |
| 1091 return false; | 1089 return false; |
| 1092 if (treeScope.rootNode() == treeScope.document()) | 1090 if (treeScope.rootNode() == treeScope.document()) |
| 1093 return false; | 1091 return false; |
| 1094 return toShadowRoot(treeScope.rootNode()).host() == element; | 1092 return toShadowRoot(treeScope.rootNode()).host() == element; |
| 1095 } | 1093 } |
| 1096 | 1094 |
| 1095 bool CSSAnimations::isCustomPropertyHandle(const PropertyHandle& property) { |
| 1096 return property.isCSSProperty() && |
| 1097 property.cssProperty() == CSSPropertyVariable; |
| 1098 } |
| 1099 |
| 1100 bool CSSAnimations::isAnimatingCustomProperties( |
| 1101 const ElementAnimations* elementAnimations) { |
| 1102 return elementAnimations && |
| 1103 elementAnimations->effectStack().affectsProperties( |
| 1104 isCustomPropertyHandle); |
| 1105 } |
| 1106 |
| 1097 DEFINE_TRACE(CSSAnimations) { | 1107 DEFINE_TRACE(CSSAnimations) { |
| 1098 visitor->trace(m_transitions); | 1108 visitor->trace(m_transitions); |
| 1099 visitor->trace(m_pendingUpdate); | 1109 visitor->trace(m_pendingUpdate); |
| 1100 visitor->trace(m_runningAnimations); | 1110 visitor->trace(m_runningAnimations); |
| 1101 } | 1111 } |
| 1102 | 1112 |
| 1103 } // namespace blink | 1113 } // namespace blink |
| OLD | NEW |