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)
commitc3bbce717d50066532545886bb5f5a6a37d4f9c7
tree413c44ef2a4580a1cda09c1f0b37c3c74c702b3b
parent61acd8636a6a99ba4ed4ab55500a38161ff5b3c1
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: https://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