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

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

Issue 1099963003: Support type selector for camel-cased SVG elements in HTML. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed review issues. 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/css/ElementRuleCollector.cpp ('k') | Source/core/css/SelectorFilter.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 694c652130adfeac5356ee443095b01574122e4a..e63a36c9c38edf75eb21680c238192933b8d4240 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -99,8 +99,16 @@ 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;
+ if (localName != starAtom && localName != element.localName()) {
+ if (element.isHTMLElement() || !element.document().isHTMLDocument())
+ return false;
+ // Non-html elements in html documents are normalized to their camel-cased
+ // version during parsing if applicable. Yet, type selectors are lower-cased
+ // for selectors in html documents. Try a case-insensitive match below to
+ // allow type selector matching for such elements.
+ if (!equalIgnoringCase(localName, element.localName()))
+ return false;
+ }
const AtomicString& namespaceURI = tagQName.namespaceURI();
return namespaceURI == starAtom || namespaceURI == element.namespaceURI();
}
« no previous file with comments | « Source/core/css/ElementRuleCollector.cpp ('k') | Source/core/css/SelectorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698