| Index: third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp
|
| index 3602b49897fb1a9be14c3a7fe473e2566a1e083c..335bf5f6d1e003f2a31a8be193ce2dc0a748afb5 100644
|
| --- a/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp
|
| @@ -71,8 +71,9 @@ void InsertLineBreakCommand::doApply(EditingState* editingState) {
|
| return;
|
|
|
| VisiblePosition caret(selection.visibleStartDeprecated());
|
| - // FIXME: If the node is hidden, we should still be able to insert text.
|
| - // For now, we return to avoid a crash. https://bugs.webkit.org/show_bug.cgi?id=40342
|
| + // FIXME: If the node is hidden, we should still be able to insert text. For
|
| + // now, we return to avoid a crash.
|
| + // https://bugs.webkit.org/show_bug.cgi?id=40342
|
| if (caret.isNull())
|
| return;
|
|
|
| @@ -139,8 +140,8 @@ void InsertLineBreakCommand::doApply(EditingState* editingState) {
|
| setEndingSelection(createVisibleSelectionDeprecated(
|
| Position::inParentAfterNode(*nodeToInsert), TextAffinity::Downstream,
|
| endingSelection().isDirectional()));
|
| - // If we're inserting after all of the rendered text in a text node, or into a non-text node,
|
| - // a simple insertion is sufficient.
|
| + // If we're inserting after all of the rendered text in a text node, or into
|
| + // a non-text node, a simple insertion is sufficient.
|
| } else if (!pos.anchorNode()->isTextNode() ||
|
| pos.computeOffsetInContainerNode() >=
|
| caretMaxOffset(pos.anchorNode())) {
|
| @@ -169,7 +170,8 @@ void InsertLineBreakCommand::doApply(EditingState* editingState) {
|
| deleteInsignificantTextDownstream(endingPosition);
|
| DCHECK(!textNode->layoutObject() ||
|
| textNode->layoutObject()->style()->collapseWhiteSpace());
|
| - // Deleting insignificant whitespace will remove textNode if it contains nothing but insignificant whitespace.
|
| + // Deleting insignificant whitespace will remove textNode if it contains
|
| + // nothing but insignificant whitespace.
|
| if (textNode->isConnected()) {
|
| insertTextIntoNode(textNode, 0, nonBreakingSpaceString());
|
| } else {
|
| @@ -191,20 +193,24 @@ void InsertLineBreakCommand::doApply(EditingState* editingState) {
|
| EditingStyle* typingStyle = document().frame()->selection().typingStyle();
|
|
|
| if (typingStyle && !typingStyle->isEmpty()) {
|
| - // Apply the typing style to the inserted line break, so that if the selection
|
| - // leaves and then comes back, new input will have the right style.
|
| + // Apply the typing style to the inserted line break, so that if the
|
| + // selection leaves and then comes back, new input will have the right
|
| + // style.
|
| // FIXME: We shouldn't always apply the typing style to the line break here,
|
| // see <rdar://problem/5794462>.
|
| applyStyle(typingStyle, firstPositionInOrBeforeNode(nodeToInsert),
|
| lastPositionInOrAfterNode(nodeToInsert), editingState);
|
| if (editingState->isAborted())
|
| return;
|
| - // Even though this applyStyle operates on a Range, it still sets an endingSelection().
|
| - // It tries to set a VisibleSelection around the content it operated on. So, that VisibleSelection
|
| - // will either (a) select the line break we inserted, or it will (b) be a caret just
|
| - // before the line break (if the line break is at the end of a block it isn't selectable).
|
| - // So, this next call sets the endingSelection() to a caret just after the line break
|
| - // that we inserted, or just before it if it's at the end of a block.
|
| + // Even though this applyStyle operates on a Range, it still sets an
|
| + // endingSelection(). It tries to set a VisibleSelection around the content
|
| + // it operated on. So, that VisibleSelection will either
|
| + // (a) select the line break we inserted, or it will
|
| + // (b) be a caret just before the line break (if the line break is at the
|
| + // end of a block it isn't selectable).
|
| + // So, this next call sets the endingSelection() to a caret just after the
|
| + // line break that we inserted, or just before it if it's at the end of a
|
| + // block.
|
| setEndingSelection(endingSelection().visibleEndDeprecated());
|
| }
|
|
|
|
|