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

Side by Side Diff: third_party/WebKit/Source/core/css/RuleFeature.h

Issue 1703893002: Don't add rule feature data for rules which may never match. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@uncommon-attr-20160216
Patch Set: Created 4 years, 10 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 class CORE_EXPORT RuleFeatureSet { 53 class CORE_EXPORT RuleFeatureSet {
54 DISALLOW_NEW(); 54 DISALLOW_NEW();
55 public: 55 public:
56 RuleFeatureSet(); 56 RuleFeatureSet();
57 ~RuleFeatureSet(); 57 ~RuleFeatureSet();
58 58
59 void add(const RuleFeatureSet&); 59 void add(const RuleFeatureSet&);
60 void clear(); 60 void clear();
61 61
62 void collectFeaturesFromRuleData(const RuleData&); 62 enum SelectorPreMatch { SelectorNeverMatches, SelectorMayMatch };
63
64 SelectorPreMatch collectFeaturesFromRuleData(const RuleData&);
63 65
64 bool usesSiblingRules() const { return !siblingRules.isEmpty(); } 66 bool usesSiblingRules() const { return !siblingRules.isEmpty(); }
65 bool usesFirstLineRules() const { return m_metadata.usesFirstLineRules; } 67 bool usesFirstLineRules() const { return m_metadata.usesFirstLineRules; }
66 bool usesWindowInactiveSelector() const { return m_metadata.usesWindowInacti veSelector; } 68 bool usesWindowInactiveSelector() const { return m_metadata.usesWindowInacti veSelector; }
67 69
68 unsigned maxDirectAdjacentSelectors() const { return m_metadata.maxDirectAdj acentSelectors; } 70 unsigned maxDirectAdjacentSelectors() const { return m_metadata.maxDirectAdj acentSelectors; }
69 71
70 bool hasSelectorForAttribute(const AtomicString& attributeName) const 72 bool hasSelectorForAttribute(const AtomicString& attributeName) const
71 { 73 {
72 ASSERT(!attributeName.isEmpty()); 74 ASSERT(!attributeName.isEmpty());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void add(const FeatureMetadata& other); 113 void add(const FeatureMetadata& other);
112 void clear(); 114 void clear();
113 115
114 bool usesFirstLineRules = false; 116 bool usesFirstLineRules = false;
115 bool usesWindowInactiveSelector = false; 117 bool usesWindowInactiveSelector = false;
116 bool foundSiblingSelector = false; 118 bool foundSiblingSelector = false;
117 bool foundInsertionPointCrossing = false; 119 bool foundInsertionPointCrossing = false;
118 unsigned maxDirectAdjacentSelectors = 0; 120 unsigned maxDirectAdjacentSelectors = 0;
119 }; 121 };
120 122
121 void collectFeaturesFromSelector(const CSSSelector&, FeatureMetadata&); 123 SelectorPreMatch collectFeaturesFromSelector(const CSSSelector&, FeatureMeta data&);
122 124
123 InvalidationSet& ensureClassInvalidationSet(const AtomicString& className, I nvalidationType); 125 InvalidationSet& ensureClassInvalidationSet(const AtomicString& className, I nvalidationType);
124 InvalidationSet& ensureAttributeInvalidationSet(const AtomicString& attribut eName, InvalidationType); 126 InvalidationSet& ensureAttributeInvalidationSet(const AtomicString& attribut eName, InvalidationType);
125 InvalidationSet& ensureIdInvalidationSet(const AtomicString& id, Invalidatio nType); 127 InvalidationSet& ensureIdInvalidationSet(const AtomicString& id, Invalidatio nType);
126 InvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoType, Invali dationType); 128 InvalidationSet& ensurePseudoInvalidationSet(CSSSelector::PseudoType, Invali dationType);
127 129
128 void updateInvalidationSets(const RuleData&); 130 void updateInvalidationSets(const RuleData&);
129 void updateInvalidationSetsForContentAttribute(const RuleData&); 131 void updateInvalidationSetsForContentAttribute(const RuleData&);
130 132
131 struct InvalidationSetFeatures { 133 struct InvalidationSetFeatures {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 PseudoTypeInvalidationSetMap m_pseudoInvalidationSets; 166 PseudoTypeInvalidationSetMap m_pseudoInvalidationSets;
165 167
166 friend class RuleFeatureSetTest; 168 friend class RuleFeatureSetTest;
167 }; 169 };
168 170
169 } // namespace blink 171 } // namespace blink
170 172
171 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleFeature); 173 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleFeature);
172 174
173 #endif // RuleFeature_h 175 #endif // RuleFeature_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSelector.h ('k') | third_party/WebKit/Source/core/css/RuleFeature.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698