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

Side by Side Diff: Source/core/dom/DOMImplementation.cpp

Issue 366883003: Make DOMImplementation.createHTMLDocument implementation more spec aligned (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « LayoutTests/fast/dom/implementation-createHTMLDocument-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) 6 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org)
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 18 matching lines...) Expand all
29 #include "core/HTMLNames.h" 29 #include "core/HTMLNames.h"
30 #include "core/SVGNames.h" 30 #include "core/SVGNames.h"
31 #include "core/css/CSSStyleSheet.h" 31 #include "core/css/CSSStyleSheet.h"
32 #include "core/css/MediaList.h" 32 #include "core/css/MediaList.h"
33 #include "core/css/StyleSheetContents.h" 33 #include "core/css/StyleSheetContents.h"
34 #include "core/dom/ContextFeatures.h" 34 #include "core/dom/ContextFeatures.h"
35 #include "core/dom/DocumentInit.h" 35 #include "core/dom/DocumentInit.h"
36 #include "core/dom/DocumentType.h" 36 #include "core/dom/DocumentType.h"
37 #include "core/dom/Element.h" 37 #include "core/dom/Element.h"
38 #include "core/dom/ExceptionCode.h" 38 #include "core/dom/ExceptionCode.h"
39 #include "core/dom/Text.h"
39 #include "core/dom/XMLDocument.h" 40 #include "core/dom/XMLDocument.h"
40 #include "core/dom/custom/CustomElementRegistrationContext.h" 41 #include "core/dom/custom/CustomElementRegistrationContext.h"
41 #include "core/frame/LocalFrame.h" 42 #include "core/frame/LocalFrame.h"
42 #include "core/frame/UseCounter.h" 43 #include "core/frame/UseCounter.h"
43 #include "core/html/HTMLDocument.h" 44 #include "core/html/HTMLDocument.h"
45 #include "core/html/HTMLHeadElement.h"
44 #include "core/html/HTMLMediaElement.h" 46 #include "core/html/HTMLMediaElement.h"
47 #include "core/html/HTMLTitleElement.h"
45 #include "core/html/HTMLViewSourceDocument.h" 48 #include "core/html/HTMLViewSourceDocument.h"
46 #include "core/html/ImageDocument.h" 49 #include "core/html/ImageDocument.h"
47 #include "core/html/MediaDocument.h" 50 #include "core/html/MediaDocument.h"
48 #include "core/html/PluginDocument.h" 51 #include "core/html/PluginDocument.h"
49 #include "core/html/TextDocument.h" 52 #include "core/html/TextDocument.h"
50 #include "core/loader/FrameLoader.h" 53 #include "core/loader/FrameLoader.h"
51 #include "core/page/Page.h" 54 #include "core/page/Page.h"
52 #include "platform/ContentType.h" 55 #include "platform/ContentType.h"
53 #include "platform/MIMETypeRegistry.h" 56 #include "platform/MIMETypeRegistry.h"
54 #include "platform/graphics/Image.h" 57 #include "platform/graphics/Image.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 return MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType) || isJSONMI METype(mimeType) || isTextPlainType(mimeType); 321 return MIMETypeRegistry::isSupportedJavaScriptMIMEType(mimeType) || isJSONMI METype(mimeType) || isTextPlainType(mimeType);
319 } 322 }
320 323
321 PassRefPtrWillBeRawPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const String& title) 324 PassRefPtrWillBeRawPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const String& title)
322 { 325 {
323 DocumentInit init = DocumentInit::fromContext(document().contextDocument()) 326 DocumentInit init = DocumentInit::fromContext(document().contextDocument())
324 .withRegistrationContext(document().registrationContext()); 327 .withRegistrationContext(document().registrationContext());
325 RefPtrWillBeRawPtr<HTMLDocument> d = HTMLDocument::create(init); 328 RefPtrWillBeRawPtr<HTMLDocument> d = HTMLDocument::create(init);
326 d->open(); 329 d->open();
327 d->write("<!doctype html><html><body></body></html>"); 330 d->write("<!doctype html><html><body></body></html>");
328 if (!title.isNull()) 331 if (!title.isNull()) {
haraken 2014/07/02 08:02:29 'if(title)' would be enough.
kangil_ 2014/07/02 08:23:12 This change will give compile error like: ‘WTF::St
329 d->setTitle(title); 332 HTMLHeadElement* headElement = d->head();
333 if (headElement) {
haraken 2014/07/02 08:02:29 Is it possible that the head element does not exis
kangil_ 2014/07/02 08:23:12 Done.
334 RefPtrWillBeRawPtr<HTMLTitleElement> titleElement = HTMLTitleElement ::create(*d);
335 headElement->appendChild(titleElement);
336 titleElement->appendChild(d->createTextNode(title), IGNORE_EXCEPTION );
337 }
338 }
330 d->setSecurityOrigin(document().securityOrigin()->isolatedCopy()); 339 d->setSecurityOrigin(document().securityOrigin()->isolatedCopy());
331 d->setContextFeatures(document().contextFeatures()); 340 d->setContextFeatures(document().contextFeatures());
332 return d.release(); 341 return d.release();
333 } 342 }
334 343
335 PassRefPtrWillBeRawPtr<Document> DOMImplementation::createDocument(const String& type, LocalFrame* frame, const KURL& url, bool inViewSourceMode) 344 PassRefPtrWillBeRawPtr<Document> DOMImplementation::createDocument(const String& type, LocalFrame* frame, const KURL& url, bool inViewSourceMode)
336 { 345 {
337 return createDocument(type, DocumentInit(url, frame), inViewSourceMode); 346 return createDocument(type, DocumentInit(url, frame), inViewSourceMode);
338 } 347 }
339 348
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 386
378 return HTMLDocument::create(init); 387 return HTMLDocument::create(init);
379 } 388 }
380 389
381 void DOMImplementation::trace(Visitor* visitor) 390 void DOMImplementation::trace(Visitor* visitor)
382 { 391 {
383 visitor->trace(m_document); 392 visitor->trace(m_document);
384 } 393 }
385 394
386 } 395 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/implementation-createHTMLDocument-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698