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

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

Issue 800483006: Remove CascadeScope. (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 18 matching lines...) Expand all
29 #include "sky/engine/wtf/RefPtr.h" 29 #include "sky/engine/wtf/RefPtr.h"
30 #include "sky/engine/wtf/Vector.h" 30 #include "sky/engine/wtf/Vector.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 class CSSStyleSheet; 34 class CSSStyleSheet;
35 class RuleData; 35 class RuleData;
36 class RuleSet; 36 class RuleSet;
37 class ScopedStyleResolver; 37 class ScopedStyleResolver;
38 38
39 typedef unsigned CascadeScope;
40 typedef unsigned CascadeOrder; 39 typedef unsigned CascadeOrder;
41 40
42 const CascadeScope ignoreCascadeScope = 0;
43 const CascadeOrder ignoreCascadeOrder = 0; 41 const CascadeOrder ignoreCascadeOrder = 0;
44 42
45 class MatchedRule { 43 class MatchedRule {
46 ALLOW_ONLY_INLINE_ALLOCATION(); 44 ALLOW_ONLY_INLINE_ALLOCATION();
47 public: 45 public:
48 MatchedRule(const RuleData* ruleData, CascadeScope cascadeScope, CascadeOrde r cascadeOrder, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet) 46 MatchedRule(const RuleData* ruleData, CascadeOrder cascadeOrder, unsigned st yleSheetIndex, const CSSStyleSheet* parentStyleSheet)
49 : m_ruleData(ruleData) 47 : m_ruleData(ruleData)
50 , m_cascadeScope(cascadeScope)
51 , m_parentStyleSheet(parentStyleSheet) 48 , m_parentStyleSheet(parentStyleSheet)
52 { 49 {
53 ASSERT(m_ruleData); 50 ASSERT(m_ruleData);
54 static const unsigned BitsForPositionInRuleData = 18; 51 static const unsigned BitsForPositionInRuleData = 18;
55 static const unsigned BitsForStyleSheetIndex = 32; 52 static const unsigned BitsForStyleSheetIndex = 32;
56 m_position = ((uint64_t)cascadeOrder << (BitsForStyleSheetIndex + BitsFo rPositionInRuleData)) + ((uint64_t)styleSheetIndex << BitsForPositionInRuleData) + m_ruleData->position(); 53 m_position = ((uint64_t)cascadeOrder << (BitsForStyleSheetIndex + BitsFo rPositionInRuleData)) + ((uint64_t)styleSheetIndex << BitsForPositionInRuleData) + m_ruleData->position();
57 } 54 }
58 55
59 const RuleData* ruleData() const { return m_ruleData; } 56 const RuleData* ruleData() const { return m_ruleData; }
60 uint32_t cascadeScope() const { return m_cascadeScope; }
61 uint64_t position() const { return m_position; } 57 uint64_t position() const { return m_position; }
62 const CSSStyleSheet* parentStyleSheet() const { return m_parentStyleSheet; } 58 const CSSStyleSheet* parentStyleSheet() const { return m_parentStyleSheet; }
63 59
64 private: 60 private:
65 // FIXME: Oilpan: RuleData is in the oilpan heap and this pointer 61 // FIXME: Oilpan: RuleData is in the oilpan heap and this pointer
66 // really should be traced. However, RuleData objects are 62 // really should be traced. However, RuleData objects are
67 // allocated inside larger TerminatedArray objects and we cannot 63 // allocated inside larger TerminatedArray objects and we cannot
68 // trace a raw rule data pointer at this point. 64 // trace a raw rule data pointer at this point.
69 const RuleData* m_ruleData; 65 const RuleData* m_ruleData;
70 CascadeScope m_cascadeScope;
71 uint64_t m_position; 66 uint64_t m_position;
72 RawPtr<const CSSStyleSheet> m_parentStyleSheet; 67 RawPtr<const CSSStyleSheet> m_parentStyleSheet;
73 }; 68 };
74 69
75 } // namespace blink 70 } // namespace blink
76 71
77 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::MatchedRule); 72 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::MatchedRule);
78 73
79 namespace blink { 74 namespace blink {
80 75
(...skipping 15 matching lines...) Expand all
96 public: 91 public:
97 ElementRuleCollector(const ElementResolveContext&, RenderStyle* = 0); 92 ElementRuleCollector(const ElementResolveContext&, RenderStyle* = 0);
98 ~ElementRuleCollector(); 93 ~ElementRuleCollector();
99 94
100 void setMode(SelectorChecker::Mode mode) { m_mode = mode; } 95 void setMode(SelectorChecker::Mode mode) { m_mode = mode; }
101 96
102 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching UARules; } 97 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching UARules; }
103 98
104 MatchResult& matchedResult(); 99 MatchResult& matchedResult();
105 100
106 void collectMatchingRules(const MatchRequest&, RuleRange&, CascadeScope = ig noreCascadeScope, CascadeOrder = ignoreCascadeOrder); 101 void collectMatchingRules(const MatchRequest&, RuleRange&, CascadeOrder = ig noreCascadeOrder);
107 void sortAndTransferMatchedRules(); 102 void sortAndTransferMatchedRules();
108 void clearMatchedRules(); 103 void clearMatchedRules();
109 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t rue); 104 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t rue);
110 105
111 private: 106 private:
112 void collectRuleIfMatches(const RuleData&, CascadeScope, CascadeOrder, const MatchRequest&, RuleRange&); 107 void collectRuleIfMatches(const RuleData&, CascadeOrder, const MatchRequest& , RuleRange&);
113 108
114 template<typename RuleDataListType> 109 template<typename RuleDataListType>
115 void collectMatchingRulesForList(const RuleDataListType* rules, CascadeScope cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, Rule Range& ruleRange) 110 void collectMatchingRulesForList(const RuleDataListType* rules, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange)
116 { 111 {
117 if (!rules) 112 if (!rules)
118 return; 113 return;
119 114
120 for (typename RuleDataListType::const_iterator it = rules->begin(), end = rules->end(); it != end; ++it) 115 for (typename RuleDataListType::const_iterator it = rules->begin(), end = rules->end(); it != end; ++it)
121 collectRuleIfMatches(*it, cascadeScope, cascadeOrder, matchRequest, ruleRange); 116 collectRuleIfMatches(*it, cascadeOrder, matchRequest, ruleRange);
122 } 117 }
123 118
124 bool ruleMatches(const RuleData&, const ContainerNode* scope); 119 bool ruleMatches(const RuleData&, const ContainerNode* scope);
125 120
126 void sortMatchedRules(); 121 void sortMatchedRules();
127 void addMatchedRule(const RuleData*, CascadeScope, CascadeOrder, unsigned st yleSheetIndex, const CSSStyleSheet* parentStyleSheet); 122 void addMatchedRule(const RuleData*, CascadeOrder, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet);
128 123
129 private: 124 private:
130 const ElementResolveContext& m_context; 125 const ElementResolveContext& m_context;
131 RefPtr<RenderStyle> m_style; // FIXME: This can be mutated during matching! 126 RefPtr<RenderStyle> m_style; // FIXME: This can be mutated during matching!
132 127
133 SelectorChecker::Mode m_mode; 128 SelectorChecker::Mode m_mode;
134 bool m_matchingUARules; 129 bool m_matchingUARules;
135 130
136 OwnPtr<Vector<MatchedRule, 32> > m_matchedRules; 131 OwnPtr<Vector<MatchedRule, 32> > m_matchedRules;
137 132
138 // Output. 133 // Output.
139 MatchResult m_result; 134 MatchResult m_result;
140 }; 135 };
141 136
142 } // namespace blink 137 } // namespace blink
143 138
144 #endif // SKY_ENGINE_CORE_CSS_ELEMENTRULECOLLECTOR_H_ 139 #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