| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 inline bool hasSelectorForAttribute(const AtomicString& attributeName) const | 69 inline bool hasSelectorForAttribute(const AtomicString& attributeName) const |
| 70 { | 70 { |
| 71 ASSERT(!attributeName.isEmpty()); | 71 ASSERT(!attributeName.isEmpty()); |
| 72 return m_metadata.attrsInRules.contains(attributeName); | 72 return m_metadata.attrsInRules.contains(attributeName); |
| 73 } | 73 } |
| 74 | 74 |
| 75 inline bool hasSelectorForClass(const AtomicString& classValue) const | 75 inline bool hasSelectorForClass(const AtomicString& classValue) const |
| 76 { | 76 { |
| 77 ASSERT(!classValue.isEmpty()); | 77 ASSERT(!classValue.isEmpty()); |
| 78 return m_classInvalidationSets.get(classValue); | 78 return m_classInvalidationSets.get(classValue); |
| 79 | |
| 80 } | 79 } |
| 81 | 80 |
| 82 inline bool hasSelectorForId(const AtomicString& idValue) const | 81 inline bool hasSelectorForId(const AtomicString& idValue) const |
| 83 { | 82 { |
| 84 return m_metadata.idsInRules.contains(idValue); | 83 return m_metadata.idsInRules.contains(idValue); |
| 85 } | 84 } |
| 86 | 85 |
| 87 void scheduleStyleInvalidationForClassChange(const SpaceSplitString& changed
Classes, Element*); | 86 void scheduleStyleInvalidationForClassChange(const SpaceSplitString& changed
Classes, Element*); |
| 88 void scheduleStyleInvalidationForClassChange(const SpaceSplitString& oldClas
ses, const SpaceSplitString& newClasses, Element*); | 87 void scheduleStyleInvalidationForClassChange(const SpaceSplitString& oldClas
ses, const SpaceSplitString& newClasses, Element*); |
| 89 | 88 |
| 90 void computeStyleInvalidation(Document&); | |
| 91 | |
| 92 // Clears all style invalidation state for the passed node. | 89 // Clears all style invalidation state for the passed node. |
| 93 void clearStyleInvalidation(Node*); | 90 void clearStyleInvalidation(Node*); |
| 94 | 91 |
| 95 int hasIdsInSelectors() const | 92 int hasIdsInSelectors() const |
| 96 { | 93 { |
| 97 return m_metadata.idsInRules.size() > 0; | 94 return m_metadata.idsInRules.size() > 0; |
| 98 } | 95 } |
| 99 | 96 |
| 100 // Marks the given attribute name as "appearing in a selector". Used for | 97 // Marks the given attribute name as "appearing in a selector". Used for |
| 101 // CSS properties such as content: ... attr(...) ... | 98 // CSS properties such as content: ... attr(...) ... |
| 102 void addAttributeInASelector(const AtomicString& attributeName); | 99 void addAttributeInASelector(const AtomicString& attributeName); |
| 103 | 100 |
| 104 Vector<RuleFeature> siblingRules; | 101 Vector<RuleFeature> siblingRules; |
| 105 Vector<RuleFeature> uncommonAttributeRules; | 102 Vector<RuleFeature> uncommonAttributeRules; |
| 106 | 103 |
| 104 typedef Vector<RefPtr<DescendantInvalidationSet> > InvalidationList; |
| 105 typedef HashMap<Element*, OwnPtr<InvalidationList> > PendingInvalidationMap; |
| 106 |
| 107 PendingInvalidationMap& pendingInvalidationMap(); |
| 108 |
| 107 private: | 109 private: |
| 108 typedef HashMap<AtomicString, RefPtr<DescendantInvalidationSet> > Invalidati
onSetMap; | 110 typedef HashMap<AtomicString, RefPtr<DescendantInvalidationSet> > Invalidati
onSetMap; |
| 109 typedef Vector<RefPtr<DescendantInvalidationSet> > InvalidationList; | 111 |
| 110 typedef HashMap<Element*, OwnPtr<InvalidationList> > PendingInvalidationMap; | |
| 111 struct FeatureMetadata { | 112 struct FeatureMetadata { |
| 112 FeatureMetadata() | 113 FeatureMetadata() |
| 113 : usesFirstLineRules(false) | 114 : usesFirstLineRules(false) |
| 114 , foundSiblingSelector(false) | 115 , foundSiblingSelector(false) |
| 115 , maxDirectAdjacentSelectors(0) | 116 , maxDirectAdjacentSelectors(0) |
| 116 { } | 117 { } |
| 117 void add(const FeatureMetadata& other); | 118 void add(const FeatureMetadata& other); |
| 118 void clear(); | 119 void clear(); |
| 119 | 120 |
| 120 bool usesFirstLineRules; | 121 bool usesFirstLineRules; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 133 static InvalidationSetMode supportsClassDescendantInvalidation(const CSSSele
ctor&); | 134 static InvalidationSetMode supportsClassDescendantInvalidation(const CSSSele
ctor&); |
| 134 | 135 |
| 135 void collectFeaturesFromSelector(const CSSSelector&, FeatureMetadata&, Inval
idationSetMode); | 136 void collectFeaturesFromSelector(const CSSSelector&, FeatureMetadata&, Inval
idationSetMode); |
| 136 void collectFeaturesFromSelectorList(const CSSSelectorList*, FeatureMetadata
&, InvalidationSetMode); | 137 void collectFeaturesFromSelectorList(const CSSSelectorList*, FeatureMetadata
&, InvalidationSetMode); |
| 137 | 138 |
| 138 DescendantInvalidationSet& ensureClassInvalidationSet(const AtomicString& cl
assName); | 139 DescendantInvalidationSet& ensureClassInvalidationSet(const AtomicString& cl
assName); |
| 139 InvalidationSetMode updateClassInvalidationSets(const CSSSelector&); | 140 InvalidationSetMode updateClassInvalidationSets(const CSSSelector&); |
| 140 | 141 |
| 141 void addClassToInvalidationSet(const AtomicString& className, Element*); | 142 void addClassToInvalidationSet(const AtomicString& className, Element*); |
| 142 | 143 |
| 143 bool invalidateStyleForClassChange(Element*, Vector<AtomicString>&, bool fou
ndInvalidationSet); | |
| 144 bool invalidateStyleForClassChangeOnChildren(Element*, Vector<AtomicString>&
invalidationClasses, bool foundInvalidationSet); | |
| 145 | |
| 146 InvalidationList& ensurePendingInvalidationList(Element*); | 144 InvalidationList& ensurePendingInvalidationList(Element*); |
| 147 | 145 |
| 148 FeatureMetadata m_metadata; | 146 FeatureMetadata m_metadata; |
| 149 InvalidationSetMap m_classInvalidationSets; | 147 InvalidationSetMap m_classInvalidationSets; |
| 150 PendingInvalidationMap m_pendingInvalidationMap; | 148 PendingInvalidationMap m_pendingInvalidationMap; |
| 151 | 149 |
| 152 bool m_targetedStyleRecalcEnabled; | 150 bool m_targetedStyleRecalcEnabled; |
| 153 }; | 151 }; |
| 154 | 152 |
| 153 |
| 155 } // namespace WebCore | 154 } // namespace WebCore |
| 156 | 155 |
| 157 #endif // RuleFeature_h | 156 #endif // RuleFeature_h |
| OLD | NEW |