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

Unified Diff: Source/core/html/HTMLContentElement.cpp

Issue 279763002: Support a negation pseudo-class, :not(), in <content select> (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update Created 6 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/CSSSelector.cpp ('k') | Source/core/testing/InternalSettings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLContentElement.cpp
diff --git a/Source/core/html/HTMLContentElement.cpp b/Source/core/html/HTMLContentElement.cpp
index 5f56d5d13b1ef5c6500d1105a94d5791789e9ada..cc6a1aefcc89770d11157868a5627c7d2f17eaf8 100644
--- a/Source/core/html/HTMLContentElement.cpp
+++ b/Source/core/html/HTMLContentElement.cpp
@@ -83,6 +83,11 @@ void HTMLContentElement::parseAttribute(const QualifiedName& name, const AtomicS
}
}
+static inline bool includesDisallowedPseudoClass(const CSSSelector& selector)
+{
+ return selector.m_match == CSSSelector::PseudoClass && selector.m_pseudoType != CSSSelector::PseudoNot;
+}
+
bool HTMLContentElement::validateSelect() const
{
ASSERT(!m_shouldParseSelect);
@@ -93,15 +98,15 @@ bool HTMLContentElement::validateSelect() const
if (!m_selectorList.isValid())
return false;
- bool disallowPseudoClasses = !RuntimeEnabledFeatures::pseudoClassesInMatchingCriteriaInAuthorShadowTreesEnabled() && containingShadowRoot() && containingShadowRoot()->type() == ShadowRoot::AuthorShadowRoot;
+ bool allowAnyPseudoClasses = RuntimeEnabledFeatures::pseudoClassesInMatchingCriteriaInAuthorShadowTreesEnabled() || (containingShadowRoot() && containingShadowRoot()->type() == ShadowRoot::UserAgentShadowRoot);
for (const CSSSelector* selector = m_selectorList.first(); selector; selector = m_selectorList.next(*selector)) {
if (!selector->isCompound())
return false;
- if (!disallowPseudoClasses)
+ if (allowAnyPseudoClasses)
continue;
for (const CSSSelector* subSelector = selector; subSelector; subSelector = subSelector->tagHistory()) {
- if (subSelector->m_match == CSSSelector::PseudoClass)
+ if (includesDisallowedPseudoClass(*subSelector))
return false;
}
}
« no previous file with comments | « Source/core/css/CSSSelector.cpp ('k') | Source/core/testing/InternalSettings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698