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. |
| 4 * All rights reserved. |
4 * | 5 * |
5 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
9 * | 10 * |
10 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 14 * Library General Public License for more details. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 94 } |
94 unsigned specificity() const { return m_specificity; } | 95 unsigned specificity() const { return m_specificity; } |
95 unsigned linkMatchType() const { return m_linkMatchType; } | 96 unsigned linkMatchType() const { return m_linkMatchType; } |
96 bool hasDocumentSecurityOrigin() const { return m_hasDocumentSecurityOrigin; } | 97 bool hasDocumentSecurityOrigin() const { return m_hasDocumentSecurityOrigin; } |
97 PropertyWhitelistType propertyWhitelist( | 98 PropertyWhitelistType propertyWhitelist( |
98 bool isMatchingUARules = false) const { | 99 bool isMatchingUARules = false) const { |
99 return isMatchingUARules | 100 return isMatchingUARules |
100 ? PropertyWhitelistNone | 101 ? PropertyWhitelistNone |
101 : static_cast<PropertyWhitelistType>(m_propertyWhitelist); | 102 : static_cast<PropertyWhitelistType>(m_propertyWhitelist); |
102 } | 103 } |
103 // Try to balance between memory usage (there can be lots of RuleData objects)
and good filtering performance. | 104 // Try to balance between memory usage (there can be lots of RuleData objects) |
| 105 // and good filtering performance. |
104 static const unsigned maximumIdentifierCount = 4; | 106 static const unsigned maximumIdentifierCount = 4; |
105 const unsigned* descendantSelectorIdentifierHashes() const { | 107 const unsigned* descendantSelectorIdentifierHashes() const { |
106 return m_descendantSelectorIdentifierHashes; | 108 return m_descendantSelectorIdentifierHashes; |
107 } | 109 } |
108 | 110 |
109 DECLARE_TRACE(); | 111 DECLARE_TRACE(); |
110 | 112 |
111 private: | 113 private: |
112 Member<StyleRule> m_rule; | 114 Member<StyleRule> m_rule; |
113 unsigned m_selectorIndex : 13; | 115 unsigned m_selectorIndex : 13; |
114 unsigned | 116 // We store an array of RuleData objects in a primitive array. |
115 m_isLastInArray : 1; // We store an array of RuleData objects in a primit
ive array. | 117 unsigned m_isLastInArray : 1; |
116 // This number was picked fairly arbitrarily. We can probably lower it if we n
eed to. | 118 // This number was picked fairly arbitrarily. We can probably lower it if we |
117 // Some simple testing showed <100,000 RuleData's on large sites. | 119 // need to. Some simple testing showed <100,000 RuleData's on large sites. |
118 unsigned m_position : 18; | 120 unsigned m_position : 18; |
119 unsigned m_specificity : 24; | 121 unsigned m_specificity : 24; |
120 unsigned m_containsUncommonAttributeSelector : 1; | 122 unsigned m_containsUncommonAttributeSelector : 1; |
121 unsigned m_linkMatchType : 2; // CSSSelector::LinkMatchMask | 123 unsigned m_linkMatchType : 2; // CSSSelector::LinkMatchMask |
122 unsigned m_hasDocumentSecurityOrigin : 1; | 124 unsigned m_hasDocumentSecurityOrigin : 1; |
123 unsigned m_propertyWhitelist : 2; | 125 unsigned m_propertyWhitelist : 2; |
124 // Use plain array instead of a Vector to minimize memory overhead. | 126 // Use plain array instead of a Vector to minimize memory overhead. |
125 unsigned m_descendantSelectorIdentifierHashes[maximumIdentifierCount]; | 127 unsigned m_descendantSelectorIdentifierHashes[maximumIdentifierCount]; |
126 }; | 128 }; |
127 | 129 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 Member<PendingRuleMaps> m_pendingRules; | 322 Member<PendingRuleMaps> m_pendingRules; |
321 | 323 |
322 #ifndef NDEBUG | 324 #ifndef NDEBUG |
323 HeapVector<RuleData> m_allRules; | 325 HeapVector<RuleData> m_allRules; |
324 #endif | 326 #endif |
325 }; | 327 }; |
326 | 328 |
327 } // namespace blink | 329 } // namespace blink |
328 | 330 |
329 #endif // RuleSet_h | 331 #endif // RuleSet_h |
OLD | NEW |