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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 class RuleFeatureSet { | 52 class RuleFeatureSet { |
53 DISALLOW_ALLOCATION(); | 53 DISALLOW_ALLOCATION(); |
54 public: | 54 public: |
55 RuleFeatureSet(); | 55 RuleFeatureSet(); |
56 ~RuleFeatureSet(); | 56 ~RuleFeatureSet(); |
57 | 57 |
58 void add(const RuleFeatureSet&); | 58 void add(const RuleFeatureSet&); |
59 void clear(); | 59 void clear(); |
60 | 60 |
61 void collectFeaturesFromSelector(const CSSSelector&); | |
62 void collectFeaturesFromRuleData(const RuleData&); | 61 void collectFeaturesFromRuleData(const RuleData&); |
63 | 62 |
64 bool usesSiblingRules() const { return !siblingRules.isEmpty(); } | 63 bool usesSiblingRules() const { return !siblingRules.isEmpty(); } |
65 bool usesFirstLineRules() const { return m_metadata.usesFirstLineRules; } | 64 bool usesFirstLineRules() const { return m_metadata.usesFirstLineRules; } |
66 | 65 |
67 unsigned maxDirectAdjacentSelectors() const { return m_metadata.maxDirectAdj
acentSelectors; } | 66 unsigned maxDirectAdjacentSelectors() const { return m_metadata.maxDirectAdj
acentSelectors; } |
68 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); } |
69 | 68 |
70 bool hasSelectorForAttribute(const AtomicString& attributeName) const | 69 bool hasSelectorForAttribute(const AtomicString& attributeName) const |
71 { | 70 { |
(...skipping 26 matching lines...) Expand all Loading... |
98 // FIXME: record these internally to this class instead calls from StyleReso
lver to here. | 97 // FIXME: record these internally to this class instead calls from StyleReso
lver to here. |
99 void addContentAttr(const AtomicString& attributeName); | 98 void addContentAttr(const AtomicString& attributeName); |
100 | 99 |
101 StyleInvalidator& styleInvalidator(); | 100 StyleInvalidator& styleInvalidator(); |
102 | 101 |
103 void trace(Visitor*); | 102 void trace(Visitor*); |
104 | 103 |
105 WillBeHeapVector<RuleFeature> siblingRules; | 104 WillBeHeapVector<RuleFeature> siblingRules; |
106 WillBeHeapVector<RuleFeature> uncommonAttributeRules; | 105 WillBeHeapVector<RuleFeature> uncommonAttributeRules; |
107 | 106 |
| 107 protected: |
| 108 DescendantInvalidationSet* invalidationSetForSelector(const CSSSelector&); |
| 109 |
108 private: | 110 private: |
109 typedef WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<DescendantInvalid
ationSet> > InvalidationSetMap; | 111 typedef WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<DescendantInvalid
ationSet> > InvalidationSetMap; |
110 typedef WillBeHeapHashMap<CSSSelector::PseudoType, RefPtrWillBeMember<Descen
dantInvalidationSet>, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits
<unsigned> > PseudoTypeInvalidationSetMap; | 112 typedef WillBeHeapHashMap<CSSSelector::PseudoType, RefPtrWillBeMember<Descen
dantInvalidationSet>, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits
<unsigned> > PseudoTypeInvalidationSetMap; |
111 | 113 |
112 struct FeatureMetadata { | 114 struct FeatureMetadata { |
113 FeatureMetadata() | 115 FeatureMetadata() |
114 : usesFirstLineRules(false) | 116 : usesFirstLineRules(false) |
115 , foundSiblingSelector(false) | 117 , foundSiblingSelector(false) |
116 , maxDirectAdjacentSelectors(0) | 118 , maxDirectAdjacentSelectors(0) |
117 { } | 119 { } |
(...skipping 13 matching lines...) Expand all Loading... |
131 | 133 |
132 static InvalidationSetMode invalidationSetModeForSelector(const CSSSelector&
); | 134 static InvalidationSetMode invalidationSetModeForSelector(const CSSSelector&
); |
133 | 135 |
134 void collectFeaturesFromSelector(const CSSSelector&, FeatureMetadata&, Inval
idationSetMode); | 136 void collectFeaturesFromSelector(const CSSSelector&, FeatureMetadata&, Inval
idationSetMode); |
135 void collectFeaturesFromSelectorList(const CSSSelectorList*, FeatureMetadata
&, InvalidationSetMode); | 137 void collectFeaturesFromSelectorList(const CSSSelectorList*, FeatureMetadata
&, InvalidationSetMode); |
136 | 138 |
137 DescendantInvalidationSet& ensureClassInvalidationSet(const AtomicString& cl
assName); | 139 DescendantInvalidationSet& ensureClassInvalidationSet(const AtomicString& cl
assName); |
138 DescendantInvalidationSet& ensureAttributeInvalidationSet(const AtomicString
& attributeName); | 140 DescendantInvalidationSet& ensureAttributeInvalidationSet(const AtomicString
& attributeName); |
139 DescendantInvalidationSet& ensureIdInvalidationSet(const AtomicString& attri
buteName); | 141 DescendantInvalidationSet& ensureIdInvalidationSet(const AtomicString& attri
buteName); |
140 DescendantInvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoTy
pe); | 142 DescendantInvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoTy
pe); |
141 DescendantInvalidationSet* invalidationSetForSelector(const CSSSelector&); | |
142 | 143 |
143 InvalidationSetMode updateInvalidationSets(const CSSSelector&); | 144 InvalidationSetMode updateInvalidationSets(const CSSSelector&); |
144 | 145 |
145 struct InvalidationSetFeatures { | 146 struct InvalidationSetFeatures { |
146 InvalidationSetFeatures() | 147 InvalidationSetFeatures() |
147 : customPseudoElement(false) | 148 : customPseudoElement(false) |
148 , treeBoundaryCrossing(false) | 149 , treeBoundaryCrossing(false) |
149 , wholeSubtree(false) | 150 , wholeSubtree(false) |
150 { } | 151 { } |
151 Vector<AtomicString> classes; | 152 Vector<AtomicString> classes; |
(...skipping 26 matching lines...) Expand all Loading... |
178 | 179 |
179 template <> struct VectorTraits<blink::RuleFeature> : VectorTraitsBase<blink::Ru
leFeature> { | 180 template <> struct VectorTraits<blink::RuleFeature> : VectorTraitsBase<blink::Ru
leFeature> { |
180 static const bool needsDestruction = false; | 181 static const bool needsDestruction = false; |
181 static const bool canInitializeWithMemset = true; | 182 static const bool canInitializeWithMemset = true; |
182 static const bool canMoveWithMemcpy = true; | 183 static const bool canMoveWithMemcpy = true; |
183 }; | 184 }; |
184 | 185 |
185 } // namespace WTF | 186 } // namespace WTF |
186 | 187 |
187 #endif // RuleFeature_h | 188 #endif // RuleFeature_h |
OLD | NEW |