Index: Source/WebCore/editing/Editor.cpp |
=================================================================== |
--- Source/WebCore/editing/Editor.cpp (revision 117418) |
+++ Source/WebCore/editing/Editor.cpp (working copy) |
@@ -944,9 +944,11 @@ |
if (!shouldInsertText("\n", m_frame->selection()->toNormalizedRange().get(), EditorInsertActionTyped)) |
return true; |
+ VisiblePosition caret = m_frame->selection()->selection().visibleStart(); |
+ bool alignToEdge = isEndOfDocument(caret); |
bool autocorrectionIsApplied = m_alternativeTextController->applyAutocorrectionBeforeTypingIfAppropriate(); |
TypingCommand::insertLineBreak(m_frame->document(), autocorrectionIsApplied ? TypingCommand::RetainAutocorrectionIndicator : 0); |
- revealSelectionAfterEditingOperation(); |
+ revealSelectionAfterEditingOperation(alignToEdge ? ScrollAlignment::alignToEdgeIfNeeded : ScrollAlignment::alignCenterIfNeeded); |
return true; |
} |
@@ -962,9 +964,11 @@ |
if (!shouldInsertText("\n", m_frame->selection()->toNormalizedRange().get(), EditorInsertActionTyped)) |
return true; |
+ VisiblePosition caret = m_frame->selection()->selection().visibleStart(); |
+ bool alignToEdge = isEndOfDocument(caret); |
bool autocorrectionIsApplied = m_alternativeTextController->applyAutocorrectionBeforeTypingIfAppropriate(); |
TypingCommand::insertParagraphSeparator(m_frame->document(), autocorrectionIsApplied ? TypingCommand::RetainAutocorrectionIndicator : 0); |
- revealSelectionAfterEditingOperation(); |
+ revealSelectionAfterEditingOperation(alignToEdge ? ScrollAlignment::alignToEdgeIfNeeded : ScrollAlignment::alignCenterIfNeeded); |
return true; |
} |
@@ -2282,12 +2286,12 @@ |
return avoidIntersectionWithNode(selection.toNormalizedRange().get(), m_deleteButtonController->containerElement()); |
} |
-void Editor::revealSelectionAfterEditingOperation() |
+void Editor::revealSelectionAfterEditingOperation(const ScrollAlignment& alignment) |
{ |
if (m_ignoreCompositionSelectionChange) |
return; |
- m_frame->selection()->revealSelection(ScrollAlignment::alignCenterIfNeeded); |
+ m_frame->selection()->revealSelection(alignment); |
} |
void Editor::setIgnoreCompositionSelectionChange(bool ignore) |