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

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

Issue 2326033002: Prepare to use invalidation set for adding/removing RuleSets. (Closed)
Patch Set: Created 4 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
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 void add(const RuleFeatureSet&); 68 void add(const RuleFeatureSet&);
69 void clear(); 69 void clear();
70 70
71 enum SelectorPreMatch { SelectorNeverMatches, SelectorMayMatch }; 71 enum SelectorPreMatch { SelectorNeverMatches, SelectorMayMatch };
72 72
73 SelectorPreMatch collectFeaturesFromRuleData(const RuleData&); 73 SelectorPreMatch collectFeaturesFromRuleData(const RuleData&);
74 74
75 bool usesSiblingRules() const { return !siblingRules.isEmpty(); } 75 bool usesSiblingRules() const { return !siblingRules.isEmpty(); }
76 bool usesFirstLineRules() const { return m_metadata.usesFirstLineRules; } 76 bool usesFirstLineRules() const { return m_metadata.usesFirstLineRules; }
77 bool usesWindowInactiveSelector() const { return m_metadata.usesWindowInacti veSelector; } 77 bool usesWindowInactiveSelector() const { return m_metadata.usesWindowInacti veSelector; }
78 bool needsFullRecalcForRuleSetInvalidation() const { return m_metadata.needs FullRecalcForRuleSetInvalidation; }
78 79
79 unsigned maxDirectAdjacentSelectors() const { return m_metadata.maxDirectAdj acentSelectors; } 80 unsigned maxDirectAdjacentSelectors() const { return m_metadata.maxDirectAdj acentSelectors; }
80 81
81 bool hasSelectorForAttribute(const AtomicString& attributeName) const 82 bool hasSelectorForAttribute(const AtomicString& attributeName) const
82 { 83 {
83 DCHECK(!attributeName.isEmpty()); 84 DCHECK(!attributeName.isEmpty());
84 return m_attributeInvalidationSets.contains(attributeName); 85 return m_attributeInvalidationSets.contains(attributeName);
85 } 86 }
86 87
87 bool hasSelectorForClass(const AtomicString& classValue) const 88 bool hasSelectorForClass(const AtomicString& classValue) const
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 128
128 struct FeatureMetadata { 129 struct FeatureMetadata {
129 DISALLOW_NEW(); 130 DISALLOW_NEW();
130 void add(const FeatureMetadata& other); 131 void add(const FeatureMetadata& other);
131 void clear(); 132 void clear();
132 133
133 bool usesFirstLineRules = false; 134 bool usesFirstLineRules = false;
134 bool usesWindowInactiveSelector = false; 135 bool usesWindowInactiveSelector = false;
135 bool foundSiblingSelector = false; 136 bool foundSiblingSelector = false;
136 bool foundInsertionPointCrossing = false; 137 bool foundInsertionPointCrossing = false;
138 bool needsFullRecalcForRuleSetInvalidation = false;
137 unsigned maxDirectAdjacentSelectors = 0; 139 unsigned maxDirectAdjacentSelectors = 0;
138 }; 140 };
139 141
140 SelectorPreMatch collectFeaturesFromSelector(const CSSSelector&, FeatureMeta data&); 142 SelectorPreMatch collectFeaturesFromSelector(const CSSSelector&, FeatureMeta data&);
141 143
142 InvalidationSet& ensureClassInvalidationSet(const AtomicString& className, I nvalidationType); 144 InvalidationSet& ensureClassInvalidationSet(const AtomicString& className, I nvalidationType);
143 InvalidationSet& ensureAttributeInvalidationSet(const AtomicString& attribut eName, InvalidationType); 145 InvalidationSet& ensureAttributeInvalidationSet(const AtomicString& attribut eName, InvalidationType);
144 InvalidationSet& ensureIdInvalidationSet(const AtomicString& id, Invalidatio nType); 146 InvalidationSet& ensureIdInvalidationSet(const AtomicString& id, Invalidatio nType);
145 InvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoType, Invali dationType); 147 InvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoType, Invali dationType);
146 SiblingInvalidationSet& ensureUniversalSiblingInvalidationSet(); 148 SiblingInvalidationSet& ensureUniversalSiblingInvalidationSet();
(...skipping 14 matching lines...) Expand all
161 Vector<AtomicString> tagNames; 163 Vector<AtomicString> tagNames;
162 unsigned maxDirectAdjacentSelectors = 0; 164 unsigned maxDirectAdjacentSelectors = 0;
163 bool customPseudoElement = false; 165 bool customPseudoElement = false;
164 bool hasBeforeOrAfter = false; 166 bool hasBeforeOrAfter = false;
165 bool treeBoundaryCrossing = false; 167 bool treeBoundaryCrossing = false;
166 bool insertionPointCrossing = false; 168 bool insertionPointCrossing = false;
167 bool forceSubtree = false; 169 bool forceSubtree = false;
168 bool contentPseudoCrossing = false; 170 bool contentPseudoCrossing = false;
169 bool invalidatesSlotted = false; 171 bool invalidatesSlotted = false;
170 bool hasNthPseudo = false; 172 bool hasNthPseudo = false;
173 bool hasInvalidationSetFeaturesInScope = false;
171 }; 174 };
172 175
173 static void extractInvalidationSetFeature(const CSSSelector&, InvalidationSe tFeatures&); 176 static void extractInvalidationSetFeature(const CSSSelector&, InvalidationSe tFeatures&);
174 177
175 enum UseFeaturesType { UseFeatures, ForceSubtree }; 178 enum UseFeaturesType { UseFeatures, ForceSubtree };
176 179
177 enum PositionType { Subject, Ancestor }; 180 enum PositionType { Subject, Ancestor };
178 181
179 void extractInvalidationSetFeaturesFromSimpleSelector(const CSSSelector&, In validationSetFeatures&); 182 void extractInvalidationSetFeaturesFromSimpleSelector(const CSSSelector&, In validationSetFeatures&);
180 const CSSSelector* extractInvalidationSetFeaturesFromCompound(const CSSSelec tor&, InvalidationSetFeatures&, PositionType, CSSSelector::PseudoType = CSSSelec tor::PseudoUnknown); 183 const CSSSelector* extractInvalidationSetFeaturesFromCompound(const CSSSelec tor&, InvalidationSetFeatures&, PositionType, CSSSelector::PseudoType = CSSSelec tor::PseudoUnknown);
(...skipping 23 matching lines...) Expand all
204 207
205 // If true, the RuleFeatureSet is alive and can be used. 208 // If true, the RuleFeatureSet is alive and can be used.
206 unsigned m_isAlive : 1; 209 unsigned m_isAlive : 1;
207 210
208 friend class RuleFeatureSetTest; 211 friend class RuleFeatureSetTest;
209 }; 212 };
210 213
211 } // namespace blink 214 } // namespace blink
212 215
213 #endif // RuleFeature_h 216 #endif // RuleFeature_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698