This source file includes following definitions.
- shouldCenterOnThumb
- shouldSnapBackToDragOrigin
#include "content/renderer/webscrollbarbehavior_impl_gtkoraura.h"
#include "third_party/WebKit/public/platform/WebPoint.h"
#include "third_party/WebKit/public/platform/WebRect.h"
namespace content {
bool WebScrollbarBehaviorImpl::shouldCenterOnThumb(
blink::WebScrollbarBehavior::Button mouseButton,
bool shiftKeyPressed,
bool altKeyPressed) {
#if defined(TOOLKIT_GTK) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
if (mouseButton == blink::WebScrollbarBehavior::ButtonMiddle)
return true;
#endif
return (mouseButton == blink::WebScrollbarBehavior::ButtonLeft) &&
shiftKeyPressed;
}
bool WebScrollbarBehaviorImpl::shouldSnapBackToDragOrigin(
const blink::WebPoint& eventPoint,
const blink::WebRect& scrollbarRect,
bool isHorizontal) {
#if defined(TOOLKIT_GTK)
return false;
#endif
static const int kOffEndMultiplier = 3;
static const int kOffSideMultiplier = 8;
gfx::Rect noSnapRect(scrollbarRect);
const int thickness = isHorizontal ? noSnapRect.height() : noSnapRect.width();
noSnapRect.Inset(
(isHorizontal ? kOffEndMultiplier : kOffSideMultiplier) * -thickness,
(isHorizontal ? kOffSideMultiplier : kOffEndMultiplier) * -thickness);
return !noSnapRect.Contains(eventPoint);
}