Allow undirected selections in gfx::RenderText

Desktop / Chromium - Trent Apted [] - 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:

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


  • Share