| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Collect descendant and sibling invalidation sets. | 95 // Collect descendant and sibling invalidation sets. |
| 96 void collectInvalidationSetsForClass(InvalidationLists&, Element&, const Ato
micString& className) const; | 96 void collectInvalidationSetsForClass(InvalidationLists&, Element&, const Ato
micString& className) const; |
| 97 void collectInvalidationSetsForId(InvalidationLists&, Element&, const Atomic
String& id) const; | 97 void collectInvalidationSetsForId(InvalidationLists&, Element&, const Atomic
String& id) const; |
| 98 void collectInvalidationSetsForAttribute(InvalidationLists&, Element&, const
QualifiedName& attributeName) const; | 98 void collectInvalidationSetsForAttribute(InvalidationLists&, Element&, const
QualifiedName& attributeName) const; |
| 99 void collectInvalidationSetsForPseudoClass(InvalidationLists&, Element&, CSS
Selector::PseudoType) const; | 99 void collectInvalidationSetsForPseudoClass(InvalidationLists&, Element&, CSS
Selector::PseudoType) const; |
| 100 | 100 |
| 101 void collectSiblingInvalidationSetForClass(InvalidationLists&, Element&, con
st AtomicString& className, unsigned minDirectAdjacent) const; | 101 void collectSiblingInvalidationSetForClass(InvalidationLists&, Element&, con
st AtomicString& className, unsigned minDirectAdjacent) const; |
| 102 void collectSiblingInvalidationSetForId(InvalidationLists&, Element&, const
AtomicString& id, unsigned minDirectAdjacent) const; | 102 void collectSiblingInvalidationSetForId(InvalidationLists&, Element&, const
AtomicString& id, unsigned minDirectAdjacent) const; |
| 103 void collectSiblingInvalidationSetForAttribute(InvalidationLists&, Element&,
const QualifiedName& attributeName, unsigned minDirectAdjacent) const; | 103 void collectSiblingInvalidationSetForAttribute(InvalidationLists&, Element&,
const QualifiedName& attributeName, unsigned minDirectAdjacent) const; |
| 104 void collectUniversalSiblingInvalidationSet(InvalidationLists&, unsigned min
DirectAdjacent) const; | 104 void collectUniversalSiblingInvalidationSet(InvalidationLists&, unsigned min
DirectAdjacent) const; |
| 105 void collectNthInvalidationSet(InvalidationLists&) const; |
| 105 | 106 |
| 106 bool hasIdsInSelectors() const | 107 bool hasIdsInSelectors() const |
| 107 { | 108 { |
| 108 return m_idInvalidationSets.size() > 0; | 109 return m_idInvalidationSets.size() > 0; |
| 109 } | 110 } |
| 110 | 111 |
| 111 DECLARE_TRACE(); | 112 DECLARE_TRACE(); |
| 112 | 113 |
| 113 HeapVector<RuleFeature> siblingRules; | 114 HeapVector<RuleFeature> siblingRules; |
| 114 HeapVector<RuleFeature> uncommonAttributeRules; | 115 HeapVector<RuleFeature> uncommonAttributeRules; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 134 unsigned maxDirectAdjacentSelectors = 0; | 135 unsigned maxDirectAdjacentSelectors = 0; |
| 135 }; | 136 }; |
| 136 | 137 |
| 137 SelectorPreMatch collectFeaturesFromSelector(const CSSSelector&, FeatureMeta
data&); | 138 SelectorPreMatch collectFeaturesFromSelector(const CSSSelector&, FeatureMeta
data&); |
| 138 | 139 |
| 139 InvalidationSet& ensureClassInvalidationSet(const AtomicString& className, I
nvalidationType); | 140 InvalidationSet& ensureClassInvalidationSet(const AtomicString& className, I
nvalidationType); |
| 140 InvalidationSet& ensureAttributeInvalidationSet(const AtomicString& attribut
eName, InvalidationType); | 141 InvalidationSet& ensureAttributeInvalidationSet(const AtomicString& attribut
eName, InvalidationType); |
| 141 InvalidationSet& ensureIdInvalidationSet(const AtomicString& id, Invalidatio
nType); | 142 InvalidationSet& ensureIdInvalidationSet(const AtomicString& id, Invalidatio
nType); |
| 142 InvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoType, Invali
dationType); | 143 InvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoType, Invali
dationType); |
| 143 SiblingInvalidationSet& ensureUniversalSiblingInvalidationSet(); | 144 SiblingInvalidationSet& ensureUniversalSiblingInvalidationSet(); |
| 145 DescendantInvalidationSet& ensureNthInvalidationSet(); |
| 144 | 146 |
| 145 void updateInvalidationSets(const RuleData&); | 147 void updateInvalidationSets(const RuleData&); |
| 146 void updateInvalidationSetsForContentAttribute(const RuleData&); | 148 void updateInvalidationSetsForContentAttribute(const RuleData&); |
| 147 | 149 |
| 148 struct InvalidationSetFeatures { | 150 struct InvalidationSetFeatures { |
| 149 DISALLOW_NEW(); | 151 DISALLOW_NEW(); |
| 150 | 152 |
| 151 Vector<AtomicString> classes; | 153 Vector<AtomicString> classes; |
| 152 Vector<AtomicString> attributes; | 154 Vector<AtomicString> attributes; |
| 153 AtomicString id; | 155 AtomicString id; |
| 154 AtomicString tagName; | 156 AtomicString tagName; |
| 155 unsigned maxDirectAdjacentSelectors = UINT_MAX; | 157 unsigned maxDirectAdjacentSelectors = UINT_MAX; |
| 156 bool customPseudoElement = false; | 158 bool customPseudoElement = false; |
| 157 bool hasBeforeOrAfter = false; | 159 bool hasBeforeOrAfter = false; |
| 158 bool treeBoundaryCrossing = false; | 160 bool treeBoundaryCrossing = false; |
| 159 bool adjacent = false; | 161 bool adjacent = false; |
| 160 bool insertionPointCrossing = false; | 162 bool insertionPointCrossing = false; |
| 161 bool forceSubtree = false; | 163 bool forceSubtree = false; |
| 162 bool contentPseudoCrossing = false; | 164 bool contentPseudoCrossing = false; |
| 163 bool invalidatesSlotted = false; | 165 bool invalidatesSlotted = false; |
| 166 bool hasNthPseudo = false; |
| 164 }; | 167 }; |
| 165 | 168 |
| 166 static bool extractInvalidationSetFeature(const CSSSelector&, InvalidationSe
tFeatures&); | 169 static bool extractInvalidationSetFeature(const CSSSelector&, InvalidationSe
tFeatures&); |
| 167 | 170 |
| 168 enum UseFeaturesType { UseFeatures, ForceSubtree }; | 171 enum UseFeaturesType { UseFeatures, ForceSubtree }; |
| 169 | 172 |
| 170 enum PositionType { Subject, Ancestor }; | 173 enum PositionType { Subject, Ancestor }; |
| 171 std::pair<const CSSSelector*, UseFeaturesType> extractInvalidationSetFeature
s(const CSSSelector&, InvalidationSetFeatures&, PositionType, CSSSelector::Pseud
oType = CSSSelector::PseudoUnknown); | 174 std::pair<const CSSSelector*, UseFeaturesType> extractInvalidationSetFeature
s(const CSSSelector&, InvalidationSetFeatures&, PositionType, CSSSelector::Pseud
oType = CSSSelector::PseudoUnknown); |
| 172 | 175 |
| 173 void addFeaturesToInvalidationSet(InvalidationSet&, const InvalidationSetFea
tures&); | 176 void addFeaturesToInvalidationSet(InvalidationSet&, const InvalidationSetFea
tures&); |
| 174 void addFeaturesToInvalidationSets(const CSSSelector*, InvalidationSetFeatur
es* siblingFeatures, InvalidationSetFeatures& descendantFeatures); | 177 void addFeaturesToInvalidationSets(const CSSSelector*, InvalidationSetFeatur
es* siblingFeatures, InvalidationSetFeatures& descendantFeatures); |
| 175 void addFeaturesToUniversalSiblingInvalidationSet(const InvalidationSetFeatu
res& siblingFeatures, const InvalidationSetFeatures& descendantFeatures); | 178 void addFeaturesToUniversalSiblingInvalidationSet(const InvalidationSetFeatu
res& siblingFeatures, const InvalidationSetFeatures& descendantFeatures); |
| 176 | 179 |
| 177 void addClassToInvalidationSet(const AtomicString& className, Element&); | 180 void addClassToInvalidationSet(const AtomicString& className, Element&); |
| 178 | 181 |
| 179 FeatureMetadata m_metadata; | 182 FeatureMetadata m_metadata; |
| 180 InvalidationSetMap m_classInvalidationSets; | 183 InvalidationSetMap m_classInvalidationSets; |
| 181 InvalidationSetMap m_attributeInvalidationSets; | 184 InvalidationSetMap m_attributeInvalidationSets; |
| 182 InvalidationSetMap m_idInvalidationSets; | 185 InvalidationSetMap m_idInvalidationSets; |
| 183 PseudoTypeInvalidationSetMap m_pseudoInvalidationSets; | 186 PseudoTypeInvalidationSetMap m_pseudoInvalidationSets; |
| 184 RefPtr<SiblingInvalidationSet> m_universalSiblingInvalidationSet; | 187 RefPtr<SiblingInvalidationSet> m_universalSiblingInvalidationSet; |
| 188 RefPtr<DescendantInvalidationSet> m_nthInvalidationSet; |
| 185 | 189 |
| 186 friend class RuleFeatureSetTest; | 190 friend class RuleFeatureSetTest; |
| 187 }; | 191 }; |
| 188 | 192 |
| 189 } // namespace blink | 193 } // namespace blink |
| 190 | 194 |
| 191 #endif // RuleFeature_h | 195 #endif // RuleFeature_h |
| OLD | NEW |