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

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: 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..c8fbb2938baa0109c898ba44a4766b027a3313bf 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"
@@ -325,8 +328,14 @@ PassRefPtrWillBeRawPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const
RefPtrWillBeRawPtr<HTMLDocument> d = HTMLDocument::create(init);
d->open();
d->write("<!doctype html><html><body></body></html>");
- if (!title.isNull())
- d->setTitle(title);
+ 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
+ HTMLHeadElement* headElement = d->head();
+ 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.
+ RefPtrWillBeRawPtr<HTMLTitleElement> titleElement = HTMLTitleElement::create(*d);
+ headElement->appendChild(titleElement);
+ titleElement->appendChild(d->createTextNode(title), IGNORE_EXCEPTION);
+ }
+ }
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