Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1123)

Unified Diff: content/renderer/webscrollbarbehavior_impl_aura.cc

Issue 2489083002: Revert of Disable scrollbar snapback on desktop Linux (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/webscrollbarbehavior_impl_aura.cc
diff --git a/content/renderer/webscrollbarbehavior_impl_aura.cc b/content/renderer/webscrollbarbehavior_impl_aura.cc
deleted file mode 100644
index 902a0e8862544d20618ed5347a9ad072177bb2ea..0000000000000000000000000000000000000000
--- a/content/renderer/webscrollbarbehavior_impl_aura.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/renderer/webscrollbarbehavior_impl_aura.h"
-
-#include "build/build_config.h"
-#include "third_party/WebKit/public/platform/WebPoint.h"
-#include "third_party/WebKit/public/platform/WebRect.h"
-
-namespace content {
-
-bool WebScrollbarBehaviorImpl::shouldCenterOnThumb(
- blink::WebPointerProperties::Button mouseButton,
- bool shiftKeyPressed,
- bool altKeyPressed) {
-#if (defined(OS_LINUX) && !defined(OS_CHROMEOS))
- if (mouseButton == blink::WebPointerProperties::Button::Middle)
- return true;
-#endif
- return (mouseButton == blink::WebPointerProperties::Button::Left) &&
- shiftKeyPressed;
-}
-
-bool WebScrollbarBehaviorImpl::shouldSnapBackToDragOrigin(
- const blink::WebPoint& eventPoint,
- const blink::WebRect& scrollbarRect,
- bool isHorizontal) {
-// Disable snapback on desktop Linux to better integrate with the desktop
-// behavior. Typically, Linux apps do not implement scrollbar snapback (this is
-// true for at least GTK and QT apps).
-#if (defined(OS_LINUX) && !defined(OS_CHROMEOS))
- return false;
-#endif
-
- // Constants used to figure the drag rect outside which we should snap the
- // scrollbar thumb back to its origin. These calculations are based on
- // observing the behavior of the MSVC8 main window scrollbar + some
- // 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);
- 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);
-
- return !noSnapRect.Contains(eventPoint);
-}
-
-} // namespace content
« no previous file with comments | « content/renderer/webscrollbarbehavior_impl_aura.h ('k') | content/renderer/webscrollbarbehavior_impl_gtkoraura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698