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

Unified Diff: ui/gfx/render_text.cc

Issue 2408623002: Views: Extract text selection code from Textfield. (Closed)
Patch Set: Check for |handles_selection_clipboard_| Created 4 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
Index: ui/gfx/render_text.cc
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
index 7ccaaa6131a5ece76f65603b9c3cc7f5450b4248..8abe68e04a5483055228312a39f85b7ee9d99331 100644
--- a/ui/gfx/render_text.cc
+++ b/ui/gfx/render_text.cc
@@ -687,6 +687,13 @@ bool RenderText::MoveCursorTo(const SelectionModel& model) {
return changed;
}
+bool RenderText::MoveCursorTo(const gfx::Point& point, bool select) {
+ gfx::SelectionModel model = FindCursorPosition(point);
+ if (select)
+ model.set_selection_start(selection().start());
+ return MoveCursorTo(model);
+}
+
bool RenderText::SelectRange(const Range& range) {
uint32_t text_length = static_cast<uint32_t>(text().length());
Range sel(std::min(range.start(), text_length),
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/views/BUILD.gn » ('j') | ui/views/selection_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698