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

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

Issue 2361733004: Adding @keyframes rules only affects TreeScope plus host. (Closed)
Patch Set: Moved scope check to CSSAnimations Created 4 years, 2 months 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 299 }
300 300
301 const bool isPaused = CSSTimingData::getRepeated(animationData->play StateList(), i) == AnimPlayStatePaused; 301 const bool isPaused = CSSTimingData::getRepeated(animationData->play StateList(), i) == AnimPlayStatePaused;
302 302
303 Timing timing = animationData->convertToTiming(i); 303 Timing timing = animationData->convertToTiming(i);
304 Timing specifiedTiming = timing; 304 Timing specifiedTiming = timing;
305 RefPtr<TimingFunction> keyframeTimingFunction = timing.timingFunctio n; 305 RefPtr<TimingFunction> keyframeTimingFunction = timing.timingFunctio n;
306 timing.timingFunction = Timing::defaults().timingFunction; 306 timing.timingFunction = Timing::defaults().timingFunction;
307 307
308 StyleRuleKeyframes* keyframesRule = resolver->findKeyframesRule(elem entForScoping, name); 308 StyleRuleKeyframes* keyframesRule = resolver->findKeyframesRule(elem entForScoping, name);
309 if (!keyframesRule) { 309 if (!keyframesRule)
310 element.document().styleEngine().setHasUnresolvedKeyframesRule() ;
311 continue; // Cancel the animation if there's no style rule for i t. 310 continue; // Cancel the animation if there's no style rule for i t.
312 }
313 311
314 const RunningAnimation* existingAnimation = nullptr; 312 const RunningAnimation* existingAnimation = nullptr;
315 size_t existingAnimationIndex = 0; 313 size_t existingAnimationIndex = 0;
316 314
317 if (cssAnimations) { 315 if (cssAnimations) {
318 for (size_t i = 0; i < cssAnimations->m_runningAnimations.size() ; i++) { 316 for (size_t i = 0; i < cssAnimations->m_runningAnimations.size() ; i++) {
319 const RunningAnimation& runningAnimation = *cssAnimations->m _runningAnimations[i]; 317 const RunningAnimation& runningAnimation = *cssAnimations->m _runningAnimations[i];
320 if (runningAnimation.name == name && runningAnimation.nameIn dex == nameIndex) { 318 if (runningAnimation.name == name && runningAnimation.nameIn dex == nameIndex) {
321 existingAnimation = &runningAnimation; 319 existingAnimation = &runningAnimation;
322 existingAnimationIndex = i; 320 existingAnimationIndex = i;
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 case CSSPropertyTransitionDelay: 887 case CSSPropertyTransitionDelay:
890 case CSSPropertyTransitionDuration: 888 case CSSPropertyTransitionDuration:
891 case CSSPropertyTransitionProperty: 889 case CSSPropertyTransitionProperty:
892 case CSSPropertyTransitionTimingFunction: 890 case CSSPropertyTransitionTimingFunction:
893 return false; 891 return false;
894 default: 892 default:
895 return true; 893 return true;
896 } 894 }
897 } 895 }
898 896
897 bool CSSAnimations::isAffectedByKeyframesFromScope(const Element& element, const TreeScope& treeScope)
898 {
899 // Animated elements are affected by @keyframes rules from the same scope
900 // and from their shadow sub-trees if they are shadow hosts.
901 if (element.treeScope() == treeScope)
902 return true;
903 if (!isShadowHost(element))
904 return false;
905 if (treeScope.rootNode() == treeScope.document())
906 return false;
907 return toShadowRoot(treeScope.rootNode()).host() == element;
908 }
909
899 DEFINE_TRACE(CSSAnimations) 910 DEFINE_TRACE(CSSAnimations)
900 { 911 {
901 visitor->trace(m_transitions); 912 visitor->trace(m_transitions);
902 visitor->trace(m_pendingUpdate); 913 visitor->trace(m_pendingUpdate);
903 visitor->trace(m_runningAnimations); 914 visitor->trace(m_runningAnimations);
904 } 915 }
905 916
906 } // namespace blink 917 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698