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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
diff --git a/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp b/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
index 9de013e0504219538784dd11a15444359931adb5..5eff4e8c0a6e852dced2c52ebf1a5f8a4fe11d43 100644
--- a/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
+++ b/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
@@ -306,10 +306,8 @@ void CSSAnimations::calculateAnimationUpdate(CSSAnimationUpdate& update, const E
timing.timingFunction = Timing::defaults().timingFunction;
StyleRuleKeyframes* keyframesRule = resolver->findKeyframesRule(elementForScoping, name);
- if (!keyframesRule) {
- element.document().styleEngine().setHasUnresolvedKeyframesRule();
+ if (!keyframesRule)
continue; // Cancel the animation if there's no style rule for it.
- }
const RunningAnimation* existingAnimation = nullptr;
size_t existingAnimationIndex = 0;
@@ -896,6 +894,19 @@ bool CSSAnimations::isAnimatableProperty(CSSPropertyID property)
}
}
+bool CSSAnimations::isAffectedByKeyframesFromScope(const Element& element, const TreeScope& treeScope)
+{
+ // Animated elements are affected by @keyframes rules from the same scope
+ // and from their shadow sub-trees if they are shadow hosts.
+ if (element.treeScope() == treeScope)
+ return true;
+ if (!isShadowHost(element))
+ return false;
+ if (treeScope.rootNode() == treeScope.document())
+ return false;
+ return toShadowRoot(treeScope.rootNode()).host() == element;
+}
+
DEFINE_TRACE(CSSAnimations)
{
visitor->trace(m_transitions);

Powered by Google App Engine
This is Rietveld 408576698