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, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 * | 19 * |
20 */ | 20 */ |
21 | 21 |
22 #ifndef RuleFeature_h | 22 #ifndef RuleFeature_h |
23 #define RuleFeature_h | 23 #define RuleFeature_h |
24 | 24 |
25 #include "core/CoreExport.h" | 25 #include "core/CoreExport.h" |
26 #include "core/css/CSSSelector.h" | 26 #include "core/css/CSSSelector.h" |
27 #include "core/css/invalidation/InvalidationSet.h" | 27 #include "core/css/invalidation/InvalidationSet.h" |
| 28 #include "platform/heap/Handle.h" |
28 #include "wtf/Forward.h" | 29 #include "wtf/Forward.h" |
29 #include "wtf/HashSet.h" | 30 #include "wtf/HashSet.h" |
30 #include "wtf/text/AtomicStringHash.h" | 31 #include "wtf/text/AtomicStringHash.h" |
31 | 32 |
32 namespace blink { | 33 namespace blink { |
33 | 34 |
34 class QualifiedName; | 35 class QualifiedName; |
35 class RuleData; | 36 class RuleData; |
36 class SpaceSplitString; | 37 class SpaceSplitString; |
37 class StyleRule; | 38 class StyleRule; |
38 | 39 |
39 struct RuleFeature { | 40 struct RuleFeature { |
40 ALLOW_ONLY_INLINE_ALLOCATION(); | 41 ALLOW_ONLY_INLINE_ALLOCATION(); |
41 public: | 42 public: |
42 RuleFeature(StyleRule*, unsigned selectorIndex, bool hasDocumentSecurityOrig
in); | 43 RuleFeature(StyleRule*, unsigned selectorIndex, bool hasDocumentSecurityOrig
in); |
43 | 44 |
44 DECLARE_TRACE(); | 45 DECLARE_TRACE(); |
45 | 46 |
46 RawPtrWillBeMember<StyleRule> rule; | 47 RawPtrWillBeMember<StyleRule> rule; |
47 unsigned selectorIndex; | 48 unsigned selectorIndex; |
48 bool hasDocumentSecurityOrigin; | 49 bool hasDocumentSecurityOrigin; |
49 }; | 50 }; |
50 | 51 |
51 using InvalidationSetVector = WillBeHeapVector<RefPtrWillBeMember<InvalidationSe
t>, 8>; | 52 using InvalidationSetVector = WillBeHeapVector<RefPtr<InvalidationSet>, 8>; |
52 | 53 |
53 class CORE_EXPORT RuleFeatureSet { | 54 class CORE_EXPORT RuleFeatureSet { |
54 DISALLOW_ALLOCATION(); | 55 DISALLOW_ALLOCATION(); |
55 public: | 56 public: |
56 RuleFeatureSet(); | 57 RuleFeatureSet(); |
57 ~RuleFeatureSet(); | 58 ~RuleFeatureSet(); |
58 | 59 |
59 void add(const RuleFeatureSet&); | 60 void add(const RuleFeatureSet&); |
60 void clear(); | 61 void clear(); |
61 | 62 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 95 |
95 DECLARE_TRACE(); | 96 DECLARE_TRACE(); |
96 | 97 |
97 WillBeHeapVector<RuleFeature> siblingRules; | 98 WillBeHeapVector<RuleFeature> siblingRules; |
98 WillBeHeapVector<RuleFeature> uncommonAttributeRules; | 99 WillBeHeapVector<RuleFeature> uncommonAttributeRules; |
99 | 100 |
100 protected: | 101 protected: |
101 InvalidationSet* invalidationSetForSelector(const CSSSelector&); | 102 InvalidationSet* invalidationSetForSelector(const CSSSelector&); |
102 | 103 |
103 private: | 104 private: |
104 using InvalidationSetMap = WillBeHeapHashMap<AtomicString, RefPtrWillBeMembe
r<InvalidationSet>>; | 105 using InvalidationSetMap = HashMap<AtomicString, RefPtr<InvalidationSet>>; |
105 using PseudoTypeInvalidationSetMap = WillBeHeapHashMap<CSSSelector::PseudoTy
pe, RefPtrWillBeMember<InvalidationSet>, WTF::IntHash<unsigned>, WTF::UnsignedWi
thZeroKeyHashTraits<unsigned>>; | 106 using PseudoTypeInvalidationSetMap = HashMap<CSSSelector::PseudoType, RefPtr
<InvalidationSet>, WTF::IntHash<unsigned>, WTF::UnsignedWithZeroKeyHashTraits<un
signed>>; |
106 | 107 |
107 struct FeatureMetadata { | 108 struct FeatureMetadata { |
108 DISALLOW_ALLOCATION(); | 109 DISALLOW_ALLOCATION(); |
109 FeatureMetadata() | 110 FeatureMetadata() |
110 : usesFirstLineRules(false) | 111 : usesFirstLineRules(false) |
111 , usesWindowInactiveSelector(false) | 112 , usesWindowInactiveSelector(false) |
112 , foundSiblingSelector(false) | 113 , foundSiblingSelector(false) |
113 , maxDirectAdjacentSelectors(0) | 114 , maxDirectAdjacentSelectors(0) |
114 { } | 115 { } |
115 void add(const FeatureMetadata& other); | 116 void add(const FeatureMetadata& other); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 InvalidationSetMap m_attributeInvalidationSets; | 173 InvalidationSetMap m_attributeInvalidationSets; |
173 InvalidationSetMap m_idInvalidationSets; | 174 InvalidationSetMap m_idInvalidationSets; |
174 PseudoTypeInvalidationSetMap m_pseudoInvalidationSets; | 175 PseudoTypeInvalidationSetMap m_pseudoInvalidationSets; |
175 }; | 176 }; |
176 | 177 |
177 } // namespace blink | 178 } // namespace blink |
178 | 179 |
179 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleFeature); | 180 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleFeature); |
180 | 181 |
181 #endif // RuleFeature_h | 182 #endif // RuleFeature_h |
OLD | NEW |