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

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

Issue 1803933002: Use correct cascading order for Shadow DOM v1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix enum Created 4 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
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 // TODO(kochi): CascadeOrder is used only for Shadow DOM V0 bug-compatible casca ding order.
43 // Once Shadow DOM V0 implementation is gone, remove this completel y.
42 using CascadeOrder = unsigned; 44 using CascadeOrder = unsigned;
43
44 const CascadeOrder ignoreCascadeOrder = 0; 45 const CascadeOrder ignoreCascadeOrder = 0;
45 46
46 class MatchedRule { 47 class MatchedRule {
47 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 48 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
48 public: 49 public:
49 MatchedRule(const RuleData* ruleData, unsigned specificity, CascadeOrder cas cadeOrder, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet) 50 MatchedRule(const RuleData* ruleData, unsigned specificity, CascadeOrder cas cadeOrder, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet)
50 : m_ruleData(ruleData) 51 : m_ruleData(ruleData)
51 , m_specificity(specificity) 52 , m_specificity(specificity)
52 , m_parentStyleSheet(parentStyleSheet) 53 , m_parentStyleSheet(parentStyleSheet)
53 { 54 {
54 ASSERT(m_ruleData); 55 ASSERT(m_ruleData);
55 static const unsigned BitsForPositionInRuleData = 18; 56 static const unsigned BitsForPositionInRuleData = 18;
56 static const unsigned BitsForStyleSheetIndex = 32; 57 static const unsigned BitsForStyleSheetIndex = 32;
57 m_position = ((uint64_t)cascadeOrder << (BitsForStyleSheetIndex + BitsFo rPositionInRuleData)) + ((uint64_t)styleSheetIndex << BitsForPositionInRuleData) + m_ruleData->position(); 58 m_position = ((uint64_t)cascadeOrder << (BitsForStyleSheetIndex + BitsFo rPositionInRuleData)) + ((uint64_t)styleSheetIndex << BitsForPositionInRuleData) + m_ruleData->position();
58 } 59 }
59 60
60 const RuleData* ruleData() const { return m_ruleData; } 61 const RuleData* ruleData() const { return m_ruleData; }
61 uint64_t position() const { return m_position; } 62 uint64_t position() const { return m_position; }
62 unsigned specificity() const { return ruleData()->specificity() + m_specific ity; } 63 unsigned specificity() const { return ruleData()->specificity() + m_specific ity; }
63 const CSSStyleSheet* parentStyleSheet() const { return m_parentStyleSheet; } 64 const CSSStyleSheet* parentStyleSheet() const { return m_parentStyleSheet; }
64 DEFINE_INLINE_TRACE() 65 DEFINE_INLINE_TRACE()
65 { 66 {
66 visitor->trace(m_parentStyleSheet); 67 visitor->trace(m_parentStyleSheet);
67 } 68 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 123
123 void collectMatchingRules(const MatchRequest&, CascadeOrder = ignoreCascadeO rder, bool matchingTreeBoundaryRules = false); 124 void collectMatchingRules(const MatchRequest&, CascadeOrder = ignoreCascadeO rder, bool matchingTreeBoundaryRules = false);
124 void collectMatchingShadowHostRules(const MatchRequest&, CascadeOrder = igno reCascadeOrder); 125 void collectMatchingShadowHostRules(const MatchRequest&, CascadeOrder = igno reCascadeOrder);
125 void sortAndTransferMatchedRules(); 126 void sortAndTransferMatchedRules();
126 void clearMatchedRules(); 127 void clearMatchedRules();
127 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t rue); 128 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t rue);
128 void finishAddingUARules() { m_result.finishAddingUARules(); } 129 void finishAddingUARules() { m_result.finishAddingUARules(); }
129 void finishAddingAuthorRulesForTreeScope() { m_result.finishAddingAuthorRule sForTreeScope(); } 130 void finishAddingAuthorRulesForTreeScope() { m_result.finishAddingAuthorRule sForTreeScope(); }
130 void setIncludeEmptyRules(bool include) { m_includeEmptyRules = include; } 131 void setIncludeEmptyRules(bool include) { m_includeEmptyRules = include; }
131 bool includeEmptyRules() const { return m_includeEmptyRules; } 132 bool includeEmptyRules() const { return m_includeEmptyRules; }
133 bool isCollectingForPseudoElement() const { return m_pseudoStyleRequest.pseu doId != PseudoIdNone; }
132 134
133 private: 135 private:
134 template<typename RuleDataListType> 136 template<typename RuleDataListType>
135 void collectMatchingRulesForList(const RuleDataListType*, CascadeOrder, cons t MatchRequest&); 137 void collectMatchingRulesForList(const RuleDataListType*, CascadeOrder, cons t MatchRequest&);
136 138
137 void didMatchRule(const RuleData&, const SelectorChecker::MatchResult&, Casc adeOrder, const MatchRequest&); 139 void didMatchRule(const RuleData&, const SelectorChecker::MatchResult&, Casc adeOrder, const MatchRequest&);
138 140
139 template<class CSSRuleCollection> 141 template<class CSSRuleCollection>
140 CSSRule* findStyleRule(CSSRuleCollection*, StyleRule*); 142 CSSRule* findStyleRule(CSSRuleCollection*, StyleRule*);
141 void appendCSSOMWrapperForRule(CSSStyleSheet*, StyleRule*); 143 void appendCSSOMWrapperForRule(CSSStyleSheet*, StyleRule*);
(...skipping 19 matching lines...) Expand all
161 163
162 // Output. 164 // Output.
163 RefPtrWillBeMember<StaticCSSRuleList> m_cssRuleList; 165 RefPtrWillBeMember<StaticCSSRuleList> m_cssRuleList;
164 RefPtrWillBeMember<StyleRuleList> m_styleRuleList; 166 RefPtrWillBeMember<StyleRuleList> m_styleRuleList;
165 MatchResult m_result; 167 MatchResult m_result;
166 }; 168 };
167 169
168 } // namespace blink 170 } // namespace blink
169 171
170 #endif // ElementRuleCollector_h 172 #endif // ElementRuleCollector_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698