Commit 4ea2e706 authored by msw's avatar msw Committed by Commit bot

Fix Views Textfield drag selection behavior past edges.

Immediately select through the edge on external drags.
Fix minor OBO for external bounds checking.

BUG=415907
TEST=Quickly dragging outside the textfield immediately selects visible text.
R=pkasting@chromium.org

Review URL: https://codereview.chromium.org/1073523005

Cr-Commit-Position: refs/heads/master@{#324395}
parent 0d7e8491
......@@ -647,11 +647,14 @@ bool Textfield::OnMouseDragged(const ui::MouseEvent& event) {
}
// A timer is used to continuously scroll while selecting beyond side edges.
if ((event.location().x() > 0 && event.location().x() < size().width()) ||
GetDragSelectionDelay() == 0) {
const int x = event.location().x();
if ((x >= 0 && x <= width()) || GetDragSelectionDelay() == 0) {
drag_selection_timer_.Stop();
SelectThroughLastDragLocation();
} else if (!drag_selection_timer_.IsRunning()) {
// Select through the edge of the visible text, then start the scroll timer.
last_drag_location_.set_x(std::min(std::max(0, x), width()));
SelectThroughLastDragLocation();
drag_selection_timer_.Start(
FROM_HERE, base::TimeDelta::FromMilliseconds(GetDragSelectionDelay()),
this, &Textfield::SelectThroughLastDragLocation);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment