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

Unified Diff: views/controls/textfield/textfield.cc

Issue 8044004: Clean up of SelectionModel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: add comment about 'next' in ReplaceTextInternal Created 9 years, 2 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 | « views/controls/textfield/textfield.h ('k') | views/controls/textfield/textfield_views_model.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/textfield/textfield.cc
===================================================================
--- views/controls/textfield/textfield.cc (revision 103984)
+++ views/controls/textfield/textfield.cc (working copy)
@@ -158,10 +158,10 @@
}
bool Textfield::HasSelection() const {
- gfx::SelectionModel sel;
+ ui::Range range;
if (native_wrapper_)
- native_wrapper_->GetSelectionModel(&sel);
- return sel.selection_start() != sel.selection_end();
+ native_wrapper_->GetSelectedRange(&range);
+ return !range.is_empty();
}
void Textfield::SetTextColor(SkColor color) {
@@ -268,6 +268,16 @@
return native_wrapper_ && native_wrapper_->IsIMEComposing();
}
+void Textfield::GetSelectedRange(ui::Range* range) const {
+ DCHECK(native_wrapper_);
+ native_wrapper_->GetSelectedRange(range);
+}
+
+void Textfield::SelectRange(const ui::Range& range) {
+ DCHECK(native_wrapper_);
+ native_wrapper_->SelectRange(range);
+}
+
void Textfield::GetSelectionModel(gfx::SelectionModel* sel) const {
DCHECK(native_wrapper_);
native_wrapper_->GetSelectionModel(sel);
@@ -394,10 +404,10 @@
state->value = text_;
DCHECK(native_wrapper_);
- gfx::SelectionModel sel;
- native_wrapper_->GetSelectionModel(&sel);
- state->selection_start = sel.selection_start();
- state->selection_end = sel.selection_end();
+ ui::Range range;
+ native_wrapper_->GetSelectedRange(&range);
+ state->selection_start = range.start();
+ state->selection_end = range.end();
}
TextInputClient* Textfield::GetTextInputClient() {
« no previous file with comments | « views/controls/textfield/textfield.h ('k') | views/controls/textfield/textfield_views_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698