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

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

Issue 252683011: Add support for case-insensitive attribute value selectors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add runtime flag; fix selector serializing 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
Index: Source/core/css/SelectorChecker.cpp
diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp
index 8b93541c6efe4271a0b2cf596eb93420072e5499..e8fe8ab23b706651069df9e72648caa5a1b152ba 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -482,7 +482,8 @@ static bool anyAttributeMatches(Element& element, CSSSelector::Match match, cons
if (!element.hasAttributesWithoutUpdate())
return false;
- const AtomicString& selectorValue = selector.value();
+ const AtomicString& selectorValue = selector.value();
+ bool caseInsensitive = selector.attributeFlags() & CSSSelector::CaseInsensitive;
unsigned attributeCount = element.attributeCount();
for (size_t i = 0; i < attributeCount; ++i) {
@@ -491,9 +492,12 @@ static bool anyAttributeMatches(Element& element, CSSSelector::Match match, cons
if (!attributeItem.matches(selectorAttr))
continue;
- if (attributeValueMatches(attributeItem, match, selectorValue, true))
+ if (attributeValueMatches(attributeItem, match, selectorValue, !caseInsensitive))
return true;
+ if (caseInsensitive)
+ continue;
+
// Case sensitivity for attribute matching is looser than hasAttribute or
// Element::shouldIgnoreAttributeCase() for now. Unclear if that's correct.
bool caseSensitive = !element.document().isHTMLDocument() || HTMLDocument::isCaseSensitiveAttribute(selectorAttr);

Powered by Google App Engine
This is Rietveld 408576698