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

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

Issue 140323003: Add UseCounter for case-insensitive attribute value selector matching (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 6 years, 11 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 | « no previous file | Source/core/frame/UseCounter.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 f7c459d99a1c1cfecd840af38bb8e6f8262549fc..182b3dafa14938cd338537de44a040717b4b2850 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -437,9 +437,6 @@ static bool anyAttributeMatches(Element& element, CSSSelector::Match match, cons
return false;
const AtomicString& selectorValue = selector.value();
- // 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);
for (size_t i = 0; i < element.attributeCount(); ++i) {
const Attribute* attributeItem = element.attributeItem(i);
@@ -447,8 +444,19 @@ static bool anyAttributeMatches(Element& element, CSSSelector::Match match, cons
if (!attributeItem->matches(selectorAttr))
continue;
- if (attributeValueMatches(attributeItem, match, selectorValue, caseSensitive))
+ if (attributeValueMatches(attributeItem, match, selectorValue, true))
return true;
+
+ // 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);
+
+ // If case-insensitive, re-check, and count if result differs.
+ // See http://code.google.com/p/chromium/issues/detail?id=327060
+ if (!caseSensitive && attributeValueMatches(attributeItem, match, selectorValue, false)) {
+ UseCounter::count(element.document(), UseCounter::CaseInsensitiveAttrSelectorMatch);
+ return true;
+ }
}
return false;
« no previous file with comments | « no previous file | Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698