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

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

Issue 840163003: Make SelectorChecker a const operation over element. (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 * 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // Create one, ask what rules the ElementResolveContext matches 90 // Create one, ask what rules the ElementResolveContext matches
91 // and then let it go out of scope. 91 // and then let it go out of scope.
92 // FIXME: Currently it modifies the RenderStyle but should not! 92 // FIXME: Currently it modifies the RenderStyle but should not!
93 class ElementRuleCollector { 93 class ElementRuleCollector {
94 STACK_ALLOCATED(); 94 STACK_ALLOCATED();
95 WTF_MAKE_NONCOPYABLE(ElementRuleCollector); 95 WTF_MAKE_NONCOPYABLE(ElementRuleCollector);
96 public: 96 public:
97 ElementRuleCollector(const ElementResolveContext&, RenderStyle* = 0); 97 ElementRuleCollector(const ElementResolveContext&, RenderStyle* = 0);
98 ~ElementRuleCollector(); 98 ~ElementRuleCollector();
99 99
100 void setMode(SelectorChecker::Mode mode) { m_mode = mode; }
101
102 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching UARules; } 100 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching UARules; }
103 101
104 MatchResult& matchedResult(); 102 MatchResult& matchedResult();
105 103
106 void collectMatchingRules(const MatchRequest&, RuleRange&, CascadeScope = ig noreCascadeScope, CascadeOrder = ignoreCascadeOrder); 104 void collectMatchingRules(const MatchRequest&, RuleRange&, CascadeScope = ig noreCascadeScope, CascadeOrder = ignoreCascadeOrder);
107 void sortAndTransferMatchedRules(); 105 void sortAndTransferMatchedRules();
108 void clearMatchedRules(); 106 void clearMatchedRules();
109 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t rue); 107 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t rue);
110 108
111 private: 109 private:
(...skipping 11 matching lines...) Expand all
123 121
124 bool ruleMatches(const RuleData&, const ContainerNode* scope); 122 bool ruleMatches(const RuleData&, const ContainerNode* scope);
125 123
126 void sortMatchedRules(); 124 void sortMatchedRules();
127 void addMatchedRule(const RuleData*, CascadeScope, CascadeOrder, unsigned st yleSheetIndex, const CSSStyleSheet* parentStyleSheet); 125 void addMatchedRule(const RuleData*, CascadeScope, CascadeOrder, unsigned st yleSheetIndex, const CSSStyleSheet* parentStyleSheet);
128 126
129 private: 127 private:
130 const ElementResolveContext& m_context; 128 const ElementResolveContext& m_context;
131 RefPtr<RenderStyle> m_style; // FIXME: This can be mutated during matching! 129 RefPtr<RenderStyle> m_style; // FIXME: This can be mutated during matching!
132 130
133 SelectorChecker::Mode m_mode;
134 bool m_matchingUARules; 131 bool m_matchingUARules;
135 132
136 OwnPtr<Vector<MatchedRule, 32> > m_matchedRules; 133 OwnPtr<Vector<MatchedRule, 32> > m_matchedRules;
137 134
138 // Output. 135 // Output.
139 MatchResult m_result; 136 MatchResult m_result;
140 }; 137 };
141 138
142 } // namespace blink 139 } // namespace blink
143 140
144 #endif // SKY_ENGINE_CORE_CSS_ELEMENTRULECOLLECTOR_H_ 141 #endif // SKY_ENGINE_CORE_CSS_ELEMENTRULECOLLECTOR_H_
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/css/ElementRuleCollector.cpp » ('j') | sky/engine/core/css/SelectorChecker.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698