| Index: ui/gfx/render_text.cc
|
| ===================================================================
|
| --- ui/gfx/render_text.cc (revision 97029)
|
| +++ ui/gfx/render_text.cc (working copy)
|
| @@ -199,8 +199,7 @@
|
| // Cancelling a selection moves to the edge of the selection.
|
| if (break_type != LINE_BREAK && !EmptySelection() && !select) {
|
| // Use the selection start if it is left of the selection end.
|
| - SelectionModel selection_start(GetSelectionStart(), GetSelectionStart(),
|
| - SelectionModel::LEADING);
|
| + SelectionModel selection_start = GetSelectionModelForSelectionStart();
|
| if (GetCursorBounds(selection_start, false).x() <
|
| GetCursorBounds(position, false).x())
|
| position = selection_start;
|
| @@ -221,8 +220,7 @@
|
| // Cancelling a selection moves to the edge of the selection.
|
| if (break_type != LINE_BREAK && !EmptySelection() && !select) {
|
| // Use the selection start if it is right of the selection end.
|
| - SelectionModel selection_start(GetSelectionStart(), GetSelectionStart(),
|
| - SelectionModel::LEADING);
|
| + SelectionModel selection_start = GetSelectionModelForSelectionStart();
|
| if (GetCursorBounds(selection_start, false).x() >
|
| GetCursorBounds(position, false).x())
|
| position = selection_start;
|
| @@ -608,4 +606,16 @@
|
| cursor_bounds_.Offset(delta_offset, 0);
|
| }
|
|
|
| +SelectionModel RenderText::GetSelectionModelForSelectionStart() {
|
| + if (GetSelectionStart() < GetCursorPosition()) {
|
| + return SelectionModel(GetSelectionStart(),
|
| + GetSelectionStart(),
|
| + SelectionModel::LEADING);
|
| + } else {
|
| + return SelectionModel(GetSelectionStart(),
|
| + GetIndexOfPreviousGrapheme(GetSelectionStart()),
|
| + SelectionModel::TRAILING);
|
| + }
|
| +}
|
| +
|
| } // namespace gfx
|
|
|