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

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

Issue 2326493004: Revert of Move HTMLDocument::isCaseSensitiveAttribute into SelectorChecker (Closed)
Patch Set: Created 4 years, 3 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 | third_party/WebKit/Source/core/html/HTMLDocument.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/SelectorChecker.cpp
diff --git a/third_party/WebKit/Source/core/css/SelectorChecker.cpp b/third_party/WebKit/Source/core/css/SelectorChecker.cpp
index c85fc1ec1f5a9142ca0c7e7de10350f4bf413d39..fa6b7bb954278be35d95d5e62149a88f1cd3999d 100644
--- a/third_party/WebKit/Source/core/css/SelectorChecker.cpp
+++ b/third_party/WebKit/Source/core/css/SelectorChecker.cpp
@@ -497,42 +497,6 @@
}
}
-static HashSet<StringImpl*>* createHtmlCaseInsensitiveAttributesSet()
-{
- // This list of attributes is from
- // https://html.spec.whatwg.org/#case-sensitivity-of-selectors
- HashSet<StringImpl*>* attrSet = new HashSet<StringImpl*>;
-
- const QualifiedName* caseInsensitiveAttributes[] = {
- &accept_charsetAttr, &acceptAttr, &alignAttr, &alinkAttr, &axisAttr,
- &bgcolorAttr,
- &charsetAttr, &checkedAttr, &clearAttr, &codetypeAttr, &colorAttr, &compactAttr,
- &declareAttr, &deferAttr, &dirAttr, &directionAttr, &disabledAttr,
- &enctypeAttr,
- &faceAttr, &frameAttr,
- &hreflangAttr, &http_equivAttr,
- &langAttr, &languageAttr, &linkAttr,
- &mediaAttr, &methodAttr, &multipleAttr,
- &nohrefAttr, &noresizeAttr, &noshadeAttr, &nowrapAttr,
- &readonlyAttr, &relAttr, &revAttr, &rulesAttr,
- &scopeAttr, &scrollingAttr, &selectedAttr, &shapeAttr,
- &targetAttr, &textAttr, &typeAttr,
- &valignAttr, &valuetypeAttr, &vlinkAttr };
-
- attrSet->reserveCapacityForSize(WTF_ARRAY_LENGTH(caseInsensitiveAttributes));
- for (const QualifiedName* attr : caseInsensitiveAttributes)
- attrSet->add(attr->localName().impl());
-
- return attrSet;
-}
-
-static bool isHtmlCaseSensitiveAttribute(const QualifiedName& attributeName)
-{
- static HashSet<StringImpl*>* htmlCaseInsensitiveAttributesSet = createHtmlCaseInsensitiveAttributesSet();
- bool isPossibleHTMLAttr = !attributeName.hasPrefix() && (attributeName.namespaceURI() == nullAtom);
- return !isPossibleHTMLAttr || !htmlCaseInsensitiveAttributesSet->contains(attributeName.localName().impl());
-}
-
static bool anyAttributeMatches(Element& element, CSSSelector::MatchType match, const CSSSelector& selector)
{
const QualifiedName& selectorAttr = selector.attribute();
@@ -559,10 +523,10 @@
continue;
}
- // https://html.spec.whatwg.org/#case-sensitivity-of-selectors
- // TODO(foolip): The spec says "HTML element in an HTML document", but
- // this applies to any element in an HTML document.
- bool legacyCaseInsensitive = element.document().isHTMLDocument() && !isHtmlCaseSensitiveAttribute(selectorAttr);
+ // Legacy dictates that values of some attributes should be compared in
+ // a case-insensitive manner regardless of whether the case insensitive
+ // flag is set or not.
+ bool legacyCaseInsensitive = 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLDocument.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698