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

Side by Side Diff: sky/engine/core/css/resolver/ScopedStyleResolver.cpp

Issue 838313002: Move StyleResolver code out of ScopedStyleResolver. (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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * Copyright (C) 2012 Google Inc. All rights reserved. 4 * Copyright (C) 2012 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 13 matching lines...) Expand all
24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "sky/engine/config.h" 27 #include "sky/engine/config.h"
28 #include "sky/engine/core/css/resolver/ScopedStyleResolver.h" 28 #include "sky/engine/core/css/resolver/ScopedStyleResolver.h"
29 29
30 #include "sky/engine/core/css/CSSStyleSheet.h" 30 #include "sky/engine/core/css/CSSStyleSheet.h"
31 #include "sky/engine/core/css/RuleFeature.h" 31 #include "sky/engine/core/css/RuleFeature.h"
32 #include "sky/engine/core/css/StyleRule.h" 32 #include "sky/engine/core/css/StyleRule.h"
33 #include "sky/engine/core/css/StyleSheetContents.h" 33 #include "sky/engine/core/css/StyleSheetContents.h"
34 #include "sky/engine/core/css/resolver/StyleResolver.h"
35 #include "sky/engine/core/dom/Document.h"
36 #include "sky/engine/core/dom/shadow/ElementShadow.h"
37 #include "sky/engine/core/dom/shadow/ShadowRoot.h"
38 #include "sky/engine/core/html/HTMLStyleElement.h"
39 34
40 namespace blink { 35 namespace blink {
41 36
42 ScopedStyleResolver::ScopedStyleResolver(TreeScope& scope) 37 ScopedStyleResolver::ScopedStyleResolver(TreeScope& scope)
43 : m_scope(scope) 38 : m_scope(scope)
44 { 39 {
45 } 40 }
46 41
47 void ScopedStyleResolver::addRulesFromSheet(CSSStyleSheet* cssSheet, StyleResolv er* resolver) 42 void ScopedStyleResolver::addRulesFromSheet(CSSStyleSheet* cssSheet)
48 { 43 {
49 m_authorStyleSheets.append(cssSheet); 44 m_authorStyleSheets.append(cssSheet);
50 unsigned index = m_authorStyleSheets.size() - 1;
51 StyleSheetContents* sheet = cssSheet->contents();
52 45
53 AddRuleFlags addRuleFlags = RuleHasNoSpecialState; 46 const RuleSet& ruleSet = cssSheet->contents()->ensureRuleSet();
54 const RuleSet& ruleSet = sheet->ensureRuleSet(addRuleFlags);
55 resolver->addMediaQueryResults(ruleSet.viewportDependentMediaQueryResults()) ;
56 resolver->processScopedRules(ruleSet, cssSheet, index, treeScope().rootNode( ));
57
58 m_features.add(ruleSet.features()); 47 m_features.add(ruleSet.features());
59 } 48 }
60 49
61 void ScopedStyleResolver::resetAuthorStyle() 50 void ScopedStyleResolver::resetAuthorStyle()
62 { 51 {
63 m_authorStyleSheets.clear(); 52 m_authorStyleSheets.clear();
64 m_features.clear(); 53 m_features.clear();
65 } 54 }
66 55
67 const StyleRuleKeyframes* ScopedStyleResolver::keyframeStylesForAnimation(String animationName) 56 const StyleRuleKeyframes* ScopedStyleResolver::keyframeStylesForAnimation(String animationName)
(...skipping 11 matching lines...) Expand all
79 void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& colle ctor, bool includeEmptyRules, CascadeScope cascadeScope, CascadeOrder cascadeOrd er) 68 void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& colle ctor, bool includeEmptyRules, CascadeScope cascadeScope, CascadeOrder cascadeOrd er)
80 { 69 {
81 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); 70 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
82 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { 71 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) {
83 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet() , includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i); 72 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet() , includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i);
84 collector.collectMatchingRules(matchRequest, ruleRange, cascadeScope, ca scadeOrder); 73 collector.collectMatchingRules(matchRequest, ruleRange, cascadeScope, ca scadeOrder);
85 } 74 }
86 } 75 }
87 76
88 } // namespace blink 77 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/resolver/ScopedStyleResolver.h ('k') | sky/engine/core/css/resolver/StyleResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698