summaryrefslogtreecommitdiffstats
path: root/WebCore/editing/DeleteSelectionCommand.cpp
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-09-30 15:42:16 +0100
committerSteve Block <steveblock@google.com>2010-10-07 10:59:29 +0100
commitbec39347bb3bb5bf1187ccaf471d26247f28b585 (patch)
tree56bdc4c2978fbfd3d79d0d36d5d6c640ecc09cc8 /WebCore/editing/DeleteSelectionCommand.cpp
parent90b7966e7815b262cd19ac25f03aaad9b21fdc06 (diff)
downloadexternal_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.zip
external_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.tar.gz
external_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.tar.bz2
Merge WebKit at r68651 : Initial merge by git.
Change-Id: I3d6bff59f17eedd6722723354f386fec9be8ad12
Diffstat (limited to 'WebCore/editing/DeleteSelectionCommand.cpp')
-rw-r--r--WebCore/editing/DeleteSelectionCommand.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/WebCore/editing/DeleteSelectionCommand.cpp b/WebCore/editing/DeleteSelectionCommand.cpp
index 4aa5c3c..4aca57e 100644
--- a/WebCore/editing/DeleteSelectionCommand.cpp
+++ b/WebCore/editing/DeleteSelectionCommand.cpp
@@ -443,11 +443,7 @@ void DeleteSelectionCommand::handleGeneralDelete()
return;
if (startNode == m_downstreamEnd.node()) {
- // The selection to delete is all in one node.
- if (!startNode->renderer() || (startOffset == 0 && m_downstreamEnd.atLastEditingPositionForNode())) {
- // just delete
- removeNode(startNode);
- } else if (m_downstreamEnd.deprecatedEditingOffset() - startOffset > 0) {
+ if (m_downstreamEnd.deprecatedEditingOffset() - startOffset > 0) {
if (startNode->isTextNode()) {
// in a text node that needs to be trimmed
Text* text = static_cast<Text*>(startNode);
@@ -457,6 +453,10 @@ void DeleteSelectionCommand::handleGeneralDelete()
m_endingPosition = m_upstreamStart;
}
}
+
+ // The selection to delete is all in one node.
+ if (!startNode->renderer() || (!startOffset && m_downstreamEnd.atLastEditingPositionForNode()))
+ removeNode(startNode);
}
else {
bool startNodeWasDescendantOfEndNode = m_upstreamStart.node()->isDescendantOf(m_downstreamEnd.node());
@@ -472,6 +472,9 @@ void DeleteSelectionCommand::handleGeneralDelete()
} else {
node = startNode->childNode(startOffset);
}
+ } else if (startNode == m_upstreamEnd.node() && startNode->isTextNode()) {
+ Text* text = static_cast<Text*>(m_upstreamEnd.node());
+ deleteTextFromNode(text, 0, m_upstreamEnd.deprecatedEditingOffset());
}
// handle deleting all nodes that are completely selected