Chromium Code Reviews| Index: Source/core/editing/ReplaceSelectionCommand.cpp |
| diff --git a/Source/core/editing/ReplaceSelectionCommand.cpp b/Source/core/editing/ReplaceSelectionCommand.cpp |
| index 5b7939ef51b9433aab5a09051892b28cd4dab46e..c2109e940290cefc4217ca1adc601bc70e1e2208 100644 |
| --- a/Source/core/editing/ReplaceSelectionCommand.cpp |
| +++ b/Source/core/editing/ReplaceSelectionCommand.cpp |
| @@ -1126,12 +1126,15 @@ void ReplaceSelectionCommand::doApply() |
| insertNodeAt(createBreakElement(document()).get(), startOfInsertedContent.deepEquivalent()); |
| if (endBR && (plainTextFragment || shouldRemoveEndBR(endBR, originalVisPosBeforeEndBR))) { |
| - RefPtr<Node> parent = endBR->parentNode(); |
| - insertedNodes.willRemoveNode(*endBR); |
| - removeNode(endBR); |
| - if (Node* nodeToRemove = highestNodeToRemoveInPruning(parent.get())) { |
| - insertedNodes.willRemoveNode(*nodeToRemove); |
| - removeNode(nodeToRemove); |
| + // Don't remove br if we are replacing plain texts with content ending with newline |
| + if (!(fragment.hasInterchangeNewlineAtEnd() && selectionIsPlainText)) { |
|
yosin_UTC9
2013/12/20 01:23:06
nit: Please merge L1130 condition into L1129.
|
| + RefPtr<Node> parent = endBR->parentNode(); |
| + insertedNodes.willRemoveNode(*endBR); |
| + removeNode(endBR); |
| + if (Node* nodeToRemove = highestNodeToRemoveInPruning(parent.get())) { |
| + insertedNodes.willRemoveNode(*nodeToRemove); |
| + removeNode(nodeToRemove); |
| + } |
| } |
| } |