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

Unified Diff: content/browser/renderer_host/text_input_manager.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/text_input_manager.h ('k') | content/common/frame_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/text_input_manager.cc
diff --git a/content/browser/renderer_host/text_input_manager.cc b/content/browser/renderer_host/text_input_manager.cc
index 8ab29925959ae1ae0033a14cae72d9c834af7e1f..fd2eaf3a1ad4ddf1ca93765ecf39442ea4f07b1a 100644
--- a/content/browser/renderer_host/text_input_manager.cc
+++ b/content/browser/renderer_host/text_input_manager.cc
@@ -239,9 +239,10 @@ void TextInputManager::ImeCompositionRangeChanged(
void TextInputManager::SelectionChanged(RenderWidgetHostViewBase* view,
const base::string16& text,
size_t offset,
- const gfx::Range& range) {
+ const gfx::Range& range,
+ bool user_initiated) {
DCHECK(IsRegistered(view));
- text_selection_map_[view].SetSelection(text, offset, range);
+ text_selection_map_[view].SetSelection(text, offset, range, user_initiated);
for (auto& observer : observer_list_)
observer.OnTextSelectionChanged(this, view);
}
@@ -321,8 +322,7 @@ TextInputManager::CompositionRangeInfo::CompositionRangeInfo(
TextInputManager::CompositionRangeInfo::~CompositionRangeInfo() {}
-TextInputManager::TextSelection::TextSelection()
- : offset_(0), range_(gfx::Range::InvalidRange()) {}
+TextInputManager::TextSelection::TextSelection() {}
TextInputManager::TextSelection::TextSelection(const TextSelection& other) =
default;
@@ -331,11 +331,13 @@ TextInputManager::TextSelection::~TextSelection() {}
void TextInputManager::TextSelection::SetSelection(const base::string16& text,
size_t offset,
- const gfx::Range& range) {
+ const gfx::Range& range,
+ bool user_initiated) {
text_ = text;
range_.set_start(range.start());
range_.set_end(range.end());
offset_ = offset;
+ user_initiated_ = user_initiated;
// Update the selected text.
selected_text_.clear();
« no previous file with comments | « content/browser/renderer_host/text_input_manager.h ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698