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

Unified Diff: Source/core/css/SelectorChecker.cpp

Issue 1108993006: Make SelectorChecker::tagMatches internal to the SelectorChecker (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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/SelectorChecker.h ('k') | Source/core/dom/SelectorQuery.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/SelectorChecker.cpp
diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp
index 659010b9de47867b734d324d7829537655e3a116..174a87e7204eef98fe325845825e74312064d834 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -94,6 +94,17 @@ static bool matchesListBoxPseudoClass(const Element& element)
return isHTMLSelectElement(element) && !toHTMLSelectElement(element).usesMenuList();
}
+static bool matchesTagName(const Element& element, const QualifiedName& tagQName)
+{
+ if (tagQName == anyQName())
+ return true;
+ const AtomicString& localName = tagQName.localName();
+ if (localName != starAtom && localName != element.localName())
+ return false;
+ const AtomicString& namespaceURI = tagQName.namespaceURI();
+ return namespaceURI == starAtom || namespaceURI == element.namespaceURI();
+}
+
static Element* parentElement(const SelectorChecker::SelectorCheckingContext& context)
{
// - If context.scope is a shadow root, we should walk up to its shadow host.
@@ -563,7 +574,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
switch (selector.match()) {
case CSSSelector::Tag:
- return SelectorChecker::tagMatches(element, selector.tagQName());
+ return matchesTagName(element, selector.tagQName());
case CSSSelector::Class:
return element.hasClass() && element.classNames().contains(selector.value());
case CSSSelector::Id:
« no previous file with comments | « Source/core/css/SelectorChecker.h ('k') | Source/core/dom/SelectorQuery.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698