| Index: content/browser/android/content_view_core_impl.cc
|
| diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
|
| index 2335d0a5fb05b9ca4df9420b4bb70bf60b3a5609..dfad0a922b69077608fd27cfff9b35761b260b1e 100644
|
| --- a/content/browser/android/content_view_core_impl.cc
|
| +++ b/content/browser/android/content_view_core_impl.cc
|
| @@ -55,6 +55,7 @@
|
| #include "third_party/WebKit/public/web/WebInputEvent.h"
|
| #include "ui/base/android/view_android.h"
|
| #include "ui/base/android/window_android.h"
|
| +#include "ui/events/gesture_detection/motion_event.h"
|
| #include "ui/gfx/android/java_bitmap.h"
|
| #include "ui/gfx/screen.h"
|
| #include "ui/gfx/size_conversions.h"
|
| @@ -69,6 +70,7 @@ using base::android::ScopedJavaGlobalRef;
|
| using base::android::ScopedJavaLocalRef;
|
| using blink::WebGestureEvent;
|
| using blink::WebInputEvent;
|
| +using blink::WebMouseEvent;
|
|
|
| // Describes the type and enabled state of a select popup item.
|
| namespace {
|
| @@ -222,7 +224,9 @@ ContentViewCoreImpl::ContentViewCoreImpl(
|
| view_android_(view_android),
|
| window_android_(window_android),
|
| device_orientation_(0),
|
| - accessibility_enabled_(false) {
|
| + accessibility_enabled_(false),
|
| + mouse_drag_start_x_(0),
|
| + mouse_drag_start_y_(0) {
|
| CHECK(web_contents) <<
|
| "A ContentViewCoreImpl should be created with a valid WebContents.";
|
|
|
| @@ -946,7 +950,9 @@ jboolean ContentViewCoreImpl::OnTouchEvent(JNIEnv* env,
|
| jfloat touch_major_0,
|
| jfloat touch_major_1,
|
| jfloat raw_pos_x,
|
| - jfloat raw_pos_y) {
|
| + jfloat raw_pos_y,
|
| + jint android_tool_type,
|
| + jint android_button_state) {
|
| RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
|
| // Avoid synthesizing a touch event if it cannot be forwarded.
|
| if (!rwhv)
|
| @@ -971,6 +977,20 @@ jboolean ContentViewCoreImpl::OnTouchEvent(JNIEnv* env,
|
| raw_pos_x,
|
| raw_pos_y);
|
|
|
| + switch (event.GetAction()) {
|
| + case ui::MotionEvent::ACTION_DOWN:
|
| + mouse_drag_start_x_ = pos_x_0;
|
| + mouse_drag_start_y_ = pos_y_0;
|
| + break;
|
| + case ui::MotionEvent::ACTION_MOVE:
|
| + case ui::MotionEvent::ACTION_UP:
|
| + SelectBetweenCoordinates(env, obj, mouse_drag_start_x_,
|
| + mouse_drag_start_y_, pos_x_0, pos_y_0);
|
| + break;
|
| + default:
|
| + break;
|
| + }
|
| +
|
| return rwhv->OnTouchEvent(event);
|
| }
|
|
|
| @@ -989,7 +1009,7 @@ jboolean ContentViewCoreImpl::SendMouseMoveEvent(JNIEnv* env,
|
|
|
| blink::WebMouseEvent event = WebMouseEventBuilder::Build(
|
| WebInputEvent::MouseMove,
|
| - blink::WebMouseEvent::ButtonNone,
|
| + WebMouseEvent::ButtonNone,
|
| time_ms / 1000.0, x / dpi_scale(), y / dpi_scale(), 0, 1);
|
|
|
| rwhv->SendMouseEvent(event);
|
|
|