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

Unified Diff: Source/core/css/parser/CSSSelectorParser.cpp

Issue 1139823009: Move recordSelectorStats out of CSSSelectorParser API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/parser/CSSSelectorParser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/CSSSelectorParser.cpp
diff --git a/Source/core/css/parser/CSSSelectorParser.cpp b/Source/core/css/parser/CSSSelectorParser.cpp
index 6b50c6e82d7a0b40d70743a3dd3621e51862e33e..7bd33e73ef03f3e242e0b91588e903745fcb3c64 100644
--- a/Source/core/css/parser/CSSSelectorParser.cpp
+++ b/Source/core/css/parser/CSSSelectorParser.cpp
@@ -12,6 +12,52 @@
namespace blink {
+static void recordSelectorStats(const CSSParserContext& context, const CSSSelectorList& selectorList)
+{
+ if (!context.useCounter())
+ return;
+
+ for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(*selector)) {
+ for (const CSSSelector* current = selector; current ; current = current->tagHistory()) {
+ UseCounter::Feature feature = UseCounter::NumberOfFeatures;
+ switch (current->pseudoType()) {
+ case CSSSelector::PseudoUnresolved:
+ feature = UseCounter::CSSSelectorPseudoUnresolved;
+ break;
+ case CSSSelector::PseudoShadow:
+ feature = UseCounter::CSSSelectorPseudoShadow;
+ break;
+ case CSSSelector::PseudoContent:
+ feature = UseCounter::CSSSelectorPseudoContent;
+ break;
+ case CSSSelector::PseudoHost:
+ feature = UseCounter::CSSSelectorPseudoHost;
+ break;
+ case CSSSelector::PseudoHostContext:
+ feature = UseCounter::CSSSelectorPseudoHostContext;
+ break;
+ case CSSSelector::PseudoFullScreenDocument:
+ feature = UseCounter::CSSSelectorPseudoFullScreenDocument;
+ break;
+ case CSSSelector::PseudoFullScreenAncestor:
+ feature = UseCounter::CSSSelectorPseudoFullScreenAncestor;
+ break;
+ case CSSSelector::PseudoFullScreen:
+ feature = UseCounter::CSSSelectorPseudoFullScreen;
+ break;
+ default:
+ break;
+ }
+ if (feature != UseCounter::NumberOfFeatures)
+ context.useCounter()->count(feature);
+ if (current->relation() == CSSSelector::ShadowDeep)
+ context.useCounter()->count(UseCounter::CSSDeepCombinator);
+ if (current->selectorList())
+ recordSelectorStats(context, *current->selectorList());
+ }
+ }
+}
+
void CSSSelectorParser::parseSelector(CSSParserTokenRange range, const CSSParserContext& context, const AtomicString& defaultNamespace, StyleSheetContents* styleSheet, CSSSelectorList& output)
{
CSSSelectorParser parser(context, defaultNamespace, styleSheet);
@@ -638,50 +684,4 @@ PassOwnPtr<CSSParserSelector> CSSSelectorParser::addSimpleSelectorToCompound(Pas
return compoundSelector;
}
-void CSSSelectorParser::recordSelectorStats(const CSSParserContext& context, const CSSSelectorList& selectorList)
-{
- if (!context.useCounter())
- return;
-
- for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(*selector)) {
- for (const CSSSelector* current = selector; current ; current = current->tagHistory()) {
- UseCounter::Feature feature = UseCounter::NumberOfFeatures;
- switch (current->pseudoType()) {
- case CSSSelector::PseudoUnresolved:
- feature = UseCounter::CSSSelectorPseudoUnresolved;
- break;
- case CSSSelector::PseudoShadow:
- feature = UseCounter::CSSSelectorPseudoShadow;
- break;
- case CSSSelector::PseudoContent:
- feature = UseCounter::CSSSelectorPseudoContent;
- break;
- case CSSSelector::PseudoHost:
- feature = UseCounter::CSSSelectorPseudoHost;
- break;
- case CSSSelector::PseudoHostContext:
- feature = UseCounter::CSSSelectorPseudoHostContext;
- break;
- case CSSSelector::PseudoFullScreenDocument:
- feature = UseCounter::CSSSelectorPseudoFullScreenDocument;
- break;
- case CSSSelector::PseudoFullScreenAncestor:
- feature = UseCounter::CSSSelectorPseudoFullScreenAncestor;
- break;
- case CSSSelector::PseudoFullScreen:
- feature = UseCounter::CSSSelectorPseudoFullScreen;
- break;
- default:
- break;
- }
- if (feature != UseCounter::NumberOfFeatures)
- context.useCounter()->count(feature);
- if (current->relation() == CSSSelector::ShadowDeep)
- context.useCounter()->count(UseCounter::CSSDeepCombinator);
- if (current->selectorList())
- recordSelectorStats(context, *current->selectorList());
- }
- }
-}
-
} // namespace blink
« no previous file with comments | « Source/core/css/parser/CSSSelectorParser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698