| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 RuleFeatureSet(); | 54 RuleFeatureSet(); |
| 55 ~RuleFeatureSet(); | 55 ~RuleFeatureSet(); |
| 56 | 56 |
| 57 void add(const RuleFeatureSet&); | 57 void add(const RuleFeatureSet&); |
| 58 void clear(); | 58 void clear(); |
| 59 | 59 |
| 60 void collectFeaturesFromRuleData(const RuleData&); | 60 void collectFeaturesFromRuleData(const RuleData&); |
| 61 | 61 |
| 62 bool usesSiblingRules() const { return !siblingRules.isEmpty(); } | 62 bool usesSiblingRules() const { return !siblingRules.isEmpty(); } |
| 63 bool usesFirstLineRules() const { return m_metadata.usesFirstLineRules; } | 63 bool usesFirstLineRules() const { return m_metadata.usesFirstLineRules; } |
| 64 bool usesWindowInactiveSelector() const { return m_metadata.usesWindowInacti
veSelector; } |
| 64 | 65 |
| 65 unsigned maxDirectAdjacentSelectors() const { return m_metadata.maxDirectAdj
acentSelectors; } | 66 unsigned maxDirectAdjacentSelectors() const { return m_metadata.maxDirectAdj
acentSelectors; } |
| 66 void setMaxDirectAdjacentSelectors(unsigned value) { m_metadata.maxDirectAd
jacentSelectors = std::max(value, m_metadata.maxDirectAdjacentSelectors); } | 67 void setMaxDirectAdjacentSelectors(unsigned value) { m_metadata.maxDirectAd
jacentSelectors = std::max(value, m_metadata.maxDirectAdjacentSelectors); } |
| 67 | 68 |
| 68 bool hasSelectorForAttribute(const AtomicString& attributeName) const | 69 bool hasSelectorForAttribute(const AtomicString& attributeName) const |
| 69 { | 70 { |
| 70 ASSERT(!attributeName.isEmpty()); | 71 ASSERT(!attributeName.isEmpty()); |
| 71 return m_attributeInvalidationSets.contains(attributeName); | 72 return m_attributeInvalidationSets.contains(attributeName); |
| 72 } | 73 } |
| 73 | 74 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 101 protected: | 102 protected: |
| 102 DescendantInvalidationSet* invalidationSetForSelector(const CSSSelector&); | 103 DescendantInvalidationSet* invalidationSetForSelector(const CSSSelector&); |
| 103 | 104 |
| 104 private: | 105 private: |
| 105 typedef WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<DescendantInvalid
ationSet> > InvalidationSetMap; | 106 typedef WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<DescendantInvalid
ationSet> > InvalidationSetMap; |
| 106 typedef WillBeHeapHashMap<CSSSelector::PseudoType, RefPtrWillBeMember<Descen
dantInvalidationSet>, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits
<unsigned> > PseudoTypeInvalidationSetMap; | 107 typedef WillBeHeapHashMap<CSSSelector::PseudoType, RefPtrWillBeMember<Descen
dantInvalidationSet>, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits
<unsigned> > PseudoTypeInvalidationSetMap; |
| 107 | 108 |
| 108 struct FeatureMetadata { | 109 struct FeatureMetadata { |
| 109 FeatureMetadata() | 110 FeatureMetadata() |
| 110 : usesFirstLineRules(false) | 111 : usesFirstLineRules(false) |
| 112 , usesWindowInactiveSelector(false) |
| 111 , foundSiblingSelector(false) | 113 , foundSiblingSelector(false) |
| 112 , maxDirectAdjacentSelectors(0) | 114 , maxDirectAdjacentSelectors(0) |
| 113 { } | 115 { } |
| 114 void add(const FeatureMetadata& other); | 116 void add(const FeatureMetadata& other); |
| 115 void clear(); | 117 void clear(); |
| 116 | 118 |
| 117 bool usesFirstLineRules; | 119 bool usesFirstLineRules; |
| 120 bool usesWindowInactiveSelector; |
| 118 bool foundSiblingSelector; | 121 bool foundSiblingSelector; |
| 119 unsigned maxDirectAdjacentSelectors; | 122 unsigned maxDirectAdjacentSelectors; |
| 120 }; | 123 }; |
| 121 | 124 |
| 122 void collectFeaturesFromSelector(const CSSSelector&, FeatureMetadata&); | 125 void collectFeaturesFromSelector(const CSSSelector&, FeatureMetadata&); |
| 123 | 126 |
| 124 DescendantInvalidationSet& ensureClassInvalidationSet(const AtomicString& cl
assName); | 127 DescendantInvalidationSet& ensureClassInvalidationSet(const AtomicString& cl
assName); |
| 125 DescendantInvalidationSet& ensureAttributeInvalidationSet(const AtomicString
& attributeName); | 128 DescendantInvalidationSet& ensureAttributeInvalidationSet(const AtomicString
& attributeName); |
| 126 DescendantInvalidationSet& ensureIdInvalidationSet(const AtomicString& attri
buteName); | 129 DescendantInvalidationSet& ensureIdInvalidationSet(const AtomicString& attri
buteName); |
| 127 DescendantInvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoTy
pe); | 130 DescendantInvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoTy
pe); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 InvalidationSetMap m_attributeInvalidationSets; | 172 InvalidationSetMap m_attributeInvalidationSets; |
| 170 InvalidationSetMap m_idInvalidationSets; | 173 InvalidationSetMap m_idInvalidationSets; |
| 171 PseudoTypeInvalidationSetMap m_pseudoInvalidationSets; | 174 PseudoTypeInvalidationSetMap m_pseudoInvalidationSets; |
| 172 StyleInvalidator m_styleInvalidator; | 175 StyleInvalidator m_styleInvalidator; |
| 173 }; | 176 }; |
| 174 | 177 |
| 175 | 178 |
| 176 } // namespace blink | 179 } // namespace blink |
| 177 | 180 |
| 178 #endif // RuleFeature_h | 181 #endif // RuleFeature_h |
| OLD | NEW |