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. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
4 * All rights reserved. | 4 * All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * 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. |
10 * | 10 * |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 88 } |
89 unsigned SelectorIndex() const { return selector_index_; } | 89 unsigned SelectorIndex() const { return selector_index_; } |
90 | 90 |
91 bool IsLastInArray() const { return is_last_in_array_; } | 91 bool IsLastInArray() const { return is_last_in_array_; } |
92 void SetLastInArray(bool flag) { is_last_in_array_ = flag; } | 92 void SetLastInArray(bool flag) { is_last_in_array_ = flag; } |
93 | 93 |
94 bool ContainsUncommonAttributeSelector() const { | 94 bool ContainsUncommonAttributeSelector() const { |
95 return contains_uncommon_attribute_selector_; | 95 return contains_uncommon_attribute_selector_; |
96 } | 96 } |
97 unsigned Specificity() const { return specificity_; } | 97 unsigned Specificity() const { return specificity_; } |
98 unsigned LinkMatchType() const { return link_match_type_; } | 98 unsigned LinkMatchType() const { return Selector().linkMatchType(); } |
99 bool HasDocumentSecurityOrigin() const { | 99 bool HasDocumentSecurityOrigin() const { |
100 return has_document_security_origin_; | 100 return has_document_security_origin_; |
101 } | 101 } |
102 PropertyWhitelistType PropertyWhitelist( | 102 PropertyWhitelistType PropertyWhitelist( |
103 bool is_matching_ua_rules = false) const { | 103 bool is_matching_ua_rules = false) const { |
104 return is_matching_ua_rules | 104 return is_matching_ua_rules |
105 ? kPropertyWhitelistNone | 105 ? kPropertyWhitelistNone |
106 : static_cast<PropertyWhitelistType>(property_whitelist_); | 106 : static_cast<PropertyWhitelistType>(property_whitelist_); |
107 } | 107 } |
108 // Try to balance between memory usage (there can be lots of RuleData objects) | 108 // Try to balance between memory usage (there can be lots of RuleData objects) |
(...skipping 13 matching lines...) Expand all Loading... |
122 // See https://crbug.com/312913 and https://crbug.com/704562 | 122 // See https://crbug.com/312913 and https://crbug.com/704562 |
123 unsigned selector_index_ : 13; | 123 unsigned selector_index_ : 13; |
124 // We store an array of RuleData objects in a primitive array. | 124 // We store an array of RuleData objects in a primitive array. |
125 unsigned is_last_in_array_ : 1; | 125 unsigned is_last_in_array_ : 1; |
126 // This number was picked fairly arbitrarily. We can probably lower it if we | 126 // This number was picked fairly arbitrarily. We can probably lower it if we |
127 // need to. Some simple testing showed <100,000 RuleData's on large sites. | 127 // need to. Some simple testing showed <100,000 RuleData's on large sites. |
128 unsigned position_ : 18; | 128 unsigned position_ : 18; |
129 // 32 bits above | 129 // 32 bits above |
130 unsigned specificity_ : 24; | 130 unsigned specificity_ : 24; |
131 unsigned contains_uncommon_attribute_selector_ : 1; | 131 unsigned contains_uncommon_attribute_selector_ : 1; |
132 unsigned link_match_type_ : 2; // CSSSelector::LinkMatchMask | |
133 unsigned has_document_security_origin_ : 1; | 132 unsigned has_document_security_origin_ : 1; |
134 unsigned property_whitelist_ : 2; | 133 unsigned property_whitelist_ : 2; |
135 // 30 bits above | 134 // 30 bits above |
136 // Use plain array instead of a Vector to minimize memory overhead. | 135 // Use plain array instead of a Vector to minimize memory overhead. |
137 unsigned descendant_selector_identifier_hashes_[kMaximumIdentifierCount]; | 136 unsigned descendant_selector_identifier_hashes_[kMaximumIdentifierCount]; |
138 }; | 137 }; |
139 | 138 |
140 } // namespace blink | 139 } // namespace blink |
141 | 140 |
142 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleData); | 141 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleData); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 Member<PendingRuleMaps> pending_rules_; | 322 Member<PendingRuleMaps> pending_rules_; |
324 | 323 |
325 #ifndef NDEBUG | 324 #ifndef NDEBUG |
326 HeapVector<RuleData> all_rules_; | 325 HeapVector<RuleData> all_rules_; |
327 #endif | 326 #endif |
328 }; | 327 }; |
329 | 328 |
330 } // namespace blink | 329 } // namespace blink |
331 | 330 |
332 #endif // RuleSet_h | 331 #endif // RuleSet_h |
OLD | NEW |