Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Unified Diff: Source/core/editing/DeleteSelectionCommand.cpp

Issue 214313002: Don't inherit block style if text is inserted after paragraph selection. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use Selection.collapse(). Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/editing/DeleteSelectionCommand.cpp
diff --git a/Source/core/editing/DeleteSelectionCommand.cpp b/Source/core/editing/DeleteSelectionCommand.cpp
index 7059c7dd7972d15226e0c7a86700c9fb3cb44e22..fd7a7e3bf35195d17689b6a158d1517320667601 100644
--- a/Source/core/editing/DeleteSelectionCommand.cpp
+++ b/Source/core/editing/DeleteSelectionCommand.cpp
@@ -375,10 +375,16 @@ void DeleteSelectionCommand::removeNode(PassRefPtr<Node> node, ShouldAssumeConte
return;
}
- if (node == m_startBlock && !isEndOfBlock(VisiblePosition(firstPositionInNode(m_startBlock.get())).previous()))
- m_needPlaceholder = true;
- else if (node == m_endBlock && !isStartOfBlock(VisiblePosition(lastPositionInNode(m_startBlock.get())).next()))
- m_needPlaceholder = true;
+ if (node == m_startBlock) {
+ VisiblePosition previous = VisiblePosition(firstPositionInNode(m_startBlock.get())).previous();
+ if (previous.isNotNull() && !isEndOfBlock(previous))
+ m_needPlaceholder = true;
+ }
+ if (node == m_endBlock) {
+ VisiblePosition next = VisiblePosition(lastPositionInNode(m_endBlock.get())).next();
+ if (next.isNotNull() && !isStartOfBlock(next))
+ m_needPlaceholder = true;
+ }
// FIXME: Update the endpoints of the range being deleted.
updatePositionForNodeRemoval(m_endingPosition, *node);

Powered by Google App Engine
This is Rietveld 408576698