| Index: third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
|
| index 23f606a43b9af5bcd6e86e3895515c768d2e4559..ad72342c92d7fc2d2736fa2d0cc30a4b62a8e180 100644
|
| --- a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
|
| @@ -1329,7 +1329,16 @@ void ReplaceSelectionCommand::doApply(EditingState* editingState)
|
| VisiblePosition next = nextPositionOf(endOfInsertedContent, CannotCrossEditingBoundary);
|
|
|
| if (selectionEndWasEndOfParagraph || !isEndOfParagraph(endOfInsertedContent) || next.isNull()) {
|
| - if (!isStartOfParagraph(endOfInsertedContent)) {
|
| + if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(currentRoot)) {
|
| + if (!insertedNodes.lastLeafInserted()->nextSibling()) {
|
| + insertNodeAfter(textControl->createPlaceholderBreakElement(), insertedNodes.lastLeafInserted(), editingState);
|
| + if (editingState->isAborted())
|
| + return;
|
| + }
|
| + setEndingSelection(createVisiblePosition(positionAfterNode(insertedNodes.lastLeafInserted())));
|
| + // Select up to the paragraph separator that was added.
|
| + lastPositionToSelect = endingSelection().visibleStart().deepEquivalent();
|
| + } else if (!isStartOfParagraph(endOfInsertedContent)) {
|
| setEndingSelection(endOfInsertedContent);
|
| Element* enclosingBlockElement = enclosingBlock(endOfInsertedContent.deepEquivalent().anchorNode());
|
| if (isListItem(enclosingBlockElement)) {
|
| @@ -1338,11 +1347,6 @@ void ReplaceSelectionCommand::doApply(EditingState* editingState)
|
| if (editingState->isAborted())
|
| return;
|
| setEndingSelection(createVisiblePosition(firstPositionInNode(newListItem.get())));
|
| - } else if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(enclosingBlockElement)) {
|
| - insertNodeAfter(textControl->createPlaceholderBreakElement(), insertedNodes.lastLeafInserted(), editingState);
|
| - if (editingState->isAborted())
|
| - return;
|
| - setEndingSelection(createVisiblePosition(positionAfterNode(insertedNodes.lastLeafInserted())));
|
| } else {
|
| // Use a default paragraph element (a plain div) for the empty paragraph, using the last paragraph
|
| // block's style seems to annoy users.
|
|
|