Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / dom / DOMImplementation.cpp
index 0a66b55..b1b11a6 100644 (file)
@@ -25,7 +25,7 @@
 #include "config.h"
 #include "core/dom/DOMImplementation.h"
 
-#include "bindings/v8/ExceptionState.h"
+#include "bindings/core/v8/ExceptionState.h"
 #include "core/HTMLNames.h"
 #include "core/SVGNames.h"
 #include "core/css/CSSStyleSheet.h"
 #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"
@@ -57,7 +60,7 @@
 #include "platform/weborigin/SecurityOrigin.h"
 #include "wtf/StdLibExtras.h"
 
-namespace WebCore {
+namespace blink {
 
 typedef HashSet<String, CaseFoldingHash> FeatureSet;
 
@@ -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), ASSERT_NO_EXCEPTION);
+    }
     d->setSecurityOrigin(document().securityOrigin()->isolatedCopy());
     d->setContextFeatures(document().contextFeatures());
     return d.release();