| Index: third_party/WebKit/Source/core/editing/SelectionController.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/SelectionController.cpp b/third_party/WebKit/Source/core/editing/SelectionController.cpp
|
| index ec1a74b99081c0097b403bbd31034d84da345feb..5c0399a18c0e52f2789c6235cd3dbe11c0c762f7 100644
|
| --- a/third_party/WebKit/Source/core/editing/SelectionController.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/SelectionController.cpp
|
| @@ -215,10 +215,18 @@ bool SelectionController::HandleSingleClick(
|
| // Shift+Click deselects when selection was created right-to-left
|
| const PositionInFlatTree& start = selection.Start();
|
| const PositionInFlatTree& end = selection.end();
|
| - const int distance_to_start = TextDistance(start, pos);
|
| - const int distance_to_end = TextDistance(pos, end);
|
| - builder.SetBaseAndExtent(
|
| - distance_to_start <= distance_to_end ? end : start, pos);
|
| + if (pos < start) {
|
| + // |distance_to_start < distance_to_end|.
|
| + builder.SetBaseAndExtent(end, pos);
|
| + } else if (end < pos) {
|
| + // |distance_to_start > distance_to_end|.
|
| + builder.SetBaseAndExtent(start, pos);
|
| + } else {
|
| + const int distance_to_start = TextDistance(start, pos);
|
| + const int distance_to_end = TextDistance(pos, end);
|
| + builder.SetBaseAndExtent(
|
| + distance_to_start <= distance_to_end ? end : start, pos);
|
| + }
|
| }
|
|
|
| UpdateSelectionForMouseDownDispatchingSelectStart(
|
|
|