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

Unified Diff: third_party/WebKit/Source/core/editing/Editor.cpp

Issue 2890313003: Commands preserve handles (Closed)
Patch Set: added test Created 3 years, 7 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/Editor.cpp
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp
index 2fc9b42fc338aee591b90e97681a6c6115edeaa3..dd10b500ad4607284c8877dc5e79bbda21e7477d 100644
--- a/third_party/WebKit/Source/core/editing/Editor.cpp
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -919,14 +919,15 @@ static void DispatchEditableContentChangedEvents(Element* start_root,
static SelectionInDOMTree CorrectedSelectionAfterCommand(
yosin_UTC9 2017/05/23 01:46:36 Is it better to pass FrameSelection instead of Doc
const VisibleSelection& passed_selection,
- Document* document) {
+ Document* document,
+ bool is_handle_visible) {
yosin_UTC9 2017/05/23 01:46:36 We should use |HandleVisibility|.
if (!passed_selection.Base().IsConnected() ||
!passed_selection.Extent().IsConnected() ||
passed_selection.Base().GetDocument() != document ||
passed_selection.Base().GetDocument() !=
passed_selection.Extent().GetDocument())
return SelectionInDOMTree();
- return passed_selection.AsSelection();
+ return passed_selection.AsSelection(is_handle_visible);
yosin_UTC9 2017/05/23 01:46:36 Please use SelectionInDOMTree::Builder as return
}
void Editor::AppliedEditing(CompositeEditCommand* cmd) {
@@ -947,7 +948,8 @@ void Editor::AppliedEditing(CompositeEditCommand* cmd) {
cmd->TextDataForInputEvent(), IsComposingFromCommand(cmd));
const SelectionInDOMTree& new_selection = CorrectedSelectionAfterCommand(
- cmd->EndingSelection(), GetFrame().GetDocument());
+ cmd->EndingSelection(), GetFrame().GetDocument(),
+ GetFrame().Selection().IsHandleVisible());
// Don't clear the typing style with this selection change. We do those things
// elsewhere if necessary.
@@ -989,7 +991,8 @@ void Editor::UnappliedEditing(UndoStep* cmd) {
InputEvent::EventIsComposing::kNotComposing);
const SelectionInDOMTree& new_selection = CorrectedSelectionAfterCommand(
- cmd->StartingSelection(), GetFrame().GetDocument());
+ cmd->StartingSelection(), GetFrame().GetDocument(),
+ GetFrame().Selection().IsHandleVisible());
ChangeSelectionAfterCommand(
new_selection,
FrameSelection::kCloseTyping | FrameSelection::kClearTypingStyle);
@@ -1010,7 +1013,8 @@ void Editor::ReappliedEditing(UndoStep* cmd) {
InputEvent::EventIsComposing::kNotComposing);
const SelectionInDOMTree& new_selection = CorrectedSelectionAfterCommand(
- cmd->EndingSelection(), GetFrame().GetDocument());
+ cmd->EndingSelection(), GetFrame().GetDocument(),
+ GetFrame().Selection().IsHandleVisible());
ChangeSelectionAfterCommand(
new_selection,
FrameSelection::kCloseTyping | FrameSelection::kClearTypingStyle);
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698