OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 void HTMLDocument::addExtraNamedItem(const AtomicString& name) | 190 void HTMLDocument::addExtraNamedItem(const AtomicString& name) |
191 { | 191 { |
192 addItemToMap(m_extraNamedItemCounts, name); | 192 addItemToMap(m_extraNamedItemCounts, name); |
193 } | 193 } |
194 | 194 |
195 void HTMLDocument::removeExtraNamedItem(const AtomicString& name) | 195 void HTMLDocument::removeExtraNamedItem(const AtomicString& name) |
196 { | 196 { |
197 removeItemFromMap(m_extraNamedItemCounts, name); | 197 removeItemFromMap(m_extraNamedItemCounts, name); |
198 } | 198 } |
199 | 199 |
200 static HashSet<StringImpl*>* createHtmlCaseInsensitiveAttributesSet() | |
201 { | |
202 // This is the list of attributes in HTML 4.01 with values marked as "[CI]"
or case-insensitive | |
203 // Mozilla treats all other values as case-sensitive, thus so do we. | |
204 HashSet<StringImpl*>* attrSet = new HashSet<StringImpl*>; | |
205 | |
206 const QualifiedName* caseInsensitiveAttributes[] = { | |
207 &accept_charsetAttr, &acceptAttr, &alignAttr, &alinkAttr, &axisAttr, | |
208 &bgcolorAttr, | |
209 &charsetAttr, &checkedAttr, &clearAttr, &codetypeAttr, &colorAttr, &comp
actAttr, | |
210 &declareAttr, &deferAttr, &dirAttr, &directionAttr, &disabledAttr, | |
211 &enctypeAttr, | |
212 &faceAttr, &frameAttr, | |
213 &hreflangAttr, &http_equivAttr, | |
214 &langAttr, &languageAttr, &linkAttr, | |
215 &mediaAttr, &methodAttr, &multipleAttr, | |
216 &nohrefAttr, &noresizeAttr, &noshadeAttr, &nowrapAttr, | |
217 &readonlyAttr, &relAttr, &revAttr, &rulesAttr, | |
218 &scopeAttr, &scrollingAttr, &selectedAttr, &shapeAttr, | |
219 &targetAttr, &textAttr, &typeAttr, | |
220 &valignAttr, &valuetypeAttr, &vlinkAttr }; | |
221 | |
222 attrSet->reserveCapacityForSize(WTF_ARRAY_LENGTH(caseInsensitiveAttributes))
; | |
223 for (const QualifiedName* attr : caseInsensitiveAttributes) | |
224 attrSet->add(attr->localName().impl()); | |
225 | |
226 return attrSet; | |
227 } | |
228 | |
229 bool HTMLDocument::isCaseSensitiveAttribute(const QualifiedName& attributeName) | |
230 { | |
231 static HashSet<StringImpl*>* htmlCaseInsensitiveAttributesSet = createHtmlCa
seInsensitiveAttributesSet(); | |
232 bool isPossibleHTMLAttr = !attributeName.hasPrefix() && (attributeName.names
paceURI() == nullAtom); | |
233 return !isPossibleHTMLAttr || !htmlCaseInsensitiveAttributesSet->contains(at
tributeName.localName().impl()); | |
234 } | |
235 | |
236 } // namespace blink | 200 } // namespace blink |
OLD | NEW |