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

Unified 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, 6 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 | « LayoutTests/fast/dom/implementation-createHTMLDocument-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/DOMImplementation.cpp
diff --git a/Source/core/dom/DOMImplementation.cpp b/Source/core/dom/DOMImplementation.cpp
index 3b49baf78eaeb1f4d65c970054503a8665542a2d..8d766b7baaad357172280e8a564818440e43ea0d 100644
--- a/Source/core/dom/DOMImplementation.cpp
+++ b/Source/core/dom/DOMImplementation.cpp
@@ -36,12 +36,15 @@
#include "core/dom/DocumentType.h"
#include "core/dom/Element.h"
#include "core/dom/ExceptionCode.h"
+#include "core/dom/Text.h"
#include "core/dom/XMLDocument.h"
#include "core/dom/custom/CustomElementRegistrationContext.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/UseCounter.h"
#include "core/html/HTMLDocument.h"
+#include "core/html/HTMLHeadElement.h"
#include "core/html/HTMLMediaElement.h"
+#include "core/html/HTMLTitleElement.h"
#include "core/html/HTMLViewSourceDocument.h"
#include "core/html/ImageDocument.h"
#include "core/html/MediaDocument.h"
@@ -324,9 +327,14 @@ PassRefPtrWillBeRawPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const
.withRegistrationContext(document().registrationContext());
RefPtrWillBeRawPtr<HTMLDocument> d = HTMLDocument::create(init);
d->open();
- d->write("<!doctype html><html><body></body></html>");
- if (!title.isNull())
- d->setTitle(title);
+ d->write("<!doctype html><html><head></head><body></body></html>");
+ if (!title.isNull()) {
+ HTMLHeadElement* headElement = d->head();
+ ASSERT(headElement);
+ RefPtrWillBeRawPtr<HTMLTitleElement> titleElement = HTMLTitleElement::create(*d);
+ headElement->appendChild(titleElement);
+ 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!
+ }
d->setSecurityOrigin(document().securityOrigin()->isolatedCopy());
d->setContextFeatures(document().contextFeatures());
return d.release();
« 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