Commit 8322d894 authored by lanwei's avatar lanwei Committed by Commit bot

Allow Mousewheell on Chrome Android to scroll horizontally

We added the horizontal_axis value to the SendMouseWheelEvent method, so that
the mousewheel event now can scroll vertically and horizontally.

BUG=435154

Review URL: https://codereview.chromium.org/792333004

Cr-Commit-Position: refs/heads/master@{#307998}
parent 0438c513
...@@ -954,7 +954,8 @@ jboolean ContentViewCoreImpl::SendMouseWheelEvent(JNIEnv* env, ...@@ -954,7 +954,8 @@ jboolean ContentViewCoreImpl::SendMouseWheelEvent(JNIEnv* env,
jlong time_ms, jlong time_ms,
jfloat x, jfloat x,
jfloat y, jfloat y,
jfloat vertical_axis) { jfloat vertical_axis,
jfloat horizontal_axis) {
RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
if (!rwhv) if (!rwhv)
return false; return false;
...@@ -964,6 +965,10 @@ jboolean ContentViewCoreImpl::SendMouseWheelEvent(JNIEnv* env, ...@@ -964,6 +965,10 @@ jboolean ContentViewCoreImpl::SendMouseWheelEvent(JNIEnv* env,
direction = WebMouseWheelEventBuilder::DIRECTION_UP; direction = WebMouseWheelEventBuilder::DIRECTION_UP;
} else if (vertical_axis < 0) { } else if (vertical_axis < 0) {
direction = WebMouseWheelEventBuilder::DIRECTION_DOWN; direction = WebMouseWheelEventBuilder::DIRECTION_DOWN;
} else if (horizontal_axis > 0) {
direction = WebMouseWheelEventBuilder::DIRECTION_RIGHT;
} else if (horizontal_axis < 0) {
direction = WebMouseWheelEventBuilder::DIRECTION_LEFT;
} else { } else {
return false; return false;
} }
......
...@@ -119,7 +119,8 @@ class ContentViewCoreImpl : public ContentViewCore, ...@@ -119,7 +119,8 @@ class ContentViewCoreImpl : public ContentViewCore,
jlong time_ms, jlong time_ms,
jfloat x, jfloat x,
jfloat y, jfloat y,
jfloat vertical_axis); jfloat vertical_axis,
jfloat horizontal_axis);
void ScrollBegin(JNIEnv* env, jobject obj, jlong time_ms, void ScrollBegin(JNIEnv* env, jobject obj, jlong time_ms,
jfloat x, jfloat y, jfloat hintx, jfloat hinty); jfloat x, jfloat y, jfloat hintx, jfloat hinty);
void ScrollEnd(JNIEnv* env, jobject obj, jlong time_ms); void ScrollEnd(JNIEnv* env, jobject obj, jlong time_ms);
......
...@@ -1674,7 +1674,8 @@ public class ContentViewCore ...@@ -1674,7 +1674,8 @@ public class ContentViewCore
nativeSendMouseWheelEvent(mNativeContentViewCore, event.getEventTime(), nativeSendMouseWheelEvent(mNativeContentViewCore, event.getEventTime(),
event.getX(), event.getY(), event.getX(), event.getY(),
event.getAxisValue(MotionEvent.AXIS_VSCROLL)); event.getAxisValue(MotionEvent.AXIS_VSCROLL),
event.getAxisValue(MotionEvent.AXIS_HSCROLL));
mContainerView.removeCallbacks(mFakeMouseMoveRunnable); mContainerView.removeCallbacks(mFakeMouseMoveRunnable);
// Send a delayed onMouseMove event so that we end // Send a delayed onMouseMove event so that we end
...@@ -3036,7 +3037,8 @@ public class ContentViewCore ...@@ -3036,7 +3037,8 @@ public class ContentViewCore
long nativeContentViewCoreImpl, long timeMs, float x, float y); long nativeContentViewCoreImpl, long timeMs, float x, float y);
private native int nativeSendMouseWheelEvent( private native int nativeSendMouseWheelEvent(
long nativeContentViewCoreImpl, long timeMs, float x, float y, float verticalAxis); long nativeContentViewCoreImpl, long timeMs, float x, float y, float verticalAxis,
float horizontalAxis);
private native void nativeScrollBegin( private native void nativeScrollBegin(
long nativeContentViewCoreImpl, long timeMs, float x, float y, float hintX, long nativeContentViewCoreImpl, long timeMs, float x, float y, float hintX,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment