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

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: Take review comment into consideration 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 { 320 {
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><head></head><body></body></html>");
328 if (!title.isNull()) 331 if (!title.isNull()) {
329 d->setTitle(title); 332 HTMLHeadElement* headElement = d->head();
333 ASSERT(headElement);
334 RefPtrWillBeRawPtr<HTMLTitleElement> titleElement = HTMLTitleElement::cr eate(*d);
335 headElement->appendChild(titleElement);
336 titleElement->appendChild(d->createTextNode(title), IGNORE_EXCEPTION);
tkent 2014/07/04 01:18:27 IGNORE_EXCEPTION -> ASSERT_NO_EXCEPTION We should
kangil_ 2014/07/04 02:06:55 I will make a patch on this. Thanks!
337 }
330 d->setSecurityOrigin(document().securityOrigin()->isolatedCopy()); 338 d->setSecurityOrigin(document().securityOrigin()->isolatedCopy());
331 d->setContextFeatures(document().contextFeatures()); 339 d->setContextFeatures(document().contextFeatures());
332 return d.release(); 340 return d.release();
333 } 341 }
334 342
335 PassRefPtrWillBeRawPtr<Document> DOMImplementation::createDocument(const String& type, LocalFrame* frame, const KURL& url, bool inViewSourceMode) 343 PassRefPtrWillBeRawPtr<Document> DOMImplementation::createDocument(const String& type, LocalFrame* frame, const KURL& url, bool inViewSourceMode)
336 { 344 {
337 return createDocument(type, DocumentInit(url, frame), inViewSourceMode); 345 return createDocument(type, DocumentInit(url, frame), inViewSourceMode);
338 } 346 }
339 347
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 385
378 return HTMLDocument::create(init); 386 return HTMLDocument::create(init);
379 } 387 }
380 388
381 void DOMImplementation::trace(Visitor* visitor) 389 void DOMImplementation::trace(Visitor* visitor)
382 { 390 {
383 visitor->trace(m_document); 391 visitor->trace(m_document);
384 } 392 }
385 393
386 } 394 }
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