Index: third_party/WebKit/Source/platform/scroll/ScrollTypes.h |
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollTypes.h b/third_party/WebKit/Source/platform/scroll/ScrollTypes.h |
index 32f9ff2de0afa1bb19faec67be084cea8067ffb6..32d22c8071fd1e62bd29df498131f24396e2de42 100644 |
--- a/third_party/WebKit/Source/platform/scroll/ScrollTypes.h |
+++ b/third_party/WebKit/Source/platform/scroll/ScrollTypes.h |
@@ -27,6 +27,7 @@ |
#define ScrollTypes_h |
#include "platform/geometry/FloatPoint.h" |
+#include "public/platform/WebGestureEvent.h" |
#include "wtf/Assertions.h" |
namespace blink { |
@@ -249,6 +250,21 @@ inline ScrollOffset toScrollDelta(ScrollDirectionPhysical dir, float delta) { |
: ScrollOffset(0, delta); |
} |
+inline ScrollGranularity toPlatformScrollGranularity( |
+ WebGestureEvent::ScrollUnits units) { |
+ switch (units) { |
+ case WebGestureEvent::ScrollUnits::PrecisePixels: |
+ return ScrollGranularity::ScrollByPrecisePixel; |
+ case WebGestureEvent::ScrollUnits::Pixels: |
+ return ScrollGranularity::ScrollByPixel; |
+ case WebGestureEvent::ScrollUnits::Page: |
+ return ScrollGranularity::ScrollByPage; |
+ default: |
+ NOTREACHED(); |
+ return ScrollGranularity::ScrollByPrecisePixel; |
+ } |
+} |
+ |
typedef unsigned ScrollbarControlPartMask; |
} // namespace blink |