Index: Source/core/editing/DeleteSelectionCommand.cpp |
diff --git a/Source/core/editing/DeleteSelectionCommand.cpp b/Source/core/editing/DeleteSelectionCommand.cpp |
index 868e60ab2be2dd28f78665b3d234ddd0f667b503..fa303858b9b3b910e1f84db6ea3b8ca81a70a27e 100644 |
--- a/Source/core/editing/DeleteSelectionCommand.cpp |
+++ b/Source/core/editing/DeleteSelectionCommand.cpp |
@@ -766,9 +766,12 @@ void DeleteSelectionCommand::doApply() |
EAffinity affinity = m_selectionToDelete.affinity(); |
Position downstreamEnd = m_selectionToDelete.end().downstream(); |
- m_needPlaceholder = isStartOfParagraph(m_selectionToDelete.visibleStart(), CanCrossEditingBoundary) |
- && isEndOfParagraph(m_selectionToDelete.visibleEnd(), CanCrossEditingBoundary) |
- && !lineBreakExistsAtVisiblePosition(m_selectionToDelete.visibleEnd()); |
+ bool rootWillStayOpenWithoutPlaceholder = downstreamEnd.containerNode() == downstreamEnd.containerNode()->rootEditableElement() |
+ || (downstreamEnd.containerNode()->isTextNode() && downstreamEnd.containerNode()->parentNode() == downstreamEnd.containerNode()->rootEditableElement()); |
+ m_needPlaceholder = !rootWillStayOpenWithoutPlaceholder |
+ && isStartOfParagraph(m_selectionToDelete.visibleStart(), CanCrossEditingBoundary) |
+ && isEndOfParagraph(m_selectionToDelete.visibleEnd(), CanCrossEditingBoundary) |
+ && !lineBreakExistsAtVisiblePosition(m_selectionToDelete.visibleEnd()); |
if (m_needPlaceholder) { |
// Don't need a placeholder when deleting a selection that starts just before a table |
// and ends inside it (we do need placeholders to hold open empty cells, but that's |