Index: third_party/WebKit/Source/platform/scroll/Scrollbar.cpp |
diff --git a/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp b/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp |
index 442518dddee6974852613a46f01171f49f61776f..cd3b8accdf87d83d729df5b254c1f40767f9021c 100644 |
--- a/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp |
+++ b/third_party/WebKit/Source/platform/scroll/Scrollbar.cpp |
@@ -27,13 +27,13 @@ |
#include <algorithm> |
#include "platform/HostWindow.h" |
-#include "platform/PlatformMouseEvent.h" |
#include "platform/geometry/FloatRect.h" |
#include "platform/graphics/paint/CullRect.h" |
#include "platform/scroll/ScrollAnimatorBase.h" |
#include "platform/scroll/ScrollableArea.h" |
#include "platform/scroll/ScrollbarTheme.h" |
#include "public/platform/WebGestureEvent.h" |
+#include "public/platform/WebMouseEvent.h" |
namespace blink { |
@@ -418,7 +418,8 @@ bool Scrollbar::gestureEvent(const WebGestureEvent& evt, |
} |
} |
-void Scrollbar::mouseMoved(const PlatformMouseEvent& evt) { |
+void Scrollbar::mouseMoved(const WebMouseEvent& evt) { |
+ IntPoint position = flooredIntPoint(evt.positionInRootFrame()); |
if (m_pressedPart == ThumbPart) { |
if (theme().shouldSnapBackToDragOrigin(*this, evt)) { |
if (m_scrollableArea) { |
@@ -429,19 +430,20 @@ void Scrollbar::mouseMoved(const PlatformMouseEvent& evt) { |
} |
} else { |
moveThumb(m_orientation == HorizontalScrollbar |
- ? convertFromRootFrame(evt.position()).x() |
- : convertFromRootFrame(evt.position()).y(), |
+ ? convertFromRootFrame(position).x() |
+ : convertFromRootFrame(position).y(), |
theme().shouldDragDocumentInsteadOfThumb(*this, evt)); |
} |
return; |
} |
- if (m_pressedPart != NoPart) |
+ if (m_pressedPart != NoPart) { |
m_pressedPos = orientation() == HorizontalScrollbar |
- ? convertFromRootFrame(evt.position()).x() |
- : convertFromRootFrame(evt.position()).y(); |
+ ? convertFromRootFrame(position).x() |
+ : convertFromRootFrame(position).y(); |
+ } |
- ScrollbarPart part = theme().hitTest(*this, evt.position()); |
+ ScrollbarPart part = theme().hitTest(*this, position); |
if (part != m_hoveredPart) { |
if (m_pressedPart != NoPart) { |
if (part == m_pressedPart) { |
@@ -472,7 +474,7 @@ void Scrollbar::mouseExited() { |
setHoveredPart(NoPart); |
} |
-void Scrollbar::mouseUp(const PlatformMouseEvent& mouseEvent) { |
+void Scrollbar::mouseUp(const WebMouseEvent& mouseEvent) { |
bool isCaptured = m_pressedPart == ThumbPart; |
setPressedPart(NoPart); |
m_pressedPos = 0; |
@@ -483,7 +485,8 @@ void Scrollbar::mouseUp(const PlatformMouseEvent& mouseEvent) { |
if (isCaptured) |
m_scrollableArea->mouseReleasedScrollbar(); |
- ScrollbarPart part = theme().hitTest(*this, mouseEvent.position()); |
+ ScrollbarPart part = theme().hitTest( |
+ *this, flooredIntPoint(mouseEvent.positionInRootFrame())); |
if (part == NoPart) { |
setHoveredPart(NoPart); |
m_scrollableArea->mouseExitedScrollbar(*this); |
@@ -491,15 +494,16 @@ void Scrollbar::mouseUp(const PlatformMouseEvent& mouseEvent) { |
} |
} |
-void Scrollbar::mouseDown(const PlatformMouseEvent& evt) { |
+void Scrollbar::mouseDown(const WebMouseEvent& evt) { |
// Early exit for right click |
- if (evt.pointerProperties().button == WebPointerProperties::Button::Right) |
+ if (evt.button == WebPointerProperties::Button::Right) |
return; |
- setPressedPart(theme().hitTest(*this, evt.position())); |
+ IntPoint position = flooredIntPoint(evt.positionInRootFrame()); |
+ setPressedPart(theme().hitTest(*this, position)); |
int pressedPos = orientation() == HorizontalScrollbar |
- ? convertFromRootFrame(evt.position()).x() |
- : convertFromRootFrame(evt.position()).y(); |
+ ? convertFromRootFrame(position).x() |
+ : convertFromRootFrame(position).y(); |
if ((m_pressedPart == BackTrackPart || m_pressedPart == ForwardTrackPart) && |
theme().shouldCenterOnThumb(*this, evt)) { |