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

Unified Diff: sky/engine/core/css/resolver/ScopedStyleResolver.cpp

Issue 839473005: Simplify ScopedStyleResolver keyframe handling. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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: sky/engine/core/css/resolver/ScopedStyleResolver.cpp
diff --git a/sky/engine/core/css/resolver/ScopedStyleResolver.cpp b/sky/engine/core/css/resolver/ScopedStyleResolver.cpp
index 8c51e2cd7d19127a52bdfba272a8a8bcdeecf777..472ccfdc798f025cd98d2481a068d8ad8bff7f15 100644
--- a/sky/engine/core/css/resolver/ScopedStyleResolver.cpp
+++ b/sky/engine/core/css/resolver/ScopedStyleResolver.cpp
@@ -61,34 +61,19 @@ void ScopedStyleResolver::addRulesFromSheet(CSSStyleSheet* cssSheet, StyleResolv
void ScopedStyleResolver::resetAuthorStyle()
{
m_authorStyleSheets.clear();
- m_keyframesRuleMap.clear();
m_features.clear();
}
-const StyleRuleKeyframes* ScopedStyleResolver::keyframeStylesForAnimation(const StringImpl* animationName)
+const StyleRuleKeyframes* ScopedStyleResolver::keyframeStylesForAnimation(String animationName)
{
- if (m_keyframesRuleMap.isEmpty())
- return 0;
-
- KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(animationName);
- if (it == m_keyframesRuleMap.end())
- return 0;
-
- return it->value.get();
-}
-
-void ScopedStyleResolver::addKeyframeStyle(PassRefPtr<StyleRuleKeyframes> rule)
-{
- AtomicString s(rule->name());
- if (rule->isVendorPrefixed()) {
- KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(rule->name().impl());
- if (it == m_keyframesRuleMap.end())
- m_keyframesRuleMap.set(s.impl(), rule);
- else if (it->value->isVendorPrefixed())
- m_keyframesRuleMap.set(s.impl(), rule);
- } else {
- m_keyframesRuleMap.set(s.impl(), rule);
+ for (auto& sheet : m_authorStyleSheets) {
+ // TODO(esprehn): Maybe just store the keyframes in a map?
+ for (auto& rule : sheet->contents()->ruleSet().keyframesRules()) {
+ if (rule->name() == animationName)
+ return rule.get();
+ }
}
+ return nullptr;
}
void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& collector, bool includeEmptyRules, bool applyAuthorStyles, CascadeScope cascadeScope, CascadeOrder cascadeOrder)

Powered by Google App Engine
This is Rietveld 408576698