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

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

Issue 330043003: Add support for case-insensitive attribute value selectors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make union w/ m_attributeFlags and nth-state; Return enum type. Created 6 years, 6 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/CSSSelector.cpp ('k') | Source/core/css/parser/BisonCSSParser.h » ('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 3e205e96ac78575f4084fffac61a2f1747ebd2be..2f71c6982fc16f8668fb346c96a273313722559c 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -498,7 +498,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;
AttributeIteratorAccessor attributes = element.attributesIterator();
AttributeConstIterator end = attributes.end();
@@ -508,9 +509,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);
Timothy Loh 2014/07/22 08:51:02 This is super confusing (we have a caseSensitive a
fs 2014/07/22 11:06:17 I suppose we could make the new (currently |caseIn
Timothy Loh 2014/07/22 11:50:26 If I'm reading crbug.com/327060 right, the existin
fs 2014/07/22 14:09:04 Thank you for elaborating. I've updated to somethi
Timothy Loh 2014/07/23 01:46:50 I think |legacyCaseInsensitive| (instead of |legac
« no previous file with comments | « Source/core/css/CSSSelector.cpp ('k') | Source/core/css/parser/BisonCSSParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698