| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 | 92 |
| 93 bool hasSelectorForId(const AtomicString& idValue) const { return m_idInvali
dationSets.contains(idValue); } | 93 bool hasSelectorForId(const AtomicString& idValue) const { return m_idInvali
dationSets.contains(idValue); } |
| 94 | 94 |
| 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) const; |
| 102 void collectSiblingInvalidationSetForId(InvalidationLists&, Element&, const
AtomicString& id) const; |
| 103 void collectSiblingInvalidationSetForAttribute(InvalidationLists&, Element&,
const QualifiedName& attributeName) const; |
| 104 void collectUniversalSiblingInvalidationSet(InvalidationLists&) const; |
| 105 |
| 101 bool hasIdsInSelectors() const | 106 bool hasIdsInSelectors() const |
| 102 { | 107 { |
| 103 return m_idInvalidationSets.size() > 0; | 108 return m_idInvalidationSets.size() > 0; |
| 104 } | 109 } |
| 105 | 110 |
| 106 DECLARE_TRACE(); | 111 DECLARE_TRACE(); |
| 107 | 112 |
| 108 HeapVector<RuleFeature> siblingRules; | 113 HeapVector<RuleFeature> siblingRules; |
| 109 HeapVector<RuleFeature> uncommonAttributeRules; | 114 HeapVector<RuleFeature> uncommonAttributeRules; |
| 110 | 115 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 128 bool foundInsertionPointCrossing = false; | 133 bool foundInsertionPointCrossing = false; |
| 129 unsigned maxDirectAdjacentSelectors = 0; | 134 unsigned maxDirectAdjacentSelectors = 0; |
| 130 }; | 135 }; |
| 131 | 136 |
| 132 SelectorPreMatch collectFeaturesFromSelector(const CSSSelector&, FeatureMeta
data&); | 137 SelectorPreMatch collectFeaturesFromSelector(const CSSSelector&, FeatureMeta
data&); |
| 133 | 138 |
| 134 InvalidationSet& ensureClassInvalidationSet(const AtomicString& className, I
nvalidationType); | 139 InvalidationSet& ensureClassInvalidationSet(const AtomicString& className, I
nvalidationType); |
| 135 InvalidationSet& ensureAttributeInvalidationSet(const AtomicString& attribut
eName, InvalidationType); | 140 InvalidationSet& ensureAttributeInvalidationSet(const AtomicString& attribut
eName, InvalidationType); |
| 136 InvalidationSet& ensureIdInvalidationSet(const AtomicString& id, Invalidatio
nType); | 141 InvalidationSet& ensureIdInvalidationSet(const AtomicString& id, Invalidatio
nType); |
| 137 InvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoType, Invali
dationType); | 142 InvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoType, Invali
dationType); |
| 143 SiblingInvalidationSet& ensureUniversalSiblingInvalidationSet(); |
| 138 | 144 |
| 139 void updateInvalidationSets(const RuleData&); | 145 void updateInvalidationSets(const RuleData&); |
| 140 void updateInvalidationSetsForContentAttribute(const RuleData&); | 146 void updateInvalidationSetsForContentAttribute(const RuleData&); |
| 141 | 147 |
| 142 struct InvalidationSetFeatures { | 148 struct InvalidationSetFeatures { |
| 143 DISALLOW_NEW(); | 149 DISALLOW_NEW(); |
| 144 | 150 |
| 145 Vector<AtomicString> classes; | 151 Vector<AtomicString> classes; |
| 146 Vector<AtomicString> attributes; | 152 Vector<AtomicString> attributes; |
| 147 AtomicString id; | 153 AtomicString id; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 159 | 165 |
| 160 static bool extractInvalidationSetFeature(const CSSSelector&, InvalidationSe
tFeatures&); | 166 static bool extractInvalidationSetFeature(const CSSSelector&, InvalidationSe
tFeatures&); |
| 161 | 167 |
| 162 enum UseFeaturesType { UseFeatures, ForceSubtree }; | 168 enum UseFeaturesType { UseFeatures, ForceSubtree }; |
| 163 | 169 |
| 164 enum PositionType { Subject, Ancestor }; | 170 enum PositionType { Subject, Ancestor }; |
| 165 std::pair<const CSSSelector*, UseFeaturesType> extractInvalidationSetFeature
s(const CSSSelector&, InvalidationSetFeatures&, PositionType, CSSSelector::Pseud
oType = CSSSelector::PseudoUnknown); | 171 std::pair<const CSSSelector*, UseFeaturesType> extractInvalidationSetFeature
s(const CSSSelector&, InvalidationSetFeatures&, PositionType, CSSSelector::Pseud
oType = CSSSelector::PseudoUnknown); |
| 166 | 172 |
| 167 void addFeaturesToInvalidationSet(InvalidationSet&, const InvalidationSetFea
tures&); | 173 void addFeaturesToInvalidationSet(InvalidationSet&, const InvalidationSetFea
tures&); |
| 168 void addFeaturesToInvalidationSets(const CSSSelector*, InvalidationSetFeatur
es* siblingFeatures, InvalidationSetFeatures& descendantFeatures); | 174 void addFeaturesToInvalidationSets(const CSSSelector*, InvalidationSetFeatur
es* siblingFeatures, InvalidationSetFeatures& descendantFeatures); |
| 175 void addFeaturesToUniversalSiblingInvalidationSet(const InvalidationSetFeatu
res& siblingFeatures, const InvalidationSetFeatures& descendantFeatures); |
| 169 | 176 |
| 170 void addClassToInvalidationSet(const AtomicString& className, Element&); | 177 void addClassToInvalidationSet(const AtomicString& className, Element&); |
| 171 | 178 |
| 172 FeatureMetadata m_metadata; | 179 FeatureMetadata m_metadata; |
| 173 InvalidationSetMap m_classInvalidationSets; | 180 InvalidationSetMap m_classInvalidationSets; |
| 174 InvalidationSetMap m_attributeInvalidationSets; | 181 InvalidationSetMap m_attributeInvalidationSets; |
| 175 InvalidationSetMap m_idInvalidationSets; | 182 InvalidationSetMap m_idInvalidationSets; |
| 176 PseudoTypeInvalidationSetMap m_pseudoInvalidationSets; | 183 PseudoTypeInvalidationSetMap m_pseudoInvalidationSets; |
| 184 RefPtr<SiblingInvalidationSet> m_universalSiblingInvalidationSet; |
| 177 | 185 |
| 178 friend class RuleFeatureSetTest; | 186 friend class RuleFeatureSetTest; |
| 179 }; | 187 }; |
| 180 | 188 |
| 181 } // namespace blink | 189 } // namespace blink |
| 182 | 190 |
| 183 #endif // RuleFeature_h | 191 #endif // RuleFeature_h |
| OLD | NEW |