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

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

Issue 2575343002: Move logic of WebLocalFrameImpl::replaceSelection to Editor (Closed)
Patch Set: Created 4 years 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 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 body = HTMLBodyElement::create(document); 1658 body = HTMLBodyElement::create(document);
1659 if (document.documentElement() && body != document.documentElement()) 1659 if (document.documentElement() && body != document.documentElement())
1660 body->appendChild(document.documentElement()); 1660 body->appendChild(document.documentElement());
1661 root->appendChild(body); 1661 root->appendChild(body);
1662 DCHECK(!document.documentElement()); 1662 DCHECK(!document.documentElement());
1663 document.appendChild(root); 1663 document.appendChild(root);
1664 1664
1665 // TODO(tkent): Should we check and move Text node children of <html>? 1665 // TODO(tkent): Should we check and move Text node children of <html>?
1666 } 1666 }
1667 1667
1668 void Editor::replaceSelection(const String& text) {
1669 DCHECK(!frame().document()->needsLayoutTreeUpdate());
1670 bool selectReplacement = behavior().shouldSelectReplacement();
1671 bool smartReplace = true;
1672 replaceSelectionWithText(text, selectReplacement, smartReplace,
1673 InputEvent::InputType::InsertReplacementText);
1674 }
1675
1668 DEFINE_TRACE(Editor) { 1676 DEFINE_TRACE(Editor) {
1669 visitor->trace(m_frame); 1677 visitor->trace(m_frame);
1670 visitor->trace(m_lastEditCommand); 1678 visitor->trace(m_lastEditCommand);
1671 visitor->trace(m_undoStack); 1679 visitor->trace(m_undoStack);
1672 visitor->trace(m_mark); 1680 visitor->trace(m_mark);
1673 } 1681 }
1674 1682
1675 } // namespace blink 1683 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/Editor.h ('k') | third_party/WebKit/Source/web/WebLocalFrameImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698