| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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(); |
| 147 DescendantInvalidationSet& ensureNthInvalidationSet(); | 149 DescendantInvalidationSet& ensureNthInvalidationSet(); |
| 148 | 150 |
| 149 void updateInvalidationSets(const RuleData&); | 151 void updateInvalidationSets(const RuleData&); |
| 150 void updateInvalidationSetsForContentAttribute(const RuleData&); | 152 void updateInvalidationSetsForContentAttribute(const RuleData&); |
| 151 | 153 |
| 152 struct InvalidationSetFeatures { | 154 struct InvalidationSetFeatures { |
| 153 DISALLOW_NEW(); | 155 DISALLOW_NEW(); |
| 154 | 156 |
| 155 void add(const InvalidationSetFeatures& other); | 157 void add(const InvalidationSetFeatures& other); |
| 156 bool hasFeatures() const; | 158 bool hasFeatures() const; |
| 159 bool hasTagIdClassOrAttribute() const; |
| 157 | 160 |
| 158 Vector<AtomicString> classes; | 161 Vector<AtomicString> classes; |
| 159 Vector<AtomicString> attributes; | 162 Vector<AtomicString> attributes; |
| 160 Vector<AtomicString> ids; | 163 Vector<AtomicString> ids; |
| 161 Vector<AtomicString> tagNames; | 164 Vector<AtomicString> tagNames; |
| 162 unsigned maxDirectAdjacentSelectors = 0; | 165 unsigned maxDirectAdjacentSelectors = 0; |
| 163 bool customPseudoElement = false; | 166 bool customPseudoElement = false; |
| 164 bool hasBeforeOrAfter = false; | 167 bool hasBeforeOrAfter = false; |
| 165 bool treeBoundaryCrossing = false; | 168 bool treeBoundaryCrossing = false; |
| 166 bool insertionPointCrossing = false; | 169 bool insertionPointCrossing = false; |
| 167 bool forceSubtree = false; | 170 bool forceSubtree = false; |
| 168 bool contentPseudoCrossing = false; | 171 bool contentPseudoCrossing = false; |
| 169 bool invalidatesSlotted = false; | 172 bool invalidatesSlotted = false; |
| 170 bool hasNthPseudo = false; | 173 bool hasNthPseudo = false; |
| 174 bool hasFeaturesForRuleSetInvalidation = false; |
| 171 }; | 175 }; |
| 172 | 176 |
| 173 static void extractInvalidationSetFeature(const CSSSelector&, InvalidationSe
tFeatures&); | 177 static void extractInvalidationSetFeature(const CSSSelector&, InvalidationSe
tFeatures&); |
| 174 | 178 |
| 175 enum PositionType { Subject, Ancestor }; | 179 enum PositionType { Subject, Ancestor }; |
| 176 enum FeatureInvalidationType { NormalInvalidation, RequiresSubtreeInvalidati
on }; | 180 enum FeatureInvalidationType { NormalInvalidation, RequiresSubtreeInvalidati
on }; |
| 177 | 181 |
| 178 void extractInvalidationSetFeaturesFromSimpleSelector(const CSSSelector&, In
validationSetFeatures&); | 182 void extractInvalidationSetFeaturesFromSimpleSelector(const CSSSelector&, In
validationSetFeatures&); |
| 179 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); |
| 180 FeatureInvalidationType extractInvalidationSetFeaturesFromSelectorList(const
CSSSelector&, InvalidationSetFeatures&, PositionType); | 184 FeatureInvalidationType extractInvalidationSetFeaturesFromSelectorList(const
CSSSelector&, InvalidationSetFeatures&, PositionType); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 203 | 207 |
| 204 // If true, the RuleFeatureSet is alive and can be used. | 208 // If true, the RuleFeatureSet is alive and can be used. |
| 205 unsigned m_isAlive : 1; | 209 unsigned m_isAlive : 1; |
| 206 | 210 |
| 207 friend class RuleFeatureSetTest; | 211 friend class RuleFeatureSetTest; |
| 208 }; | 212 }; |
| 209 | 213 |
| 210 } // namespace blink | 214 } // namespace blink |
| 211 | 215 |
| 212 #endif // RuleFeature_h | 216 #endif // RuleFeature_h |
| OLD | NEW |