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

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

Issue 1099963003: Support type selector for camel-cased SVG elements in HTML. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix performance regression. tagMatches() became too big to be inlined on Linux. 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
Index: Source/core/css/SelectorChecker.h
diff --git a/Source/core/css/SelectorChecker.h b/Source/core/css/SelectorChecker.h
index 563f00d6143fe2adc9b292d1499c418f203b72fb..9c12d8aa1a593049cae840ee5f1fcf5f353e5bad 100644
--- a/Source/core/css/SelectorChecker.h
+++ b/Source/core/css/SelectorChecker.h
@@ -106,11 +106,12 @@ public:
Mode mode() const { return m_mode; }
- static bool tagMatches(const Element&, const QualifiedName&);
+ static bool tagMatches(const Element&, const CSSSelector&);
static bool isCommonPseudoClassSelector(const CSSSelector&);
static bool matchesFocusPseudoClass(const Element&);
static bool matchesSpatialNavigationFocusPseudoClass(const Element&);
static bool matchesListBoxPseudoClass(const Element&);
+ static bool localNameMatchesLower(const AtomicString& elementName, const AtomicString& camelCasedType);
enum LinkMatchMask { MatchLink = 1, MatchVisited = 2, MatchAll = MatchLink | MatchVisited };
static unsigned determineLinkMatchType(const CSSSelector&);
@@ -151,13 +152,18 @@ inline bool SelectorChecker::isCommonPseudoClassSelector(const CSSSelector& sele
|| pseudoType == CSSSelector::PseudoFocus;
}
-inline bool SelectorChecker::tagMatches(const Element& element, const QualifiedName& tagQName)
+inline bool SelectorChecker::tagMatches(const Element& element, const CSSSelector& selector)
{
+ const QualifiedName& tagQName = selector.tagQName();
if (tagQName == anyQName())
return true;
const AtomicString& localName = tagQName.localName();
- if (localName != starAtom && localName != element.localName())
- return false;
+ if (localName != starAtom && localName != element.localName()) {
+ if (!selector.tagIsCamelCase())
+ return false;
+ if (!localNameMatchesLower(element.localName(), localName))
+ return false;
+ }
const AtomicString& namespaceURI = tagQName.namespaceURI();
return namespaceURI == starAtom || namespaceURI == element.namespaceURI();
}

Powered by Google App Engine
This is Rietveld 408576698