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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 220063002: [Android] Use DIP coordinates with MotionEventAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes Created 6 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 } 362 }
363 } 363 }
364 } 364 }
365 365
366 void ContentViewCoreImpl::RenderViewReady() { 366 void ContentViewCoreImpl::RenderViewReady() {
367 if (device_orientation_ != 0) 367 if (device_orientation_ != 0)
368 SendOrientationChangeEventInternal(); 368 SendOrientationChangeEventInternal();
369 } 369 }
370 370
371 void ContentViewCoreImpl::OnGestureEvent(const ui::GestureEventData& gesture) { 371 void ContentViewCoreImpl::OnGestureEvent(const ui::GestureEventData& gesture) {
372 SendGestureEvent( 372 SendGestureEvent(CreateWebGestureEventFromGestureEventData(gesture));
373 CreateWebGestureEventFromGestureEventData(gesture, 1.f / dpi_scale()));
374 } 373 }
375 374
376 RenderWidgetHostViewAndroid* 375 RenderWidgetHostViewAndroid*
377 ContentViewCoreImpl::GetRenderWidgetHostViewAndroid() { 376 ContentViewCoreImpl::GetRenderWidgetHostViewAndroid() {
378 RenderWidgetHostView* rwhv = NULL; 377 RenderWidgetHostView* rwhv = NULL;
379 if (web_contents_) { 378 if (web_contents_) {
380 rwhv = web_contents_->GetRenderWidgetHostView(); 379 rwhv = web_contents_->GetRenderWidgetHostView();
381 if (web_contents_->ShowingInterstitialPage()) { 380 if (web_contents_->ShowingInterstitialPage()) {
382 rwhv = static_cast<InterstitialPageImpl*>( 381 rwhv = static_cast<InterstitialPageImpl*>(
383 web_contents_->GetInterstitialPage())-> 382 web_contents_->GetInterstitialPage())->
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 jfloat pos_y_1, 1044 jfloat pos_y_1,
1046 jint pointer_id_0, 1045 jint pointer_id_0,
1047 jint pointer_id_1, 1046 jint pointer_id_1,
1048 jfloat touch_major_0, 1047 jfloat touch_major_0,
1049 jfloat touch_major_1) { 1048 jfloat touch_major_1) {
1050 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); 1049 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
1051 // Avoid synthesizing a touch event if it cannot be forwarded. 1050 // Avoid synthesizing a touch event if it cannot be forwarded.
1052 if (!rwhv) 1051 if (!rwhv)
1053 return false; 1052 return false;
1054 1053
1055 MotionEventAndroid event(env, 1054 MotionEventAndroid event(1.f / dpi_scale(),
1055 env,
1056 motion_event, 1056 motion_event,
1057 time_ms, 1057 time_ms,
1058 android_action, 1058 android_action,
1059 pointer_count, 1059 pointer_count,
1060 history_size, 1060 history_size,
1061 action_index, 1061 action_index,
1062 pos_x_0, 1062 pos_x_0,
1063 pos_y_0, 1063 pos_y_0,
1064 pos_x_1, 1064 pos_x_1,
1065 pos_y_1, 1065 pos_y_1,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 if (!gesture_provider_.OnTouchEvent(event)) 1132 if (!gesture_provider_.OnTouchEvent(event))
1133 return false; 1133 return false;
1134 1134
1135 RenderWidgetHostImpl* host = RenderWidgetHostImpl::From( 1135 RenderWidgetHostImpl* host = RenderWidgetHostImpl::From(
1136 rwhv->GetRenderWidgetHost()); 1136 rwhv->GetRenderWidgetHost());
1137 if (!host->ShouldForwardTouchEvent()) { 1137 if (!host->ShouldForwardTouchEvent()) {
1138 ConfirmTouchEvent(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); 1138 ConfirmTouchEvent(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS);
1139 return true; 1139 return true;
1140 } 1140 }
1141 1141
1142 rwhv->SendTouchEvent( 1142 rwhv->SendTouchEvent(CreateWebTouchEventFromMotionEvent(event));
1143 CreateWebTouchEventFromMotionEvent(event, 1.f / dpi_scale()));
1144 return true; 1143 return true;
1145 } 1144 }
1146 1145
1147 void ContentViewCoreImpl::SendGestureEvent( 1146 void ContentViewCoreImpl::SendGestureEvent(
1148 const blink::WebGestureEvent& event) { 1147 const blink::WebGestureEvent& event) {
1149 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); 1148 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
1150 if (rwhv) 1149 if (rwhv)
1151 rwhv->SendGestureEvent(event); 1150 rwhv->SendGestureEvent(event);
1152 } 1151 }
1153 1152
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 reinterpret_cast<ui::ViewAndroid*>(view_android), 1793 reinterpret_cast<ui::ViewAndroid*>(view_android),
1795 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1794 reinterpret_cast<ui::WindowAndroid*>(window_android));
1796 return reinterpret_cast<intptr_t>(view); 1795 return reinterpret_cast<intptr_t>(view);
1797 } 1796 }
1798 1797
1799 bool RegisterContentViewCore(JNIEnv* env) { 1798 bool RegisterContentViewCore(JNIEnv* env) {
1800 return RegisterNativesImpl(env); 1799 return RegisterNativesImpl(env);
1801 } 1800 }
1802 1801
1803 } // namespace content 1802 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698