Replace m_firstNodeInserted and m_lastLeafInserted in ReplaceSelectionCommand by...
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Oct 2011 23:05:39 +0000 (23:05 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Oct 2011 23:05:39 +0000 (23:05 +0000)
commitbd6682da1761109ce31cedb9296a9b97250b0870
tree413c44ef2a4580a1cda09c1f0b37c3c74c702b3b
parentf62004064b5d4b192b6d316520949d4fb1486a3f
Replace m_firstNodeInserted and m_lastLeafInserted in ReplaceSelectionCommand by positions
https://bugs.webkit.org/show_bug.cgi?id=68874

Reviewed by Enrica Casucci.

Replaced m_firstNodeInserted and m_lastLeafInserted by m_startOfInsertedContent and m_endOfInsertedContent
respectively. Also removed removeNodePreservingChildren and removeNodeAndPruneAncestors in ReplaceSelectionCommand
because they were not virtual in CompositeEditCommand and implicitly overriding the functions was confusing.
Since each of these two functions is used at exactly one place, just update positions and insertedNodes explicitly.

* editing/CompositeEditCommand.cpp:
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds):
(WebCore::ReplaceSelectionCommand::positionAtEndOfInsertedContent):
(WebCore::ReplaceSelectionCommand::positionAtStartOfInsertedContent):
(WebCore::ReplaceSelectionCommand::handleStyleSpans):
(WebCore::ReplaceSelectionCommand::mergeEndIfNeeded): Update m_endOfInsertedContent by endingSelection().visibleEnd()
instead of m_lastLeafInserted with destination.previous() because moveParagraph could have removed leading whitespace in
the text node referenced by destination. This is tested by an existing layout test.
(WebCore::ReplaceSelectionCommand::doApply):
(WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace): Update positions as needed. All changes are tested
by the existing layout tests in editing/pasteboard.
(WebCore::ReplaceSelectionCommand::updateNodesInserted):
* editing/ReplaceSelectionCommand.h:
* editing/htmlediting.cpp:
(WebCore::hasARenderedDescendant): Moved from CompositeEditCommand.cpp.
(WebCore::highestNodeToRemoveInPruning): Ditto.
* editing/htmlediting.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96553 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/editing/CompositeEditCommand.cpp
Source/WebCore/editing/ReplaceSelectionCommand.cpp
Source/WebCore/editing/ReplaceSelectionCommand.h
Source/WebCore/editing/htmlediting.cpp
Source/WebCore/editing/htmlediting.h