Index: third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp |
diff --git a/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp |
index 731252ae344cbe14f5a9a6329b3abc8fd2771a73..b28eb3f290e6b72d932646ebca8a1cb5f32b5f98 100644 |
--- a/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp |
+++ b/third_party/WebKit/Source/core/css/resolver/ScopedStyleResolver.cpp |
@@ -55,11 +55,11 @@ ScopedStyleResolver* ScopedStyleResolver::parent() const |
return nullptr; |
} |
-void ScopedStyleResolver::addKeyframeRules(const RuleSet& ruleSet) |
+void ScopedStyleResolver::addKeyframeRules(const RuleSet& ruleSet, CSSStyleSheet* styleSheet) |
{ |
const WillBeHeapVector<RawPtrWillBeMember<StyleRuleKeyframes>> keyframesRules = ruleSet.keyframesRules(); |
for (unsigned i = 0; i < keyframesRules.size(); ++i) |
- addKeyframeStyle(keyframesRules[i]); |
+ addKeyframeStyle(keyframesRules[i], styleSheet); |
} |
void ScopedStyleResolver::addFontFaceRules(const RuleSet& ruleSet) |
@@ -87,7 +87,7 @@ void ScopedStyleResolver::appendCSSStyleSheet(CSSStyleSheet& cssSheet, const Med |
AddRuleFlags addRuleFlags = treeScope().document().securityOrigin()->canRequest(sheet->baseURL()) ? RuleHasDocumentSecurityOrigin : RuleHasNoSpecialState; |
const RuleSet& ruleSet = sheet->ensureRuleSet(medium, addRuleFlags); |
- addKeyframeRules(ruleSet); |
+ addKeyframeRules(ruleSet, &cssSheet); |
addFontFaceRules(ruleSet); |
addTreeBoundaryCrossingRules(ruleSet, &cssSheet, index); |
treeScope().document().styleResolver()->addMediaQueryResults(ruleSet.viewportDependentMediaQueryResults()); |
@@ -113,6 +113,7 @@ void ScopedStyleResolver::resetAuthorStyle() |
{ |
m_authorStyleSheets.clear(); |
m_keyframesRuleMap.clear(); |
+ m_keyframesStyleSheetMap.clear(); |
m_treeBoundaryCrossingRuleSet = nullptr; |
} |
@@ -128,18 +129,34 @@ StyleRuleKeyframes* ScopedStyleResolver::keyframeStylesForAnimation(const String |
return it->value.get(); |
} |
-void ScopedStyleResolver::addKeyframeStyle(PassRefPtrWillBeRawPtr<StyleRuleKeyframes> rule) |
+CSSStyleSheet* ScopedStyleResolver::styleSheetForAnimation(const StringImpl* animationName) |
+{ |
+ if (m_keyframesStyleSheetMap.isEmpty()) |
+ return nullptr; |
+ |
+ WillBeHeapHashMap<const StringImpl*, CSSStyleSheet*>::iterator it = m_keyframesStyleSheetMap.find(animationName); |
+ if (it == m_keyframesStyleSheetMap.end()) |
+ return nullptr; |
+ |
+ return it->value; |
+} |
+ |
+void ScopedStyleResolver::addKeyframeStyle(PassRefPtrWillBeRawPtr<StyleRuleKeyframes> rule, CSSStyleSheet* styleSheet) |
{ |
AtomicString s(rule->name()); |
if (rule->isVendorPrefixed()) { |
KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(s.impl()); |
- if (it == m_keyframesRuleMap.end()) |
+ if (it == m_keyframesRuleMap.end()) { |
m_keyframesRuleMap.set(s.impl(), rule); |
- else if (it->value->isVendorPrefixed()) |
+ m_keyframesStyleSheetMap.set(s.impl(), styleSheet); |
+ } else if (it->value->isVendorPrefixed()) { |
m_keyframesRuleMap.set(s.impl(), rule); |
+ m_keyframesStyleSheetMap.set(s.impl(), styleSheet); |
+ } |
} else { |
m_keyframesRuleMap.set(s.impl(), rule); |
+ m_keyframesStyleSheetMap.set(s.impl(), styleSheet); |
} |
} |