Commit 6affe2cb authored by pkasting@chromium.org's avatar pkasting@chromium.org

Ensure the scroll slop area is at least as large as it is by default on Windows.

This should help Linux users trigger this unintentionally less often.

BUG=397359
TEST=On Linux, you should be able to drag your mouse at least 130 px away from the scrollbar before it snaps back.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285478 0039d316-1c4b-4281-b951-d872f2087c98
parent 1c904c2a
......@@ -31,11 +31,17 @@ bool WebScrollbarBehaviorImpl::shouldSnapBackToDragOrigin(
// guessing/extrapolation.
static const int kOffEndMultiplier = 3;
static const int kOffSideMultiplier = 8;
static const int kDefaultWinScrollbarThickness = 17;
// Find the rect within which we shouldn't snap, by expanding the track rect
// in both dimensions.
gfx::Rect noSnapRect(scrollbarRect);
const int thickness = isHorizontal ? noSnapRect.height() : noSnapRect.width();
int thickness = isHorizontal ? noSnapRect.height() : noSnapRect.width();
// Even if the platform's scrollbar is narrower than the default Windows one,
// we still want to provide at least as much slop area, since a slightly
// narrower scrollbar doesn't necessarily imply that users will drag
// straighter.
thickness = std::max(thickness, kDefaultWinScrollbarThickness);
noSnapRect.Inset(
(isHorizontal ? kOffEndMultiplier : kOffSideMultiplier) * -thickness,
(isHorizontal ? kOffSideMultiplier : kOffEndMultiplier) * -thickness);
......
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