diff options
Diffstat (limited to 'views/controls/textfield/native_textfield_views.cc')
-rw-r--r-- | views/controls/textfield/native_textfield_views.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/views/controls/textfield/native_textfield_views.cc b/views/controls/textfield/native_textfield_views.cc index d2fbb14..07725ff 100644 --- a/views/controls/textfield/native_textfield_views.cc +++ b/views/controls/textfield/native_textfield_views.cc @@ -791,11 +791,15 @@ bool NativeTextfieldViews::DeleteRange(const ui::Range& range) { bool NativeTextfieldViews::GetTextFromRange( const ui::Range& range, - const base::Callback<void(const string16&)>& callback) { - if (GetTextInputType() != ui::TEXT_INPUT_TYPE_TEXT || range.is_empty()) + string16* text) { + if (GetTextInputType() != ui::TEXT_INPUT_TYPE_TEXT || !range.IsValid()) + return false; + + ui::Range text_range; + if (!GetTextRange(&text_range) || !text_range.Contains(range)) return false; - callback.Run(model_->GetTextFromRange(range)); + *text = model_->GetTextFromRange(range); return true; } |