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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp

Issue 2014153002: Implement the use counter for :defined pseudo-class selector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/parser/CSSSelectorParser.h" 5 #include "core/css/parser/CSSSelectorParser.h"
6 6
7 #include "core/css/CSSSelectorList.h" 7 #include "core/css/CSSSelectorList.h"
8 #include "core/css/StyleSheetContents.h" 8 #include "core/css/StyleSheetContents.h"
9 #include "core/frame/UseCounter.h" 9 #include "core/frame/UseCounter.h"
10 #include "platform/RuntimeEnabledFeatures.h" 10 #include "platform/RuntimeEnabledFeatures.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 static void recordSelectorStats(const CSSParserContext& context, const CSSSelect orList& selectorList) 14 static void recordSelectorStats(const CSSParserContext& context, const CSSSelect orList& selectorList)
15 { 15 {
16 if (!context.useCounter()) 16 if (!context.useCounter())
17 return; 17 return;
18 18
19 for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(*selector)) { 19 for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(*selector)) {
20 for (const CSSSelector* current = selector; current ; current = current- >tagHistory()) { 20 for (const CSSSelector* current = selector; current ; current = current- >tagHistory()) {
21 UseCounter::Feature feature = UseCounter::NumberOfFeatures; 21 UseCounter::Feature feature = UseCounter::NumberOfFeatures;
22 switch (current->getPseudoType()) { 22 switch (current->getPseudoType()) {
23 case CSSSelector::PseudoAny: 23 case CSSSelector::PseudoAny:
24 feature = UseCounter::CSSSelectorPseudoAny; 24 feature = UseCounter::CSSSelectorPseudoAny;
25 break; 25 break;
26 case CSSSelector::PseudoUnresolved: 26 case CSSSelector::PseudoUnresolved:
27 feature = UseCounter::CSSSelectorPseudoUnresolved; 27 feature = UseCounter::CSSSelectorPseudoUnresolved;
28 break; 28 break;
29 case CSSSelector::PseudoDefined:
30 feature = UseCounter::CSSSelectorPseudoDefined;
31 break;
29 case CSSSelector::PseudoSlotted: 32 case CSSSelector::PseudoSlotted:
30 feature = UseCounter::CSSSelectorPseudoSlotted; 33 feature = UseCounter::CSSSelectorPseudoSlotted;
31 break; 34 break;
32 case CSSSelector::PseudoContent: 35 case CSSSelector::PseudoContent:
33 feature = UseCounter::CSSSelectorPseudoContent; 36 feature = UseCounter::CSSSelectorPseudoContent;
34 break; 37 break;
35 case CSSSelector::PseudoHost: 38 case CSSSelector::PseudoHost:
36 feature = UseCounter::CSSSelectorPseudoHost; 39 feature = UseCounter::CSSSelectorPseudoHost;
37 break; 40 break;
38 case CSSSelector::PseudoHostContext: 41 case CSSSelector::PseudoHostContext:
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 795
793 if (!splitAfter || !splitAfter->tagHistory()) 796 if (!splitAfter || !splitAfter->tagHistory())
794 return compoundSelector; 797 return compoundSelector;
795 798
796 OwnPtr<CSSParserSelector> secondCompound = splitAfter->releaseTagHistory(); 799 OwnPtr<CSSParserSelector> secondCompound = splitAfter->releaseTagHistory();
797 secondCompound->appendTagHistory(secondCompound->pseudoType() == CSSSelector ::PseudoSlotted ? CSSSelector::ShadowSlot : CSSSelector::ShadowPseudo, std::move (compoundSelector)); 800 secondCompound->appendTagHistory(secondCompound->pseudoType() == CSSSelector ::PseudoSlotted ? CSSSelector::ShadowSlot : CSSSelector::ShadowPseudo, std::move (compoundSelector));
798 return secondCompound; 801 return secondCompound;
799 } 802 }
800 803
801 } // namespace blink 804 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698