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

Side by Side Diff: third_party/WebKit/Source/core/editing/Editor.cpp

Issue 1828623002: Make Editor::tidyUpHTMLStructure() handles BODY element correctly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 document.addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMe ssageLevel, "document.execCommand() doesn't work with an invalid HTML structure. It is corrected automatically.")); 1354 document.addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMe ssageLevel, "document.execCommand() doesn't work with an invalid HTML structure. It is corrected automatically."));
1355 1355
1356 RefPtrWillBeRawPtr<Element> root = HTMLHtmlElement::create(document); 1356 RefPtrWillBeRawPtr<Element> root = HTMLHtmlElement::create(document);
1357 if (existingHead) 1357 if (existingHead)
1358 root->appendChild(existingHead.release()); 1358 root->appendChild(existingHead.release());
1359 RefPtrWillBeRawPtr<Element> body = nullptr; 1359 RefPtrWillBeRawPtr<Element> body = nullptr;
1360 if (existingBody) 1360 if (existingBody)
1361 body = existingBody.release(); 1361 body = existingBody.release();
1362 else 1362 else
1363 body = HTMLBodyElement::create(document); 1363 body = HTMLBodyElement::create(document);
1364 if (document.documentElement()) 1364 if (document.documentElement() && body != document.documentElement())
1365 body->appendChild(document.documentElement()); 1365 body->appendChild(document.documentElement());
1366 root->appendChild(body.release()); 1366 root->appendChild(body.release());
1367 ASSERT(!document.documentElement()); 1367 ASSERT(!document.documentElement());
1368 document.appendChild(root.release()); 1368 document.appendChild(root.release());
1369 1369
1370 // TODO(tkent): Should we check and move Text node children of <html>? 1370 // TODO(tkent): Should we check and move Text node children of <html>?
1371 } 1371 }
1372 1372
1373 DEFINE_TRACE(Editor) 1373 DEFINE_TRACE(Editor)
1374 { 1374 {
1375 visitor->trace(m_frame); 1375 visitor->trace(m_frame);
1376 visitor->trace(m_lastEditCommand); 1376 visitor->trace(m_lastEditCommand);
1377 visitor->trace(m_mark); 1377 visitor->trace(m_mark);
1378 } 1378 }
1379 1379
1380 } // namespace blink 1380 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/editing/EditorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698