Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: Source/core/css/RuleSet.h

Issue 208423010: Remove SelectorCheckerFastPath (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: const Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/css/ElementRuleCollector.cpp ('k') | Source/core/css/RuleSet.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 RuleData(StyleRule*, unsigned selectorIndex, unsigned position, AddRuleFlags ); 74 RuleData(StyleRule*, unsigned selectorIndex, unsigned position, AddRuleFlags );
75 75
76 unsigned position() const { return m_position; } 76 unsigned position() const { return m_position; }
77 StyleRule* rule() const { return m_rule; } 77 StyleRule* rule() const { return m_rule; }
78 const CSSSelector& selector() const { return m_rule->selectorList().selector At(m_selectorIndex); } 78 const CSSSelector& selector() const { return m_rule->selectorList().selector At(m_selectorIndex); }
79 unsigned selectorIndex() const { return m_selectorIndex; } 79 unsigned selectorIndex() const { return m_selectorIndex; }
80 80
81 bool isLastInArray() const { return m_isLastInArray; } 81 bool isLastInArray() const { return m_isLastInArray; }
82 void setLastInArray(bool flag) { m_isLastInArray = flag; } 82 void setLastInArray(bool flag) { m_isLastInArray = flag; }
83 83
84 bool hasFastCheckableSelector() const { return m_hasFastCheckableSelector; }
85 bool hasMultipartSelector() const { return m_hasMultipartSelector; } 84 bool hasMultipartSelector() const { return m_hasMultipartSelector; }
86 bool hasRightmostSelectorMatchingHTMLBasedOnRuleHash() const { return m_hasR ightmostSelectorMatchingHTMLBasedOnRuleHash; } 85 bool hasRightmostSelectorMatchingHTMLBasedOnRuleHash() const { return m_hasR ightmostSelectorMatchingHTMLBasedOnRuleHash; }
87 bool containsUncommonAttributeSelector() const { return m_containsUncommonAt tributeSelector; } 86 bool containsUncommonAttributeSelector() const { return m_containsUncommonAt tributeSelector; }
88 unsigned specificity() const { return m_specificity; } 87 unsigned specificity() const { return m_specificity; }
89 unsigned linkMatchType() const { return m_linkMatchType; } 88 unsigned linkMatchType() const { return m_linkMatchType; }
90 bool hasDocumentSecurityOrigin() const { return m_hasDocumentSecurityOrigin; } 89 bool hasDocumentSecurityOrigin() const { return m_hasDocumentSecurityOrigin; }
91 PropertyWhitelistType propertyWhitelistType(bool isMatchingUARules = false) const { return isMatchingUARules ? PropertyWhitelistNone : static_cast<PropertyW hitelistType>(m_propertyWhitelistType); } 90 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. 91 // Try to balance between memory usage (there can be lots of RuleData object s) and good filtering performance.
93 static const unsigned maximumIdentifierCount = 4; 92 static const unsigned maximumIdentifierCount = 4;
94 const unsigned* descendantSelectorIdentifierHashes() const { return m_descen dantSelectorIdentifierHashes; } 93 const unsigned* descendantSelectorIdentifierHashes() const { return m_descen dantSelectorIdentifierHashes; }
95 94
96 void trace(Visitor*); 95 void trace(Visitor*);
97 96
98 private: 97 private:
99 RawPtrWillBeMember<StyleRule> m_rule; 98 RawPtrWillBeMember<StyleRule> m_rule;
100 unsigned m_selectorIndex : 12; 99 unsigned m_selectorIndex : 12;
101 unsigned m_isLastInArray : 1; // We store an array of RuleData objects in a primitive array. 100 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. 101 // 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. 102 // Some simple testing showed <100,000 RuleData's on large sites.
104 unsigned m_position : 18; 103 unsigned m_position : 18;
105 unsigned m_hasFastCheckableSelector : 1;
106 unsigned m_specificity : 24; 104 unsigned m_specificity : 24;
107 unsigned m_hasMultipartSelector : 1; 105 unsigned m_hasMultipartSelector : 1;
108 unsigned m_hasRightmostSelectorMatchingHTMLBasedOnRuleHash : 1; 106 unsigned m_hasRightmostSelectorMatchingHTMLBasedOnRuleHash : 1;
109 unsigned m_containsUncommonAttributeSelector : 1; 107 unsigned m_containsUncommonAttributeSelector : 1;
110 unsigned m_linkMatchType : 2; // SelectorChecker::LinkMatchMask 108 unsigned m_linkMatchType : 2; // SelectorChecker::LinkMatchMask
111 unsigned m_hasDocumentSecurityOrigin : 1; 109 unsigned m_hasDocumentSecurityOrigin : 1;
112 unsigned m_propertyWhitelistType : 2; 110 unsigned m_propertyWhitelistType : 2;
113 // Use plain array instead of a Vector to minimize memory overhead. 111 // Use plain array instead of a Vector to minimize memory overhead.
114 unsigned m_descendantSelectorIdentifierHashes[maximumIdentifierCount]; 112 unsigned m_descendantSelectorIdentifierHashes[maximumIdentifierCount];
115 }; 113 };
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 }; 243 };
246 244
247 template <> struct VectorTraits<WebCore::MinimalRuleData> : VectorTraitsBase<Web Core::MinimalRuleData> { 245 template <> struct VectorTraits<WebCore::MinimalRuleData> : VectorTraitsBase<Web Core::MinimalRuleData> {
248 static const bool canInitializeWithMemset = true; 246 static const bool canInitializeWithMemset = true;
249 static const bool canMoveWithMemcpy = true; 247 static const bool canMoveWithMemcpy = true;
250 }; 248 };
251 249
252 } 250 }
253 251
254 #endif // RuleSet_h 252 #endif // RuleSet_h
OLDNEW
« no previous file with comments | « Source/core/css/ElementRuleCollector.cpp ('k') | Source/core/css/RuleSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698