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

Unified Diff: Source/WebCore/dom/Document.cpp

Issue 7149022: Merge 87863 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 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/document-set-body-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/dom/Document.cpp
===================================================================
--- Source/WebCore/dom/Document.cpp (revision 88810)
+++ Source/WebCore/dom/Document.cpp (working copy)
@@ -2031,11 +2031,21 @@
void Document::setBody(PassRefPtr<HTMLElement> newBody, ExceptionCode& ec)
{
- if (!newBody || !documentElement()) {
+ ec = 0;
+
+ if (!newBody || !documentElement() || !newBody->hasTagName(bodyTag)) {
ec = HIERARCHY_REQUEST_ERR;
return;
}
+ if (newBody->document() && newBody->document() != this) {
+ RefPtr<Node> node = importNode(newBody.get(), true, ec);
+ if (ec)
+ return;
+
+ newBody = toHTMLElement(node.get());
+ }
+
HTMLElement* b = body();
if (!b)
documentElement()->appendChild(newBody, ec);
« no previous file with comments | « LayoutTests/fast/dom/document-set-body-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698