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" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 return isUserActionPseudoClass(pseudoClass); | 251 return isUserActionPseudoClass(pseudoClass); |
252 default: | 252 default: |
253 return false; | 253 return false; |
254 } | 254 } |
255 } | 255 } |
256 | 256 |
257 bool isSimpleSelectorValidAfterPseudoElement(const CSSParserSelector& simpleSele
ctor, CSSSelector::PseudoType compoundPseudoElement) | 257 bool isSimpleSelectorValidAfterPseudoElement(const CSSParserSelector& simpleSele
ctor, CSSSelector::PseudoType compoundPseudoElement) |
258 { | 258 { |
259 if (compoundPseudoElement == CSSSelector::PseudoUnknown) | 259 if (compoundPseudoElement == CSSSelector::PseudoUnknown) |
260 return true; | 260 return true; |
| 261 if (compoundPseudoElement == CSSSelector::PseudoContent) |
| 262 return simpleSelector.match() != CSSSelector::PseudoElement; |
261 if (simpleSelector.match() != CSSSelector::PseudoClass) | 263 if (simpleSelector.match() != CSSSelector::PseudoClass) |
262 return false; | 264 return false; |
263 CSSSelector::PseudoType pseudo = simpleSelector.pseudoType(); | 265 CSSSelector::PseudoType pseudo = simpleSelector.pseudoType(); |
264 if (pseudo == CSSSelector::PseudoNot) { | 266 if (pseudo == CSSSelector::PseudoNot) { |
265 ASSERT(simpleSelector.selectorList()); | 267 ASSERT(simpleSelector.selectorList()); |
266 ASSERT(simpleSelector.selectorList()->first()); | 268 ASSERT(simpleSelector.selectorList()->first()); |
267 ASSERT(!simpleSelector.selectorList()->first()->tagHistory()); | 269 ASSERT(!simpleSelector.selectorList()->first()->tagHistory()); |
268 pseudo = simpleSelector.selectorList()->first()->getPseudoType(); | 270 pseudo = simpleSelector.selectorList()->first()->getPseudoType(); |
269 } | 271 } |
270 return isPseudoClassValidAfterPseudoElement(pseudo, compoundPseudoElement); | 272 return isPseudoClassValidAfterPseudoElement(pseudo, compoundPseudoElement); |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 | 783 |
782 if (!splitAfter || !splitAfter->tagHistory()) | 784 if (!splitAfter || !splitAfter->tagHistory()) |
783 return compoundSelector; | 785 return compoundSelector; |
784 | 786 |
785 OwnPtr<CSSParserSelector> secondCompound = splitAfter->releaseTagHistory(); | 787 OwnPtr<CSSParserSelector> secondCompound = splitAfter->releaseTagHistory(); |
786 secondCompound->appendTagHistory(secondCompound->pseudoType() == CSSSelector
::PseudoSlotted ? CSSSelector::ShadowSlot : CSSSelector::ShadowPseudo, compoundS
elector); | 788 secondCompound->appendTagHistory(secondCompound->pseudoType() == CSSSelector
::PseudoSlotted ? CSSSelector::ShadowSlot : CSSSelector::ShadowPseudo, compoundS
elector); |
787 return secondCompound.release(); | 789 return secondCompound.release(); |
788 } | 790 } |
789 | 791 |
790 } // namespace blink | 792 } // namespace blink |
OLD | NEW |