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

Unified Diff: ui/gfx/render_text.cc

Issue 10693160: Add and specify Views::Textfield::SelectAll |reversed| flag, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove redundant comments. Created 8 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 | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.cc
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
index cd9b505d7ead2fc48be046a0cf5d788b7372ff35..85dc029782e0d43b9be9b73fd4c02af87629eec3 100644
--- a/ui/gfx/render_text.cc
+++ b/ui/gfx/render_text.cc
@@ -521,18 +521,16 @@ void RenderText::ClearSelection() {
selection_model_.caret_affinity()));
}
-void RenderText::SelectAll() {
- SelectionModel all;
- if (GetTextDirection() == base::i18n::LEFT_TO_RIGHT)
- all = SelectionModel(ui::Range(0, text().length()), CURSOR_FORWARD);
- else
- all = SelectionModel(ui::Range(text().length(), 0), CURSOR_BACKWARD);
- SetSelectionModel(all);
+void RenderText::SelectAll(bool reversed) {
+ const size_t length = text().length();
+ const ui::Range all = reversed ? ui::Range(length, 0) : ui::Range(0, length);
+ const bool success = SelectRange(all);
+ DCHECK(success);
}
void RenderText::SelectWord() {
if (obscured_) {
- SelectAll();
+ SelectAll(false);
return;
}
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698