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

Unified Diff: content/browser/android/content_view_core_impl.cc

Issue 2708613002: Add EventForwarder for routing touch events (Closed)
Patch Set: unittests Created 3 years, 10 months 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: 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 af72e451a617ce1cbfe6d739c5faa76380ad67c7..2701fef331a4b203c563718cc240079682b79aa4 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -871,78 +871,6 @@ void ContentViewCoreImpl::SendOrientationChangeEvent(
}
}
-jboolean ContentViewCoreImpl::OnTouchEvent(
- JNIEnv* env,
- const JavaParamRef<jobject>& obj,
- const JavaParamRef<jobject>& motion_event,
- jlong time_ms,
- jint android_action,
- jint pointer_count,
- jint history_size,
- jint action_index,
- jfloat pos_x_0,
- jfloat pos_y_0,
- jfloat pos_x_1,
- jfloat pos_y_1,
- jint pointer_id_0,
- jint pointer_id_1,
- jfloat touch_major_0,
- jfloat touch_major_1,
- jfloat touch_minor_0,
- jfloat touch_minor_1,
- jfloat orientation_0,
- jfloat orientation_1,
- jfloat tilt_0,
- jfloat tilt_1,
- jfloat raw_pos_x,
- jfloat raw_pos_y,
- jint android_tool_type_0,
- jint android_tool_type_1,
- jint android_button_state,
- jint android_meta_state,
- jboolean is_touch_handle_event) {
- RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
- // Avoid synthesizing a touch event if it cannot be forwarded.
- if (!rwhv)
- return false;
-
- MotionEventAndroid::Pointer pointer0(pointer_id_0,
- pos_x_0,
- pos_y_0,
- touch_major_0,
- touch_minor_0,
- orientation_0,
- tilt_0,
- android_tool_type_0);
- MotionEventAndroid::Pointer pointer1(pointer_id_1,
- pos_x_1,
- pos_y_1,
- touch_major_1,
- touch_minor_1,
- orientation_1,
- tilt_1,
- android_tool_type_1);
- MotionEventAndroid event(1.f / dpi_scale(),
- env,
- motion_event,
- time_ms,
- android_action,
- pointer_count,
- history_size,
- action_index,
- android_button_state,
- android_meta_state,
- raw_pos_x - pos_x_0,
- raw_pos_y - pos_y_0,
- &pointer0,
- &pointer1);
-
- RecordToolTypeForActionDown(event);
-
- return is_touch_handle_event ? rwhv->OnTouchHandleEvent(event)
- : rwhv->OnTouchEvent(event);
-}
-
jboolean ContentViewCoreImpl::SendMouseEvent(JNIEnv* env,
boliu 2017/03/02 20:58:14 can be deleted as well?
Jinsuk Kim 2017/03/03 06:29:21 Done.
const JavaParamRef<jobject>& obj,
jlong time_ms,
@@ -968,20 +896,11 @@ jboolean ContentViewCoreImpl::SendMouseEvent(JNIEnv* env,
pointer_id, x, y, 0.0f /* touch_major */, 0.0f /* touch_minor */,
orientation, tilt, android_tool_type);
- MotionEventAndroid motion_event(1.f / dpi_scale(),
- env,
- nullptr /* event */,
- time_ms,
- android_action,
- 1 /* pointer_count */,
- 0 /* history_size */,
- 0 /* action_index */,
- android_button_state,
- android_meta_state,
- 0 /* raw_offset_x_pixels */,
- 0 /* raw_offset_y_pixels */,
- &pointer0,
- nullptr);
+ MotionEventAndroid motion_event(
+ 1.f / dpi_scale(), env, nullptr /* event */, time_ms, android_action,
+ 1 /* pointer_count */, 0 /* history_size */, 0 /* action_index */,
+ android_button_state, android_meta_state, 0 /* raw_offset_x_pixels */,
+ 0 /* raw_offset_y_pixels */, &pointer0, nullptr);
RecordToolTypeForActionDown(motion_event);
@@ -1501,6 +1420,7 @@ jlong Init(JNIEnv* env,
"A ContentViewCoreImpl should be created with a valid WebContents.";
ui::ViewAndroid* view_android = web_contents->GetView()->GetNativeView();
view_android->SetDelegate(jview_android_delegate);
+ view_android->SetLayout(0, 0, 0, 0, true);
boliu 2017/03/02 20:58:14 /* match parent */
Jinsuk Kim 2017/03/03 06:29:21 Done.
ui::WindowAndroid* window_android =
reinterpret_cast<ui::WindowAndroid*>(jwindow_android);

Powered by Google App Engine
This is Rietveld 408576698