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

Unified Diff: third_party/WebKit/Source/core/html/HTMLDocument.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 | « third_party/WebKit/Source/core/html/HTMLDocument.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLDocument.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLDocument.cpp b/third_party/WebKit/Source/core/html/HTMLDocument.cpp
index 1b81adc8e0a6b10cc278c98702eb7f9da89777c3..174b947d02c87ed09ec1bd8dde24a3bde4bd6e70 100644
--- a/third_party/WebKit/Source/core/html/HTMLDocument.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLDocument.cpp
@@ -197,4 +197,40 @@
removeItemFromMap(m_extraNamedItemCounts, name);
}
+static HashSet<StringImpl*>* createHtmlCaseInsensitiveAttributesSet()
+{
+ // This is the list of attributes in HTML 4.01 with values marked as "[CI]" or case-insensitive
+ // Mozilla treats all other values as case-sensitive, thus so do we.
+ 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;
+}
+
+bool HTMLDocument::isCaseSensitiveAttribute(const QualifiedName& attributeName)
+{
+ static HashSet<StringImpl*>* htmlCaseInsensitiveAttributesSet = createHtmlCaseInsensitiveAttributesSet();
+ bool isPossibleHTMLAttr = !attributeName.hasPrefix() && (attributeName.namespaceURI() == nullAtom);
+ return !isPossibleHTMLAttr || !htmlCaseInsensitiveAttributesSet->contains(attributeName.localName().impl());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLDocument.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698