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

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

Issue 848493003: Don't scope check in SelectorChecker. (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
« 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Create one, ask what rules the ElementResolveContext matches 85 // Create one, ask what rules the ElementResolveContext matches
86 // and then let it go out of scope. 86 // and then let it go out of scope.
87 // FIXME: Currently it modifies the RenderStyle but should not! 87 // FIXME: Currently it modifies the RenderStyle but should not!
88 class ElementRuleCollector { 88 class ElementRuleCollector {
89 STACK_ALLOCATED(); 89 STACK_ALLOCATED();
90 WTF_MAKE_NONCOPYABLE(ElementRuleCollector); 90 WTF_MAKE_NONCOPYABLE(ElementRuleCollector);
91 public: 91 public:
92 ElementRuleCollector(const ElementResolveContext&, RenderStyle* = 0); 92 ElementRuleCollector(const ElementResolveContext&, RenderStyle* = 0);
93 ~ElementRuleCollector(); 93 ~ElementRuleCollector();
94 94
95 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching UARules; }
96
97 MatchResult& matchedResult(); 95 MatchResult& matchedResult();
98 96
99 void collectMatchingRules(const MatchRequest&, RuleRange&, CascadeOrder = ig noreCascadeOrder); 97 void collectMatchingRules(const MatchRequest&, RuleRange&, CascadeOrder = ig noreCascadeOrder);
98 void collectMatchingHostRules(const MatchRequest&, RuleRange&, CascadeOrder cascadeOrder = ignoreCascadeOrder);
100 void sortAndTransferMatchedRules(); 99 void sortAndTransferMatchedRules();
101 void clearMatchedRules(); 100 void clearMatchedRules();
102 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t rue); 101 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t rue);
103 102
104 private: 103 private:
105 void collectRuleIfMatches(const RuleData&, CascadeOrder, const MatchRequest& , RuleRange&); 104 void collectRuleIfMatches(const RuleData&, CascadeOrder, const MatchRequest& , RuleRange&);
106 105
107 template<typename RuleDataListType> 106 template<typename RuleDataListType>
108 void collectMatchingRulesForList(const RuleDataListType* rules, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange) 107 void collectMatchingRulesForList(const RuleDataListType* rules, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange)
109 { 108 {
110 if (!rules) 109 if (!rules)
111 return; 110 return;
112 111
113 for (typename RuleDataListType::const_iterator it = rules->begin(), end = rules->end(); it != end; ++it) 112 for (typename RuleDataListType::const_iterator it = rules->begin(), end = rules->end(); it != end; ++it)
114 collectRuleIfMatches(*it, cascadeOrder, matchRequest, ruleRange); 113 collectRuleIfMatches(*it, cascadeOrder, matchRequest, ruleRange);
115 } 114 }
116 115
117 bool ruleMatches(const RuleData&, const ContainerNode* scope); 116 bool ruleMatches(const RuleData&);
118 117
119 void sortMatchedRules(); 118 void sortMatchedRules();
120 void addMatchedRule(const RuleData*, CascadeOrder, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet); 119 void addMatchedRule(const RuleData*, CascadeOrder, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet);
121 120
122 private: 121 private:
123 const ElementResolveContext& m_context; 122 const ElementResolveContext& m_context;
124 RefPtr<RenderStyle> m_style; // FIXME: This can be mutated during matching! 123 RefPtr<RenderStyle> m_style; // FIXME: This can be mutated during matching!
125 124
126 bool m_matchingUARules;
127
128 OwnPtr<Vector<MatchedRule, 32> > m_matchedRules; 125 OwnPtr<Vector<MatchedRule, 32> > m_matchedRules;
129 126
130 // Output. 127 // Output.
131 MatchResult m_result; 128 MatchResult m_result;
132 }; 129 };
133 130
134 } // namespace blink 131 } // namespace blink
135 132
136 #endif // SKY_ENGINE_CORE_CSS_ELEMENTRULECOLLECTOR_H_ 133 #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