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

Side by Side Diff: sky/engine/core/css/ElementRuleCollector.h

Issue 772363002: Remove code to collect rules when matching. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | sky/engine/core/css/ElementRuleCollector.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 public: 98 public:
99 ElementRuleCollector(const ElementResolveContext&, RenderStyle* = 0); 99 ElementRuleCollector(const ElementResolveContext&, RenderStyle* = 0);
100 ~ElementRuleCollector(); 100 ~ElementRuleCollector();
101 101
102 void setMode(SelectorChecker::Mode mode) { m_mode = mode; } 102 void setMode(SelectorChecker::Mode mode) { m_mode = mode; }
103 103
104 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching UARules; } 104 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching UARules; }
105 bool hasAnyMatchingRules(RuleSet*); 105 bool hasAnyMatchingRules(RuleSet*);
106 106
107 MatchResult& matchedResult(); 107 MatchResult& matchedResult();
108 PassRefPtr<StyleRuleList> matchedStyleRuleList();
109 PassRefPtr<CSSRuleList> matchedCSSRuleList();
110 108
111 void collectMatchingRules(const MatchRequest&, RuleRange&, SelectorChecker:: ContextFlags = SelectorChecker::DefaultBehavior, CascadeScope = ignoreCascadeSco pe, CascadeOrder = ignoreCascadeOrder); 109 void collectMatchingRules(const MatchRequest&, RuleRange&, SelectorChecker:: ContextFlags = SelectorChecker::DefaultBehavior, CascadeScope = ignoreCascadeSco pe, CascadeOrder = ignoreCascadeOrder);
112 void sortAndTransferMatchedRules(); 110 void sortAndTransferMatchedRules();
113 void clearMatchedRules(); 111 void clearMatchedRules();
114 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t rue); 112 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t rue);
115 113
116 private: 114 private:
117 void collectRuleIfMatches(const RuleData&, SelectorChecker::ContextFlags, Ca scadeScope, CascadeOrder, const MatchRequest&, RuleRange&); 115 void collectRuleIfMatches(const RuleData&, SelectorChecker::ContextFlags, Ca scadeScope, CascadeOrder, const MatchRequest&, RuleRange&);
118 116
119 template<typename RuleDataListType> 117 template<typename RuleDataListType>
120 void collectMatchingRulesForList(const RuleDataListType* rules, SelectorChec ker::ContextFlags contextFlags, CascadeScope cascadeScope, CascadeOrder cascadeO rder, const MatchRequest& matchRequest, RuleRange& ruleRange) 118 void collectMatchingRulesForList(const RuleDataListType* rules, SelectorChec ker::ContextFlags contextFlags, CascadeScope cascadeScope, CascadeOrder cascadeO rder, const MatchRequest& matchRequest, RuleRange& ruleRange)
121 { 119 {
122 if (!rules) 120 if (!rules)
123 return; 121 return;
124 122
125 for (typename RuleDataListType::const_iterator it = rules->begin(), end = rules->end(); it != end; ++it) 123 for (typename RuleDataListType::const_iterator it = rules->begin(), end = rules->end(); it != end; ++it)
126 collectRuleIfMatches(*it, contextFlags, cascadeScope, cascadeOrder, matchRequest, ruleRange); 124 collectRuleIfMatches(*it, contextFlags, cascadeScope, cascadeOrder, matchRequest, ruleRange);
127 } 125 }
128 126
129 bool ruleMatches(const RuleData&, const ContainerNode* scope, SelectorChecke r::ContextFlags); 127 bool ruleMatches(const RuleData&, const ContainerNode* scope, SelectorChecke r::ContextFlags);
130 128
131 CSSRuleList* nestedRuleList(CSSRule*);
132 template<class CSSRuleCollection>
133 CSSRule* findStyleRule(CSSRuleCollection*, StyleRule*);
134 void appendCSSOMWrapperForRule(CSSStyleSheet*, StyleRule*);
135
136 void sortMatchedRules(); 129 void sortMatchedRules();
137 void addMatchedRule(const RuleData*, CascadeScope, CascadeOrder, unsigned st yleSheetIndex, const CSSStyleSheet* parentStyleSheet); 130 void addMatchedRule(const RuleData*, CascadeScope, CascadeOrder, unsigned st yleSheetIndex, const CSSStyleSheet* parentStyleSheet);
138 131
139 StaticCSSRuleList* ensureRuleList();
140 StyleRuleList* ensureStyleRuleList();
141
142 private: 132 private:
143 const ElementResolveContext& m_context; 133 const ElementResolveContext& m_context;
144 RefPtr<RenderStyle> m_style; // FIXME: This can be mutated during matching! 134 RefPtr<RenderStyle> m_style; // FIXME: This can be mutated during matching!
145 135
146 SelectorChecker::Mode m_mode; 136 SelectorChecker::Mode m_mode;
147 bool m_matchingUARules; 137 bool m_matchingUARules;
148 138
149 OwnPtr<Vector<MatchedRule, 32> > m_matchedRules; 139 OwnPtr<Vector<MatchedRule, 32> > m_matchedRules;
150 140
151 // Output. 141 // Output.
152 RefPtr<StaticCSSRuleList> m_cssRuleList;
153 RefPtr<StyleRuleList> m_styleRuleList;
154 MatchResult m_result; 142 MatchResult m_result;
155 }; 143 };
156 144
157 } // namespace blink 145 } // namespace blink
158 146
159 #endif // SKY_ENGINE_CORE_CSS_ELEMENTRULECOLLECTOR_H_ 147 #endif // SKY_ENGINE_CORE_CSS_ELEMENTRULECOLLECTOR_H_
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/css/ElementRuleCollector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698