Chromium Code Reviews| Index: Source/core/editing/DeleteSelectionCommand.cpp |
| diff --git a/Source/core/editing/DeleteSelectionCommand.cpp b/Source/core/editing/DeleteSelectionCommand.cpp |
| index d407b7d2856e22c2a7c14eb30a6f2064a021ba73..1e4bdd0ee2e1da8888f493f07cc149047696957f 100644 |
| --- a/Source/core/editing/DeleteSelectionCommand.cpp |
| +++ b/Source/core/editing/DeleteSelectionCommand.cpp |
| @@ -802,9 +802,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()->isTextNode() |
|
ojan
2013/05/10 23:38:21
Actually, now that I look at this more closely, wh
|
| + && 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 |