| Index: Source/core/css/CSSSelector.cpp
|
| diff --git a/Source/core/css/CSSSelector.cpp b/Source/core/css/CSSSelector.cpp
|
| index c32ec173cd4d4c935ed17105c67027340fded3d0..c3ac0221afb394407d4c4ea972eb28e2f07af932 100644
|
| --- a/Source/core/css/CSSSelector.cpp
|
| +++ b/Source/core/css/CSSSelector.cpp
|
| @@ -337,6 +337,7 @@ static HashMap<StringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap()
|
| DEFINE_STATIC_LOCAL(AtomicString, outOfRange, ("out-of-range", AtomicString::ConstructFromLiteral));
|
| DEFINE_STATIC_LOCAL(AtomicString, scope, ("scope", AtomicString::ConstructFromLiteral));
|
| DEFINE_STATIC_LOCAL(AtomicString, unresolved, ("unresolved", AtomicString::ConstructFromLiteral));
|
| + DEFINE_STATIC_LOCAL(AtomicString, content, ("content", AtomicString::ConstructFromLiteral));
|
|
|
| static HashMap<StringImpl*, CSSSelector::PseudoType>* nameToPseudoType = 0;
|
| if (!nameToPseudoType) {
|
| @@ -418,6 +419,8 @@ static HashMap<StringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap()
|
| nameToPseudoType->set(outOfRange.impl(), CSSSelector::PseudoOutOfRange);
|
| if (RuntimeEnabledFeatures::customDOMElementsEnabled())
|
| nameToPseudoType->set(unresolved.impl(), CSSSelector::PseudoUnresolved);
|
| + if (RuntimeEnabledFeatures::shadowDOMEnabled())
|
| + nameToPseudoType->set(content.impl(), CSSSelector::PseudoContent);
|
| }
|
| return nameToPseudoType;
|
| }
|
| @@ -470,6 +473,7 @@ void CSSSelector::extractPseudoType() const
|
| case PseudoSelection:
|
| case PseudoUserAgentCustomElement:
|
| case PseudoWebKitCustomElement:
|
| + case PseudoContent:
|
| element = true;
|
| break;
|
| case PseudoUnknown:
|
| @@ -637,6 +641,8 @@ String CSSSelector::selectorText(const String& rightSide) const
|
| } else if (cs->m_match == CSSSelector::PseudoElement) {
|
| str.appendLiteral("::");
|
| str.append(cs->value());
|
| + if (cs->pseudoType() == CSSSelector::PseudoContent && cs->relation() == CSSSelector::SubSelector && cs->tagHistory())
|
| + return cs->tagHistory()->selectorText() + str.toString() + rightSide;
|
| } else if (cs->isAttributeSelector()) {
|
| str.append('[');
|
| const AtomicString& prefix = cs->attribute().prefix();
|
| @@ -684,11 +690,11 @@ String CSSSelector::selectorText(const String& rightSide) const
|
| if (const CSSSelector* tagHistory = cs->tagHistory()) {
|
| switch (cs->relation()) {
|
| case CSSSelector::Descendant:
|
| - if (cs->relationIsForShadowDistributed())
|
| + if (cs->relationIsForShadowDistributed() && tagHistory->pseudoType() != CSSSelector::PseudoContent)
|
| return tagHistory->selectorText("::-webkit-distributed(" + str.toString() + rightSide + ")");
|
| return tagHistory->selectorText(" " + str.toString() + rightSide);
|
| case CSSSelector::Child:
|
| - if (cs->relationIsForShadowDistributed())
|
| + if (cs->relationIsForShadowDistributed() && tagHistory->pseudoType() != CSSSelector::PseudoContent)
|
| return tagHistory->selectorText("::-webkit-distributed(> " + str.toString() + rightSide + ")");
|
| return tagHistory->selectorText(" > " + str.toString() + rightSide);
|
| case CSSSelector::DirectAdjacent:
|
|
|