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

Side by Side Diff: content/renderer/input/frame_input_handler_impl.cc

Issue 2903833002: Reland: Update TextSelection for non-user initiated events
Patch Set: Add test for JS cursor movement Created 3 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/input/frame_input_handler_impl.h" 5 #include "content/renderer/input/frame_input_handler_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/stack_trace.h" 10 #include "base/debug/stack_trace.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 RunOnMainThread( 212 RunOnMainThread(
213 base::Bind(&FrameInputHandlerImpl::Replace, weak_this_, word)); 213 base::Bind(&FrameInputHandlerImpl::Replace, weak_this_, word));
214 return; 214 return;
215 } 215 }
216 if (!render_frame_) 216 if (!render_frame_)
217 return; 217 return;
218 blink::WebLocalFrame* frame = render_frame_->GetWebFrame(); 218 blink::WebLocalFrame* frame = render_frame_->GetWebFrame();
219 if (frame->HasSelection()) 219 if (frame->HasSelection())
220 frame->SelectWordAroundCaret(); 220 frame->SelectWordAroundCaret();
221 frame->ReplaceSelection(blink::WebString::FromUTF16(word)); 221 frame->ReplaceSelection(blink::WebString::FromUTF16(word));
222 render_frame_->SyncSelectionIfRequired(); 222 render_frame_->SyncSelectionIfRequired(true);
223 } 223 }
224 224
225 void FrameInputHandlerImpl::ReplaceMisspelling(const base::string16& word) { 225 void FrameInputHandlerImpl::ReplaceMisspelling(const base::string16& word) {
226 if (!main_thread_task_runner_->BelongsToCurrentThread()) { 226 if (!main_thread_task_runner_->BelongsToCurrentThread()) {
227 RunOnMainThread(base::Bind(&FrameInputHandlerImpl::ReplaceMisspelling, 227 RunOnMainThread(base::Bind(&FrameInputHandlerImpl::ReplaceMisspelling,
228 weak_this_, word)); 228 weak_this_, word));
229 return; 229 return;
230 } 230 }
231 if (!render_frame_) 231 if (!render_frame_)
232 return; 232 return;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 break; 413 break;
414 } 414 }
415 } 415 }
416 416
417 FrameInputHandlerImpl::HandlingState::~HandlingState() { 417 FrameInputHandlerImpl::HandlingState::~HandlingState() {
418 render_frame_->set_handling_select_range(original_select_range_value_); 418 render_frame_->set_handling_select_range(original_select_range_value_);
419 render_frame_->set_is_pasting(original_pasting_value_); 419 render_frame_->set_is_pasting(original_pasting_value_);
420 } 420 }
421 421
422 } // namespace content 422 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/text_input_test_utils.cc ('k') | content/renderer/input/render_widget_input_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698