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

Side by Side Diff: Source/core/css/ElementRuleCollector.h

Issue 181403005: Introduce TerminatedArray<T> type to make data-structure used by RuleSet visible at the type level. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSTestHelper.cpp ('k') | Source/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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 void sortAndTransferMatchedRules(); 108 void sortAndTransferMatchedRules();
109 void clearMatchedRules(); 109 void clearMatchedRules();
110 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t rue); 110 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t rue);
111 111
112 unsigned lastMatchedRulesPosition() const { return m_matchedRules ? m_matche dRules->size() : 0; } 112 unsigned lastMatchedRulesPosition() const { return m_matchedRules ? m_matche dRules->size() : 0; }
113 void sortMatchedRulesFrom(unsigned position); 113 void sortMatchedRulesFrom(unsigned position);
114 void sortAndTransferMatchedRulesWithOnlySortBySpecificity(); 114 void sortAndTransferMatchedRulesWithOnlySortBySpecificity();
115 115
116 private: 116 private:
117 void collectRuleIfMatches(const RuleData&, SelectorChecker::BehaviorAtBounda ry, CascadeScope, CascadeOrder, const MatchRequest&, RuleRange&); 117 void collectRuleIfMatches(const RuleData&, SelectorChecker::BehaviorAtBounda ry, CascadeScope, CascadeOrder, const MatchRequest&, RuleRange&);
118 void collectMatchingRulesForList(const Vector<RuleData>*, SelectorChecker::B ehaviorAtBoundary, CascadeScope, CascadeOrder, const MatchRequest&, RuleRange&); 118
119 void collectMatchingRulesForList(const RuleData*, SelectorChecker::BehaviorA tBoundary, CascadeScope, CascadeOrder, const MatchRequest&, RuleRange&); 119 template<typename RuleDataListType>
120 void collectMatchingRulesForList(const RuleDataListType* rules, SelectorChec ker::BehaviorAtBoundary behaviorAtBoundary, CascadeScope cascadeScope, CascadeOr der cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange)
121 {
122 if (!rules)
123 return;
124
125 for (typename RuleDataListType::const_iterator it = rules->begin(), end = rules->end(); it != end; ++it)
126 collectRuleIfMatches(*it, behaviorAtBoundary, cascadeScope, cascadeO rder, matchRequest, ruleRange);
127 }
128
120 bool ruleMatches(const RuleData&, const ContainerNode* scope, SelectorChecke r::BehaviorAtBoundary, SelectorChecker::MatchResult*); 129 bool ruleMatches(const RuleData&, const ContainerNode* scope, SelectorChecke r::BehaviorAtBoundary, SelectorChecker::MatchResult*);
121 130
122 CSSRuleList* nestedRuleList(CSSRule*); 131 CSSRuleList* nestedRuleList(CSSRule*);
123 template<class CSSRuleCollection> 132 template<class CSSRuleCollection>
124 CSSRule* findStyleRule(CSSRuleCollection*, StyleRule*); 133 CSSRule* findStyleRule(CSSRuleCollection*, StyleRule*);
125 void appendCSSOMWrapperForRule(CSSStyleSheet*, StyleRule*); 134 void appendCSSOMWrapperForRule(CSSStyleSheet*, StyleRule*);
126 135
127 void sortMatchedRules(); 136 void sortMatchedRules();
128 void addMatchedRule(const RuleData*, unsigned specificity, CascadeScope, Cas cadeOrder, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet); 137 void addMatchedRule(const RuleData*, unsigned specificity, CascadeScope, Cas cadeOrder, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet);
129 138
(...skipping 15 matching lines...) Expand all
145 154
146 // Output. 155 // Output.
147 RefPtr<StaticCSSRuleList> m_cssRuleList; 156 RefPtr<StaticCSSRuleList> m_cssRuleList;
148 RefPtr<StyleRuleList> m_styleRuleList; 157 RefPtr<StyleRuleList> m_styleRuleList;
149 MatchResult m_result; 158 MatchResult m_result;
150 }; 159 };
151 160
152 } // namespace WebCore 161 } // namespace WebCore
153 162
154 #endif // ElementRuleCollector_h 163 #endif // ElementRuleCollector_h
OLDNEW
« no previous file with comments | « Source/core/css/CSSTestHelper.cpp ('k') | Source/core/css/ElementRuleCollector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698