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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLDocument.cpp

Issue 2197953002: Remove unnecessary uses of HTMLDocument (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: simplify Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 * deleting the provisions above and replace them with the notice and 47 * deleting the provisions above and replace them with the notice and
48 * other provisions required by the MPL or the GPL, as the case may be. 48 * other provisions required by the MPL or the GPL, as the case may be.
49 * If you do not delete the provisions above, a recipient may use your 49 * If you do not delete the provisions above, a recipient may use your
50 * version of this file under any of the LGPL, the MPL or the GPL. 50 * version of this file under any of the LGPL, the MPL or the GPL.
51 */ 51 */
52 52
53 #include "core/html/HTMLDocument.h" 53 #include "core/html/HTMLDocument.h"
54 54
55 #include "bindings/core/v8/ScriptController.h" 55 #include "bindings/core/v8/ScriptController.h"
56 #include "core/HTMLNames.h" 56 #include "core/HTMLNames.h"
57 #include "core/frame/FrameView.h"
58 #include "core/frame/LocalDOMWindow.h"
59 #include "core/frame/LocalFrame.h" 57 #include "core/frame/LocalFrame.h"
60 #include "core/html/HTMLBodyElement.h" 58 #include "core/html/HTMLBodyElement.h"
61 #include "core/page/FocusController.h"
62 #include "core/page/FrameTree.h"
63 #include "core/page/Page.h"
64 #include "wtf/text/StringBuilder.h"
65 59
66 namespace blink { 60 namespace blink {
67 61
68 using namespace HTMLNames; 62 using namespace HTMLNames;
69 63
70 HTMLDocument::HTMLDocument(const DocumentInit& initializer, DocumentClassFlags e xtendedDocumentClasses) 64 HTMLDocument::HTMLDocument(const DocumentInit& initializer, DocumentClassFlags e xtendedDocumentClasses)
71 : Document(initializer, HTMLDocumentClass | extendedDocumentClasses) 65 : Document(initializer, HTMLDocumentClass | extendedDocumentClasses)
72 { 66 {
73 clearXMLVersion(); 67 clearXMLVersion();
74 if (isSrcdocDocument() || initializer.importsController()) { 68 if (isSrcdocDocument() || initializer.importsController()) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 { 196 {
203 removeItemFromMap(m_extraNamedItemCounts, name); 197 removeItemFromMap(m_extraNamedItemCounts, name);
204 } 198 }
205 199
206 static HashSet<StringImpl*>* createHtmlCaseInsensitiveAttributesSet() 200 static HashSet<StringImpl*>* createHtmlCaseInsensitiveAttributesSet()
207 { 201 {
208 // This is the list of attributes in HTML 4.01 with values marked as "[CI]" or case-insensitive 202 // This is the list of attributes in HTML 4.01 with values marked as "[CI]" or case-insensitive
209 // Mozilla treats all other values as case-sensitive, thus so do we. 203 // Mozilla treats all other values as case-sensitive, thus so do we.
210 HashSet<StringImpl*>* attrSet = new HashSet<StringImpl*>; 204 HashSet<StringImpl*>* attrSet = new HashSet<StringImpl*>;
211 205
212 const QualifiedName* caseInsesitiveAttributes[] = { 206 const QualifiedName* caseInsensitiveAttributes[] = {
213 &accept_charsetAttr, &acceptAttr, &alignAttr, &alinkAttr, &axisAttr, 207 &accept_charsetAttr, &acceptAttr, &alignAttr, &alinkAttr, &axisAttr,
214 &bgcolorAttr, 208 &bgcolorAttr,
215 &charsetAttr, &checkedAttr, &clearAttr, &codetypeAttr, &colorAttr, &comp actAttr, 209 &charsetAttr, &checkedAttr, &clearAttr, &codetypeAttr, &colorAttr, &comp actAttr,
216 &declareAttr, &deferAttr, &dirAttr, &directionAttr, &disabledAttr, 210 &declareAttr, &deferAttr, &dirAttr, &directionAttr, &disabledAttr,
217 &enctypeAttr, 211 &enctypeAttr,
218 &faceAttr, &frameAttr, 212 &faceAttr, &frameAttr,
219 &hreflangAttr, &http_equivAttr, 213 &hreflangAttr, &http_equivAttr,
220 &langAttr, &languageAttr, &linkAttr, 214 &langAttr, &languageAttr, &linkAttr,
221 &mediaAttr, &methodAttr, &multipleAttr, 215 &mediaAttr, &methodAttr, &multipleAttr,
222 &nohrefAttr, &noresizeAttr, &noshadeAttr, &nowrapAttr, 216 &nohrefAttr, &noresizeAttr, &noshadeAttr, &nowrapAttr,
223 &readonlyAttr, &relAttr, &revAttr, &rulesAttr, 217 &readonlyAttr, &relAttr, &revAttr, &rulesAttr,
224 &scopeAttr, &scrollingAttr, &selectedAttr, &shapeAttr, 218 &scopeAttr, &scrollingAttr, &selectedAttr, &shapeAttr,
225 &targetAttr, &textAttr, &typeAttr, 219 &targetAttr, &textAttr, &typeAttr,
226 &valignAttr, &valuetypeAttr, &vlinkAttr }; 220 &valignAttr, &valuetypeAttr, &vlinkAttr };
227 221
228 attrSet->reserveCapacityForSize(WTF_ARRAY_LENGTH(caseInsesitiveAttributes)); 222 attrSet->reserveCapacityForSize(WTF_ARRAY_LENGTH(caseInsensitiveAttributes)) ;
229 for (const QualifiedName* attr : caseInsesitiveAttributes) 223 for (const QualifiedName* attr : caseInsensitiveAttributes)
230 attrSet->add(attr->localName().impl()); 224 attrSet->add(attr->localName().impl());
231 225
232 return attrSet; 226 return attrSet;
233 } 227 }
234 228
235 bool HTMLDocument::isCaseSensitiveAttribute(const QualifiedName& attributeName) 229 bool HTMLDocument::isCaseSensitiveAttribute(const QualifiedName& attributeName)
236 { 230 {
237 static HashSet<StringImpl*>* htmlCaseInsensitiveAttributesSet = createHtmlCa seInsensitiveAttributesSet(); 231 static HashSet<StringImpl*>* htmlCaseInsensitiveAttributesSet = createHtmlCa seInsensitiveAttributesSet();
238 bool isPossibleHTMLAttr = !attributeName.hasPrefix() && (attributeName.names paceURI() == nullAtom); 232 bool isPossibleHTMLAttr = !attributeName.hasPrefix() && (attributeName.names paceURI() == nullAtom);
239 return !isPossibleHTMLAttr || !htmlCaseInsensitiveAttributesSet->contains(at tributeName.localName().impl()); 233 return !isPossibleHTMLAttr || !htmlCaseInsensitiveAttributesSet->contains(at tributeName.localName().impl());
240 } 234 }
241 235
242 } // namespace blink 236 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698