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

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

Issue 1331573002: Revert 201092 "Reland of moved unused CascadeOrder. (patchset #1..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 5 years, 3 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 | « no previous file | trunk/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 21 matching lines...) Expand all
32 32
33 namespace blink { 33 namespace blink {
34 34
35 class CSSStyleSheet; 35 class CSSStyleSheet;
36 class CSSRuleList; 36 class CSSRuleList;
37 class RuleData; 37 class RuleData;
38 class RuleSet; 38 class RuleSet;
39 class SelectorFilter; 39 class SelectorFilter;
40 class StaticCSSRuleList; 40 class StaticCSSRuleList;
41 41
42 typedef unsigned CascadeOrder;
43
44 const CascadeOrder ignoreCascadeOrder = 0;
45
42 class MatchedRule { 46 class MatchedRule {
43 ALLOW_ONLY_INLINE_ALLOCATION(); 47 ALLOW_ONLY_INLINE_ALLOCATION();
44 public: 48 public:
45 MatchedRule(const RuleData* ruleData, unsigned specificity, unsigned styleSh eetIndex, const CSSStyleSheet* parentStyleSheet) 49 MatchedRule(const RuleData* ruleData, unsigned specificity, CascadeOrder cas cadeOrder, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet)
46 : m_ruleData(ruleData) 50 : m_ruleData(ruleData)
47 , m_specificity(specificity) 51 , m_specificity(specificity)
48 , m_parentStyleSheet(parentStyleSheet) 52 , m_parentStyleSheet(parentStyleSheet)
49 { 53 {
50 ASSERT(m_ruleData); 54 ASSERT(m_ruleData);
51 static const unsigned BitsForPositionInRuleData = 18; 55 static const unsigned BitsForPositionInRuleData = 18;
52 m_position = ((uint64_t)styleSheetIndex << BitsForPositionInRuleData) + m_ruleData->position(); 56 static const unsigned BitsForStyleSheetIndex = 32;
57 m_position = ((uint64_t)cascadeOrder << (BitsForStyleSheetIndex + BitsFo rPositionInRuleData)) + ((uint64_t)styleSheetIndex << BitsForPositionInRuleData) + m_ruleData->position();
53 } 58 }
54 59
55 const RuleData* ruleData() const { return m_ruleData; } 60 const RuleData* ruleData() const { return m_ruleData; }
56 uint64_t position() const { return m_position; } 61 uint64_t position() const { return m_position; }
57 unsigned specificity() const { return ruleData()->specificity() + m_specific ity; } 62 unsigned specificity() const { return ruleData()->specificity() + m_specific ity; }
58 const CSSStyleSheet* parentStyleSheet() const { return m_parentStyleSheet; } 63 const CSSStyleSheet* parentStyleSheet() const { return m_parentStyleSheet; }
59 DEFINE_INLINE_TRACE() 64 DEFINE_INLINE_TRACE()
60 { 65 {
61 visitor->trace(m_parentStyleSheet); 66 visitor->trace(m_parentStyleSheet);
62 } 67 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 115
111 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching UARules; } 116 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching UARules; }
112 void setScopeContainsLastMatchedElement(bool scopeContainsLastMatchedElement ) { m_scopeContainsLastMatchedElement = scopeContainsLastMatchedElement; } 117 void setScopeContainsLastMatchedElement(bool scopeContainsLastMatchedElement ) { m_scopeContainsLastMatchedElement = scopeContainsLastMatchedElement; }
113 bool scopeContainsLastMatchedElement() const { return m_scopeContainsLastMat chedElement; } 118 bool scopeContainsLastMatchedElement() const { return m_scopeContainsLastMat chedElement; }
114 bool hasAnyMatchingRules(RuleSet*); 119 bool hasAnyMatchingRules(RuleSet*);
115 120
116 const MatchResult& matchedResult() const; 121 const MatchResult& matchedResult() const;
117 PassRefPtrWillBeRawPtr<StyleRuleList> matchedStyleRuleList(); 122 PassRefPtrWillBeRawPtr<StyleRuleList> matchedStyleRuleList();
118 PassRefPtrWillBeRawPtr<CSSRuleList> matchedCSSRuleList(); 123 PassRefPtrWillBeRawPtr<CSSRuleList> matchedCSSRuleList();
119 124
120 void collectMatchingRules(const MatchRequest&, bool matchingTreeBoundaryRule s = false); 125 void collectMatchingRules(const MatchRequest&, CascadeOrder = ignoreCascadeO rder, bool matchingTreeBoundaryRules = false);
121 void collectMatchingShadowHostRules(const MatchRequest&, bool matchingTreeBo undaryRules = false); 126 void collectMatchingShadowHostRules(const MatchRequest&, CascadeOrder = igno reCascadeOrder, bool matchingTreeBoundaryRules = false);
122 void sortAndTransferMatchedRules(); 127 void sortAndTransferMatchedRules();
123 void clearMatchedRules(); 128 void clearMatchedRules();
124 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t rue); 129 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t rue);
125 void finishAddingUARules() { m_result.finishAddingUARules(); } 130 void finishAddingUARules() { m_result.finishAddingUARules(); }
126 void finishAddingAuthorRulesForTreeScope() { m_result.finishAddingAuthorRule sForTreeScope(); } 131 void finishAddingAuthorRulesForTreeScope() { m_result.finishAddingAuthorRule sForTreeScope(); }
127 132
128 private: 133 private:
129 template<typename RuleDataListType> 134 template<typename RuleDataListType>
130 void collectMatchingRulesForList(const RuleDataListType*, const MatchRequest &); 135 void collectMatchingRulesForList(const RuleDataListType*, CascadeOrder, cons t MatchRequest&);
131 136
132 void didMatchRule(const RuleData&, const SelectorChecker::MatchResult&, cons t MatchRequest&); 137 void didMatchRule(const RuleData&, const SelectorChecker::MatchResult&, Casc adeOrder, const MatchRequest&);
133 138
134 template<class CSSRuleCollection> 139 template<class CSSRuleCollection>
135 CSSRule* findStyleRule(CSSRuleCollection*, StyleRule*); 140 CSSRule* findStyleRule(CSSRuleCollection*, StyleRule*);
136 void appendCSSOMWrapperForRule(CSSStyleSheet*, StyleRule*); 141 void appendCSSOMWrapperForRule(CSSStyleSheet*, StyleRule*);
137 142
138 void sortMatchedRules(); 143 void sortMatchedRules();
139 144
140 StaticCSSRuleList* ensureRuleList(); 145 StaticCSSRuleList* ensureRuleList();
141 StyleRuleList* ensureStyleRuleList(); 146 StyleRuleList* ensureStyleRuleList();
142 147
(...skipping 13 matching lines...) Expand all
156 161
157 // Output. 162 // Output.
158 RefPtrWillBeMember<StaticCSSRuleList> m_cssRuleList; 163 RefPtrWillBeMember<StaticCSSRuleList> m_cssRuleList;
159 RefPtrWillBeMember<StyleRuleList> m_styleRuleList; 164 RefPtrWillBeMember<StyleRuleList> m_styleRuleList;
160 MatchResult m_result; 165 MatchResult m_result;
161 }; 166 };
162 167
163 } // namespace blink 168 } // namespace blink
164 169
165 #endif // ElementRuleCollector_h 170 #endif // ElementRuleCollector_h
OLDNEW
« no previous file with comments | « no previous file | trunk/Source/core/css/ElementRuleCollector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698