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

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

Issue 1129673002: Remove support for pseudo classes in <content select>. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix more tests. Created 5 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/html/HTMLContentElement.h ('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 a4f7c9f57abebd5fd3f32f685c978a736d0dbfb8..81fcd3360c0683e4e8c07e8bbc339f40f914695b 100644
--- a/Source/core/html/HTMLContentElement.cpp
+++ b/Source/core/html/HTMLContentElement.cpp
@@ -29,7 +29,6 @@
#include "core/HTMLNames.h"
#include "core/css/SelectorChecker.h"
-#include "core/css/SiblingTraversalStrategies.h"
#include "core/css/parser/CSSParser.h"
#include "core/dom/QualifiedName.h"
#include "core/dom/shadow/ElementShadow.h"
@@ -101,13 +100,9 @@ bool HTMLContentElement::validateSelect() const
if (!m_selectorList.isValid())
return false;
- 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 (allowAnyPseudoClasses)
- continue;
for (const CSSSelector* subSelector = selector; subSelector; subSelector = subSelector->tagHistory()) {
if (includesDisallowedPseudoClass(*subSelector))
return false;
@@ -116,19 +111,15 @@ bool HTMLContentElement::validateSelect() const
return true;
}
-static inline bool checkOneSelector(const CSSSelector& selector, const WillBeHeapVector<RawPtrWillBeMember<Node>, 32>& siblings, int nth)
+// TODO(esprehn): element should really be const, but matching a selector is not
+// const for some SelectorCheckingModes (mainly ResolvingStyle) where it sets
+// dynamic restyle flags on elements.
+bool HTMLContentElement::matchSelector(Element& element) const
{
- Element* element = toElement(siblings[nth]);
SelectorChecker selectorChecker(SelectorChecker::QueryingRules);
- SelectorChecker::SelectorCheckingContext context(selector, element, SelectorChecker::VisitedMatchEnabled);
- ShadowDOMSiblingTraversalStrategy strategy(siblings, nth);
- return selectorChecker.match(context, strategy) == SelectorChecker::SelectorMatches;
-}
-
-bool HTMLContentElement::matchSelector(const WillBeHeapVector<RawPtrWillBeMember<Node>, 32>& siblings, int nth) const
-{
for (const CSSSelector* selector = selectorList().first(); selector; selector = CSSSelectorList::next(*selector)) {
- if (checkOneSelector(*selector, siblings, nth))
+ SelectorChecker::SelectorCheckingContext context(*selector, &element, SelectorChecker::VisitedMatchDisabled);
esprehn 2015/05/06 23:57:52 I also switched this to VisitedMatchDisabled. Sinc
+ if (selectorChecker.match(context) == SelectorChecker::SelectorMatches)
return true;
}
return false;
« no previous file with comments | « Source/core/html/HTMLContentElement.h ('k') | Source/core/testing/InternalSettings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698