Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp

Issue 2521103004: Revert of Apply custom property animation (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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::calculateCompositorAndTransitionUpdate( 234 void CSSAnimations::calculateUpdate(const Element* animatingElement,
235 const Element* animatingElement, 235 Element& element,
236 Element& element, 236 const ComputedStyle& style,
237 const ComputedStyle& style, 237 ComputedStyle* parentStyle,
238 ComputedStyle* parentStyle, 238 CSSAnimationUpdate& animationUpdate,
239 CSSAnimationUpdate& animationUpdate) { 239 StyleResolver* resolver) {
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);
242 calculateTransitionUpdate(animationUpdate, animatingElement, style); 245 calculateTransitionUpdate(animationUpdate, animatingElement, style);
246 calculateTransitionActiveInterpolations(animationUpdate, animatingElement);
243 } 247 }
244 248
245 static const KeyframeEffectModelBase* getKeyframeEffectModelBase( 249 static const KeyframeEffectModelBase* getKeyframeEffectModelBase(
246 const AnimationEffectReadOnly* effect) { 250 const AnimationEffectReadOnly* effect) {
247 if (!effect) 251 if (!effect)
248 return nullptr; 252 return nullptr;
249 const EffectModel* model = nullptr; 253 const EffectModel* model = nullptr;
250 if (effect->isKeyframeEffectReadOnly()) 254 if (effect->isKeyframeEffectReadOnly())
251 model = toKeyframeEffectReadOnly(effect)->model(); 255 model = toKeyframeEffectReadOnly(effect)->model();
252 else if (effect->isInertEffect()) 256 else if (effect->isInertEffect())
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 } 420 }
417 } 421 }
418 422
419 for (size_t i = 0; i < cancelRunningAnimationFlags.size(); i++) { 423 for (size_t i = 0; i < cancelRunningAnimationFlags.size(); i++) {
420 if (cancelRunningAnimationFlags[i]) { 424 if (cancelRunningAnimationFlags[i]) {
421 DCHECK(cssAnimations && !isAnimationStyleChange); 425 DCHECK(cssAnimations && !isAnimationStyleChange);
422 update.cancelAnimation(i, 426 update.cancelAnimation(i,
423 *cssAnimations->m_runningAnimations[i]->animation); 427 *cssAnimations->m_runningAnimations[i]->animation);
424 } 428 }
425 } 429 }
426 calculateAnimationActiveInterpolations(update, animatingElement);
427 } 430 }
428 431
429 void CSSAnimations::snapshotCompositorKeyframes( 432 void CSSAnimations::snapshotCompositorKeyframes(
430 Element& element, 433 Element& element,
431 CSSAnimationUpdate& update, 434 CSSAnimationUpdate& update,
432 const ComputedStyle& style, 435 const ComputedStyle& style,
433 const ComputedStyle* parentStyle) { 436 const ComputedStyle* parentStyle) {
434 const auto& snapshot = [&element, &style, 437 const auto& snapshot = [&element, &style,
435 parentStyle](const AnimationEffectReadOnly* effect) { 438 parentStyle](const AnimationEffectReadOnly* effect) {
436 const KeyframeEffectModelBase* keyframeEffect = 439 const KeyframeEffectModelBase* keyframeEffect =
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 for (const auto& entry : *activeTransitions) { 819 for (const auto& entry : *activeTransitions) {
817 CSSPropertyID id = entry.key; 820 CSSPropertyID id = entry.key;
818 if (!anyTransitionHadTransitionAll && !animationStyleRecalc && 821 if (!anyTransitionHadTransitionAll && !animationStyleRecalc &&
819 !listedProperties.test(id - firstCSSProperty)) { 822 !listedProperties.test(id - firstCSSProperty)) {
820 update.cancelTransition(id); 823 update.cancelTransition(id);
821 } else if (entry.value.animation->finishedInternal()) { 824 } else if (entry.value.animation->finishedInternal()) {
822 update.finishTransition(id); 825 update.finishTransition(id);
823 } 826 }
824 } 827 }
825 } 828 }
826 calculateTransitionActiveInterpolations(update, animatingElement);
827 } 829 }
828 830
829 void CSSAnimations::cancel() { 831 void CSSAnimations::cancel() {
830 for (const auto& runningAnimation : m_runningAnimations) { 832 for (const auto& runningAnimation : m_runningAnimations) {
831 runningAnimation->animation->cancel(); 833 runningAnimation->animation->cancel();
832 runningAnimation->animation->update(TimingUpdateOnDemand); 834 runningAnimation->animation->update(TimingUpdateOnDemand);
833 } 835 }
834 836
835 for (const auto& entry : m_transitions) { 837 for (const auto& entry : m_transitions) {
836 entry.value.animation->cancel(); 838 entry.value.animation->cancel();
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 // and from their shadow sub-trees if they are shadow hosts. 1087 // and from their shadow sub-trees if they are shadow hosts.
1086 if (element.treeScope() == treeScope) 1088 if (element.treeScope() == treeScope)
1087 return true; 1089 return true;
1088 if (!isShadowHost(element)) 1090 if (!isShadowHost(element))
1089 return false; 1091 return false;
1090 if (treeScope.rootNode() == treeScope.document()) 1092 if (treeScope.rootNode() == treeScope.document())
1091 return false; 1093 return false;
1092 return toShadowRoot(treeScope.rootNode()).host() == element; 1094 return toShadowRoot(treeScope.rootNode()).host() == element;
1093 } 1095 }
1094 1096
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
1107 DEFINE_TRACE(CSSAnimations) { 1097 DEFINE_TRACE(CSSAnimations) {
1108 visitor->trace(m_transitions); 1098 visitor->trace(m_transitions);
1109 visitor->trace(m_pendingUpdate); 1099 visitor->trace(m_pendingUpdate);
1110 visitor->trace(m_runningAnimations); 1100 visitor->trace(m_runningAnimations);
1111 } 1101 }
1112 1102
1113 } // namespace blink 1103 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698