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

Unified Diff: third_party/WebKit/Source/platform/scroll/Scrollbar.cpp

Issue 2539283002: Remove PlatformGestureEvent in favour of using WebGestureEvent (Closed)
Patch Set: Add missing copyright on new file Created 4 years 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: 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 a50f1a0593a3824166d8b6404b2e7eeab40ce59e..37326e0236918e03408f77fc59bd4ff45105bf1b 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/PlatformGestureEvent.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"
namespace blink {
@@ -320,25 +320,27 @@ void Scrollbar::setPressedPart(ScrollbarPart part) {
m_pressedPart = part;
}
-bool Scrollbar::gestureEvent(const PlatformGestureEvent& evt,
+bool Scrollbar::gestureEvent(const WebGestureEvent& evt,
bool* shouldUpdateCapture) {
DCHECK(shouldUpdateCapture);
- switch (evt.type()) {
- case PlatformEvent::GestureTapDown:
- setPressedPart(theme().hitTest(*this, evt.position()));
+ switch (evt.type) {
+ case WebInputEvent::GestureTapDown: {
+ IntPoint position = flooredIntPoint(evt.positionInRootFrame());
+ setPressedPart(theme().hitTest(*this, position));
m_pressedPos = orientation() == HorizontalScrollbar
- ? convertFromRootFrame(evt.position()).x()
- : convertFromRootFrame(evt.position()).y();
+ ? convertFromRootFrame(position).x()
+ : convertFromRootFrame(position).y();
*shouldUpdateCapture = true;
return true;
- case PlatformEvent::GestureTapDownCancel:
+ }
+ case WebInputEvent::GestureTapCancel:
if (m_pressedPart != ThumbPart)
return false;
m_scrollPos = m_pressedPos;
return true;
- case PlatformEvent::GestureScrollBegin:
- switch (evt.source()) {
- case PlatformGestureSourceTouchpad:
+ case WebInputEvent::GestureScrollBegin:
+ switch (evt.sourceDevice) {
+ case WebGestureDeviceTouchpad:
// Update the state on GSB for touchpad since GestureTapDown
// is not generated by that device. Touchscreen uses the tap down
// gesture since the scrollbar enters a visual active state.
@@ -346,7 +348,7 @@ bool Scrollbar::gestureEvent(const PlatformGestureEvent& evt,
setPressedPart(NoPart);
m_pressedPos = 0;
return true;
- case PlatformGestureSourceTouchscreen:
+ case WebGestureDeviceTouchscreen:
if (m_pressedPart != ThumbPart)
return false;
m_scrollPos = m_pressedPos;
@@ -356,22 +358,25 @@ bool Scrollbar::gestureEvent(const PlatformGestureEvent& evt,
return true;
}
break;
- case PlatformEvent::GestureScrollUpdate:
- switch (evt.source()) {
- case PlatformGestureSourceTouchpad: {
- FloatSize delta(-evt.deltaX(), -evt.deltaY());
+ case WebInputEvent::GestureScrollUpdate:
+ switch (evt.sourceDevice) {
+ case WebGestureDeviceTouchpad: {
+ FloatSize delta(-evt.deltaXInRootFrame(), -evt.deltaYInRootFrame());
if (m_scrollableArea &&
- m_scrollableArea->userScroll(evt.deltaUnits(), delta)
+ m_scrollableArea
+ ->userScroll(toPlatformScrollGranularity(evt.deltaUnits()),
+ delta)
.didScroll()) {
return true;
}
return false;
}
- case PlatformGestureSourceTouchscreen:
+ case WebGestureDeviceTouchscreen:
if (m_pressedPart != ThumbPart)
return false;
- m_scrollPos += orientation() == HorizontalScrollbar ? evt.deltaX()
- : evt.deltaY();
+ m_scrollPos += orientation() == HorizontalScrollbar
+ ? evt.deltaXInRootFrame()
+ : evt.deltaYInRootFrame();
moveThumb(m_scrollPos, false);
return true;
default:
@@ -379,14 +384,14 @@ bool Scrollbar::gestureEvent(const PlatformGestureEvent& evt,
return true;
}
break;
- case PlatformEvent::GestureScrollEnd:
- case PlatformEvent::GestureLongPress:
- case PlatformEvent::GestureFlingStart:
+ case WebInputEvent::GestureScrollEnd:
+ case WebInputEvent::GestureLongPress:
+ case WebInputEvent::GestureFlingStart:
m_scrollPos = 0;
m_pressedPos = 0;
setPressedPart(NoPart);
return false;
- case PlatformEvent::GestureTap: {
+ case WebInputEvent::GestureTap: {
if (m_pressedPart != ThumbPart && m_pressedPart != NoPart &&
m_scrollableArea &&
m_scrollableArea
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/Scrollbar.h ('k') | third_party/WebKit/Source/web/DevToolsEmulator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698