| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 , maxDirectAdjacentSelectors(0) | 118 , maxDirectAdjacentSelectors(0) |
| 119 { } | 119 { } |
| 120 void add(const FeatureMetadata& other); | 120 void add(const FeatureMetadata& other); |
| 121 void clear(); | 121 void clear(); |
| 122 | 122 |
| 123 bool usesFirstLineRules; | 123 bool usesFirstLineRules; |
| 124 bool foundSiblingSelector; | 124 bool foundSiblingSelector; |
| 125 unsigned maxDirectAdjacentSelectors; | 125 unsigned maxDirectAdjacentSelectors; |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 enum InvalidationSetMode { | 128 void collectFeaturesFromSelector(const CSSSelector&, FeatureMetadata&); |
| 129 AddFeatures, | |
| 130 UseLocalStyleChange, | |
| 131 UseSubtreeStyleChange | |
| 132 }; | |
| 133 | |
| 134 static InvalidationSetMode invalidationSetModeForSelector(const CSSSelector&
); | |
| 135 | |
| 136 void collectFeaturesFromSelector(const CSSSelector&, FeatureMetadata&, Inval
idationSetMode); | |
| 137 void collectFeaturesFromSelectorList(const CSSSelectorList*, FeatureMetadata
&, InvalidationSetMode); | |
| 138 | 129 |
| 139 DescendantInvalidationSet& ensureClassInvalidationSet(const AtomicString& cl
assName); | 130 DescendantInvalidationSet& ensureClassInvalidationSet(const AtomicString& cl
assName); |
| 140 DescendantInvalidationSet& ensureAttributeInvalidationSet(const AtomicString
& attributeName); | 131 DescendantInvalidationSet& ensureAttributeInvalidationSet(const AtomicString
& attributeName); |
| 141 DescendantInvalidationSet& ensureIdInvalidationSet(const AtomicString& attri
buteName); | 132 DescendantInvalidationSet& ensureIdInvalidationSet(const AtomicString& attri
buteName); |
| 142 DescendantInvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoTy
pe); | 133 DescendantInvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoTy
pe); |
| 143 | 134 |
| 144 InvalidationSetMode updateInvalidationSets(const CSSSelector&); | 135 void updateInvalidationSets(const CSSSelector&); |
| 145 | 136 |
| 146 struct InvalidationSetFeatures { | 137 struct InvalidationSetFeatures { |
| 147 InvalidationSetFeatures() | 138 InvalidationSetFeatures() |
| 148 : customPseudoElement(false) | 139 : customPseudoElement(false) |
| 149 , treeBoundaryCrossing(false) | 140 , treeBoundaryCrossing(false) |
| 150 , adjacent(false) | 141 , adjacent(false) |
| 151 , insertionPointCrossing(false) | 142 , insertionPointCrossing(false) |
| 143 , forceSubtree(false) |
| 152 { } | 144 { } |
| 145 |
| 146 bool useSubtreeInvalidation() const { return forceSubtree || adjacent; } |
| 147 |
| 153 Vector<AtomicString> classes; | 148 Vector<AtomicString> classes; |
| 154 Vector<AtomicString> attributes; | 149 Vector<AtomicString> attributes; |
| 155 AtomicString id; | 150 AtomicString id; |
| 156 AtomicString tagName; | 151 AtomicString tagName; |
| 157 bool customPseudoElement; | 152 bool customPseudoElement; |
| 158 bool treeBoundaryCrossing; | 153 bool treeBoundaryCrossing; |
| 159 bool adjacent; | 154 bool adjacent; |
| 160 bool insertionPointCrossing; | 155 bool insertionPointCrossing; |
| 156 bool forceSubtree; |
| 161 }; | 157 }; |
| 162 | 158 |
| 163 static void extractInvalidationSetFeature(const CSSSelector&, InvalidationSe
tFeatures&); | 159 static bool extractInvalidationSetFeature(const CSSSelector&, InvalidationSe
tFeatures&); |
| 164 const CSSSelector* extractInvalidationSetFeatures(const CSSSelector&, Invali
dationSetFeatures&, bool negated); | 160 |
| 161 enum UseFeaturesType { UseFeatures, ForceSubtree }; |
| 162 |
| 163 std::pair<const CSSSelector*, UseFeaturesType> extractInvalidationSetFeature
s(const CSSSelector&, InvalidationSetFeatures&, bool negated); |
| 165 | 164 |
| 166 void addFeaturesToInvalidationSet(DescendantInvalidationSet&, const Invalida
tionSetFeatures&); | 165 void addFeaturesToInvalidationSet(DescendantInvalidationSet&, const Invalida
tionSetFeatures&); |
| 167 void addFeaturesToInvalidationSets(const CSSSelector&, InvalidationSetFeatur
es&); | 166 void addFeaturesToInvalidationSets(const CSSSelector&, InvalidationSetFeatur
es&); |
| 168 | 167 |
| 169 void addClassToInvalidationSet(const AtomicString& className, Element&); | 168 void addClassToInvalidationSet(const AtomicString& className, Element&); |
| 170 | 169 |
| 171 FeatureMetadata m_metadata; | 170 FeatureMetadata m_metadata; |
| 172 InvalidationSetMap m_classInvalidationSets; | 171 InvalidationSetMap m_classInvalidationSets; |
| 173 InvalidationSetMap m_attributeInvalidationSets; | 172 InvalidationSetMap m_attributeInvalidationSets; |
| 174 InvalidationSetMap m_idInvalidationSets; | 173 InvalidationSetMap m_idInvalidationSets; |
| 175 PseudoTypeInvalidationSetMap m_pseudoInvalidationSets; | 174 PseudoTypeInvalidationSetMap m_pseudoInvalidationSets; |
| 176 StyleInvalidator m_styleInvalidator; | 175 StyleInvalidator m_styleInvalidator; |
| 177 }; | 176 }; |
| 178 | 177 |
| 179 | 178 |
| 180 } // namespace blink | 179 } // namespace blink |
| 181 | 180 |
| 182 #endif // RuleFeature_h | 181 #endif // RuleFeature_h |
| OLD | NEW |