Allow undirected selections in gfx::RenderText

Desktop / Chromium - Trent Apted [chromium.org] - 11 October 2017 22:22 EDT

On Mac, selecting text with the mouse (regardless of the drag
vector), or with SelectAll, does not give the selection a "direction". That is, the caret is not known to be at a particular "end" of the selection. Only with the first directed cursor movement (e.g. Shift+Right), is the cursor position chosen.

On other platforms, a selection is always directed. (Typically "forward" but often backwards if the start of a text field should scroll in to
view, or if the mouse drag vector was "backwards").

Implement undirected selections in gfx::RenderText and enable on Mac.

Bug: 712354 Change-Id: Ib904522db96c84318bb6013f18bf06e16bb3ff8e Reviewed-on: https://chromium-review.googlesource.com/700216

ad9e380 Allow undirected selections in gfx::RenderText
ui/gfx/render_text.cc | 40 +++++--
ui/gfx/render_text.h | 10 ++
ui/gfx/render_text_unittest.cc | 114 ++++++++++++++++++
ui/views/cocoa/bridged_native_widget_unittest.mm | 135 +++++++++++++++-------
ui/views/controls/textfield/textfield_unittest.cc | 7 +-
5 files changed, 253 insertions(+), 53 deletions(-)

Upstream: git.chromium.org


  • Share