| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 RuleData(StyleRule*, unsigned selectorIndex, unsigned position, AddRuleFlags
); | 75 RuleData(StyleRule*, unsigned selectorIndex, unsigned position, AddRuleFlags
); |
| 76 | 76 |
| 77 unsigned position() const { return m_position; } | 77 unsigned position() const { return m_position; } |
| 78 StyleRule* rule() const { return m_rule; } | 78 StyleRule* rule() const { return m_rule; } |
| 79 const CSSSelector& selector() const { return m_rule->selectorList().selector
At(m_selectorIndex); } | 79 const CSSSelector& selector() const { return m_rule->selectorList().selector
At(m_selectorIndex); } |
| 80 unsigned selectorIndex() const { return m_selectorIndex; } | 80 unsigned selectorIndex() const { return m_selectorIndex; } |
| 81 | 81 |
| 82 bool isLastInArray() const { return m_isLastInArray; } | 82 bool isLastInArray() const { return m_isLastInArray; } |
| 83 void setLastInArray(bool flag) { m_isLastInArray = flag; } | 83 void setLastInArray(bool flag) { m_isLastInArray = flag; } |
| 84 | 84 |
| 85 bool hasMultipartSelector() const { return m_hasMultipartSelector; } | |
| 86 bool hasRightmostSelectorMatchingHTMLBasedOnRuleHash() const { return m_hasR
ightmostSelectorMatchingHTMLBasedOnRuleHash; } | |
| 87 bool containsUncommonAttributeSelector() const { return m_containsUncommonAt
tributeSelector; } | 85 bool containsUncommonAttributeSelector() const { return m_containsUncommonAt
tributeSelector; } |
| 88 unsigned specificity() const { return m_specificity; } | 86 unsigned specificity() const { return m_specificity; } |
| 89 unsigned linkMatchType() const { return m_linkMatchType; } | 87 unsigned linkMatchType() const { return m_linkMatchType; } |
| 90 bool hasDocumentSecurityOrigin() const { return m_hasDocumentSecurityOrigin;
} | 88 bool hasDocumentSecurityOrigin() const { return m_hasDocumentSecurityOrigin;
} |
| 91 PropertyWhitelistType propertyWhitelistType(bool isMatchingUARules = false)
const { return isMatchingUARules ? PropertyWhitelistNone : static_cast<PropertyW
hitelistType>(m_propertyWhitelistType); } | 89 PropertyWhitelistType propertyWhitelistType(bool isMatchingUARules = false)
const { return isMatchingUARules ? PropertyWhitelistNone : static_cast<PropertyW
hitelistType>(m_propertyWhitelistType); } |
| 92 // Try to balance between memory usage (there can be lots of RuleData object
s) and good filtering performance. | 90 // Try to balance between memory usage (there can be lots of RuleData object
s) and good filtering performance. |
| 93 static const unsigned maximumIdentifierCount = 4; | 91 static const unsigned maximumIdentifierCount = 4; |
| 94 const unsigned* descendantSelectorIdentifierHashes() const { return m_descen
dantSelectorIdentifierHashes; } | 92 const unsigned* descendantSelectorIdentifierHashes() const { return m_descen
dantSelectorIdentifierHashes; } |
| 95 | 93 |
| 96 void trace(Visitor*); | 94 void trace(Visitor*); |
| 97 | 95 |
| 98 private: | 96 private: |
| 99 RawPtrWillBeMember<StyleRule> m_rule; | 97 RawPtrWillBeMember<StyleRule> m_rule; |
| 100 unsigned m_selectorIndex : 12; | 98 unsigned m_selectorIndex : 12; |
| 101 unsigned m_isLastInArray : 1; // We store an array of RuleData objects in a
primitive array. | 99 unsigned m_isLastInArray : 1; // We store an array of RuleData objects in a
primitive array. |
| 102 // This number was picked fairly arbitrarily. We can probably lower it if we
need to. | 100 // This number was picked fairly arbitrarily. We can probably lower it if we
need to. |
| 103 // Some simple testing showed <100,000 RuleData's on large sites. | 101 // Some simple testing showed <100,000 RuleData's on large sites. |
| 104 unsigned m_position : 18; | 102 unsigned m_position : 18; |
| 105 unsigned m_specificity : 24; | 103 unsigned m_specificity : 24; |
| 106 unsigned m_hasMultipartSelector : 1; | |
| 107 unsigned m_hasRightmostSelectorMatchingHTMLBasedOnRuleHash : 1; | |
| 108 unsigned m_containsUncommonAttributeSelector : 1; | 104 unsigned m_containsUncommonAttributeSelector : 1; |
| 109 unsigned m_linkMatchType : 2; // SelectorChecker::LinkMatchMask | 105 unsigned m_linkMatchType : 2; // SelectorChecker::LinkMatchMask |
| 110 unsigned m_hasDocumentSecurityOrigin : 1; | 106 unsigned m_hasDocumentSecurityOrigin : 1; |
| 111 unsigned m_propertyWhitelistType : 2; | 107 unsigned m_propertyWhitelistType : 2; |
| 112 // Use plain array instead of a Vector to minimize memory overhead. | 108 // Use plain array instead of a Vector to minimize memory overhead. |
| 113 unsigned m_descendantSelectorIdentifierHashes[maximumIdentifierCount]; | 109 unsigned m_descendantSelectorIdentifierHashes[maximumIdentifierCount]; |
| 114 }; | 110 }; |
| 115 | 111 |
| 116 struct SameSizeAsRuleData { | 112 struct SameSizeAsRuleData { |
| 117 void* a; | 113 void* a; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 WillBeHeapVector<RuleData> m_allRules; | 231 WillBeHeapVector<RuleData> m_allRules; |
| 236 #endif | 232 #endif |
| 237 }; | 233 }; |
| 238 | 234 |
| 239 } // namespace blink | 235 } // namespace blink |
| 240 | 236 |
| 241 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleData); | 237 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleData); |
| 242 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::MinimalRuleData); | 238 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::MinimalRuleData); |
| 243 | 239 |
| 244 #endif // RuleSet_h | 240 #endif // RuleSet_h |
| OLD | NEW |