OLD | NEW |
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 Loading... |
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 |
OLD | NEW |