summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/editing/DeleteSelectionCommand.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/editing/DeleteSelectionCommand.cpp')
-rw-r--r--Source/WebCore/editing/DeleteSelectionCommand.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/Source/WebCore/editing/DeleteSelectionCommand.cpp b/Source/WebCore/editing/DeleteSelectionCommand.cpp
index cbebe54..529c71d 100644
--- a/Source/WebCore/editing/DeleteSelectionCommand.cpp
+++ b/Source/WebCore/editing/DeleteSelectionCommand.cpp
@@ -281,7 +281,7 @@ void DeleteSelectionCommand::saveTypingStyleState()
return;
// Figure out the typing style in effect before the delete is done.
- m_typingStyle = EditingStyle::create(positionBeforeTabSpan(m_selectionToDelete.start()));
+ m_typingStyle = EditingStyle::create(m_selectionToDelete.start());
m_typingStyle->removeStyleAddedByNode(enclosingAnchorElement(m_selectionToDelete.start()));
// If we're deleting into a Mail blockquote, save the style at end() instead of start()
@@ -335,6 +335,15 @@ static void updatePositionForNodeRemoval(Node* node, Position& position)
}
}
+static Position firstEditablePositionInNode(Node* node)
+{
+ ASSERT(node);
+ Node* next = node;
+ while (next && !next->rendererIsEditable())
+ next = next->traverseNextNode(node);
+ return next ? firstPositionInOrBeforeNode(next) : Position();
+}
+
void DeleteSelectionCommand::removeNode(PassRefPtr<Node> node)
{
if (!node)
@@ -372,11 +381,14 @@ void DeleteSelectionCommand::removeNode(PassRefPtr<Node> node)
removeNode(remove);
}
- // make sure empty cell has some height
+ // Make sure empty cell has some height, if a placeholder can be inserted.
updateLayout();
RenderObject *r = node->renderer();
- if (r && r->isTableCell() && toRenderTableCell(r)->contentHeight() <= 0)
- insertBlockPlaceholder(firstPositionInNode(node.get()));
+ if (r && r->isTableCell() && toRenderTableCell(r)->contentHeight() <= 0) {
+ Position firstEditablePosition = firstEditablePositionInNode(node.get());
+ if (firstEditablePosition.isNotNull())
+ insertBlockPlaceholder(firstEditablePosition);
+ }
return;
}