| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 void scheduleStyleInvalidationForClassChange(const SpaceSplitString& oldClas
ses, const SpaceSplitString& newClasses, Element&); | 85 void scheduleStyleInvalidationForClassChange(const SpaceSplitString& oldClas
ses, const SpaceSplitString& newClasses, Element&); |
| 86 void scheduleStyleInvalidationForAttributeChange(const QualifiedName& attrib
uteName, Element&); | 86 void scheduleStyleInvalidationForAttributeChange(const QualifiedName& attrib
uteName, Element&); |
| 87 void scheduleStyleInvalidationForIdChange(const AtomicString& oldId, const A
tomicString& newId, Element&); | 87 void scheduleStyleInvalidationForIdChange(const AtomicString& oldId, const A
tomicString& newId, Element&); |
| 88 void scheduleStyleInvalidationForPseudoChange(CSSSelector::PseudoType, Eleme
nt&); | 88 void scheduleStyleInvalidationForPseudoChange(CSSSelector::PseudoType, Eleme
nt&); |
| 89 | 89 |
| 90 bool hasIdsInSelectors() const | 90 bool hasIdsInSelectors() const |
| 91 { | 91 { |
| 92 return m_idInvalidationSets.size() > 0; | 92 return m_idInvalidationSets.size() > 0; |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Marks the given attribute name as "appearing in a selector". Used for | |
| 96 // CSS properties such as content: ... attr(...) ... | |
| 97 // FIXME: record these internally to this class instead calls from StyleReso
lver to here. | |
| 98 void addContentAttr(const AtomicString& attributeName); | |
| 99 | |
| 100 StyleInvalidator& styleInvalidator(); | 95 StyleInvalidator& styleInvalidator(); |
| 101 | 96 |
| 102 void trace(Visitor*); | 97 void trace(Visitor*); |
| 103 | 98 |
| 104 WillBeHeapVector<RuleFeature> siblingRules; | 99 WillBeHeapVector<RuleFeature> siblingRules; |
| 105 WillBeHeapVector<RuleFeature> uncommonAttributeRules; | 100 WillBeHeapVector<RuleFeature> uncommonAttributeRules; |
| 106 | 101 |
| 107 protected: | 102 protected: |
| 108 DescendantInvalidationSet* invalidationSetForSelector(const CSSSelector&); | 103 DescendantInvalidationSet* invalidationSetForSelector(const CSSSelector&); |
| 109 | 104 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 125 unsigned maxDirectAdjacentSelectors; | 120 unsigned maxDirectAdjacentSelectors; |
| 126 }; | 121 }; |
| 127 | 122 |
| 128 void collectFeaturesFromSelector(const CSSSelector&, FeatureMetadata&); | 123 void collectFeaturesFromSelector(const CSSSelector&, FeatureMetadata&); |
| 129 | 124 |
| 130 DescendantInvalidationSet& ensureClassInvalidationSet(const AtomicString& cl
assName); | 125 DescendantInvalidationSet& ensureClassInvalidationSet(const AtomicString& cl
assName); |
| 131 DescendantInvalidationSet& ensureAttributeInvalidationSet(const AtomicString
& attributeName); | 126 DescendantInvalidationSet& ensureAttributeInvalidationSet(const AtomicString
& attributeName); |
| 132 DescendantInvalidationSet& ensureIdInvalidationSet(const AtomicString& attri
buteName); | 127 DescendantInvalidationSet& ensureIdInvalidationSet(const AtomicString& attri
buteName); |
| 133 DescendantInvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoTy
pe); | 128 DescendantInvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoTy
pe); |
| 134 | 129 |
| 135 void updateInvalidationSets(const CSSSelector&); | 130 void updateInvalidationSets(const RuleData&); |
| 131 void updateInvalidationSetsForContentAttribute(const RuleData&); |
| 136 | 132 |
| 137 struct InvalidationSetFeatures { | 133 struct InvalidationSetFeatures { |
| 138 InvalidationSetFeatures() | 134 InvalidationSetFeatures() |
| 139 : customPseudoElement(false) | 135 : customPseudoElement(false) |
| 136 , hasBeforeOrAfter(false) |
| 140 , treeBoundaryCrossing(false) | 137 , treeBoundaryCrossing(false) |
| 141 , adjacent(false) | 138 , adjacent(false) |
| 142 , insertionPointCrossing(false) | 139 , insertionPointCrossing(false) |
| 143 , forceSubtree(false) | 140 , forceSubtree(false) |
| 144 { } | 141 { } |
| 145 | 142 |
| 146 bool useSubtreeInvalidation() const { return forceSubtree || adjacent; } | 143 bool useSubtreeInvalidation() const { return forceSubtree || adjacent; } |
| 147 | 144 |
| 148 Vector<AtomicString> classes; | 145 Vector<AtomicString> classes; |
| 149 Vector<AtomicString> attributes; | 146 Vector<AtomicString> attributes; |
| 150 AtomicString id; | 147 AtomicString id; |
| 151 AtomicString tagName; | 148 AtomicString tagName; |
| 152 bool customPseudoElement; | 149 bool customPseudoElement; |
| 150 bool hasBeforeOrAfter; |
| 153 bool treeBoundaryCrossing; | 151 bool treeBoundaryCrossing; |
| 154 bool adjacent; | 152 bool adjacent; |
| 155 bool insertionPointCrossing; | 153 bool insertionPointCrossing; |
| 156 bool forceSubtree; | 154 bool forceSubtree; |
| 157 }; | 155 }; |
| 158 | 156 |
| 159 static bool extractInvalidationSetFeature(const CSSSelector&, InvalidationSe
tFeatures&); | 157 static bool extractInvalidationSetFeature(const CSSSelector&, InvalidationSe
tFeatures&); |
| 160 | 158 |
| 161 enum UseFeaturesType { UseFeatures, ForceSubtree }; | 159 enum UseFeaturesType { UseFeatures, ForceSubtree }; |
| 162 | 160 |
| 163 std::pair<const CSSSelector*, UseFeaturesType> extractInvalidationSetFeature
s(const CSSSelector&, InvalidationSetFeatures&, bool negated); | 161 std::pair<const CSSSelector*, UseFeaturesType> extractInvalidationSetFeature
s(const CSSSelector&, InvalidationSetFeatures&, bool negated); |
| 164 | 162 |
| 165 void addFeaturesToInvalidationSet(DescendantInvalidationSet&, const Invalida
tionSetFeatures&); | 163 void addFeaturesToInvalidationSet(DescendantInvalidationSet&, const Invalida
tionSetFeatures&); |
| 166 void addFeaturesToInvalidationSets(const CSSSelector&, InvalidationSetFeatur
es&); | 164 void addFeaturesToInvalidationSets(const CSSSelector&, InvalidationSetFeatur
es&); |
| 167 | 165 |
| 168 void addClassToInvalidationSet(const AtomicString& className, Element&); | 166 void addClassToInvalidationSet(const AtomicString& className, Element&); |
| 169 | 167 |
| 170 FeatureMetadata m_metadata; | 168 FeatureMetadata m_metadata; |
| 171 InvalidationSetMap m_classInvalidationSets; | 169 InvalidationSetMap m_classInvalidationSets; |
| 172 InvalidationSetMap m_attributeInvalidationSets; | 170 InvalidationSetMap m_attributeInvalidationSets; |
| 173 InvalidationSetMap m_idInvalidationSets; | 171 InvalidationSetMap m_idInvalidationSets; |
| 174 PseudoTypeInvalidationSetMap m_pseudoInvalidationSets; | 172 PseudoTypeInvalidationSetMap m_pseudoInvalidationSets; |
| 175 StyleInvalidator m_styleInvalidator; | 173 StyleInvalidator m_styleInvalidator; |
| 176 }; | 174 }; |
| 177 | 175 |
| 178 | 176 |
| 179 } // namespace blink | 177 } // namespace blink |
| 180 | 178 |
| 181 #endif // RuleFeature_h | 179 #endif // RuleFeature_h |
| OLD | NEW |