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

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: 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
« no previous file with comments | « no previous file | content/browser/renderer_host/input/motion_event_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 } 359 }
360 } 360 }
361 } 361 }
362 362
363 void ContentViewCoreImpl::RenderViewReady() { 363 void ContentViewCoreImpl::RenderViewReady() {
364 if (device_orientation_ != 0) 364 if (device_orientation_ != 0)
365 SendOrientationChangeEventInternal(); 365 SendOrientationChangeEventInternal();
366 } 366 }
367 367
368 void ContentViewCoreImpl::OnGestureEvent(const ui::GestureEventData& gesture) { 368 void ContentViewCoreImpl::OnGestureEvent(const ui::GestureEventData& gesture) {
369 SendGestureEvent( 369 SendGestureEvent(CreateWebGestureEventFromGestureEventData(gesture));
370 CreateWebGestureEventFromGestureEventData(gesture, 1.f / dpi_scale()));
371 } 370 }
372 371
373 RenderWidgetHostViewAndroid* 372 RenderWidgetHostViewAndroid*
374 ContentViewCoreImpl::GetRenderWidgetHostViewAndroid() { 373 ContentViewCoreImpl::GetRenderWidgetHostViewAndroid() {
375 RenderWidgetHostView* rwhv = NULL; 374 RenderWidgetHostView* rwhv = NULL;
376 if (web_contents_) { 375 if (web_contents_) {
377 rwhv = web_contents_->GetRenderWidgetHostView(); 376 rwhv = web_contents_->GetRenderWidgetHostView();
378 if (web_contents_->ShowingInterstitialPage()) { 377 if (web_contents_->ShowingInterstitialPage()) {
379 rwhv = static_cast<InterstitialPageImpl*>( 378 rwhv = static_cast<InterstitialPageImpl*>(
380 web_contents_->GetInterstitialPage())-> 379 web_contents_->GetInterstitialPage())->
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 jfloat pos_y_1, 1048 jfloat pos_y_1,
1050 jint pointer_id_0, 1049 jint pointer_id_0,
1051 jint pointer_id_1, 1050 jint pointer_id_1,
1052 jfloat touch_major_0, 1051 jfloat touch_major_0,
1053 jfloat touch_major_1) { 1052 jfloat touch_major_1) {
1054 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); 1053 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
1055 // Avoid synthesizing a touch event if it cannot be forwarded. 1054 // Avoid synthesizing a touch event if it cannot be forwarded.
1056 if (!rwhv) 1055 if (!rwhv)
1057 return false; 1056 return false;
1058 1057
1059 MotionEventAndroid event(env, 1058 MotionEventAndroid event(1.f / dpi_scale(),
1059 env,
1060 motion_event, 1060 motion_event,
1061 time_ms, 1061 time_ms,
1062 android_action, 1062 android_action,
1063 pointer_count, 1063 pointer_count,
1064 history_size, 1064 history_size,
1065 action_index, 1065 action_index,
1066 pos_x_0, 1066 pos_x_0,
1067 pos_y_0, 1067 pos_y_0,
1068 pos_x_1, 1068 pos_x_1,
1069 pos_y_1, 1069 pos_y_1,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 if (!gesture_provider_.OnTouchEvent(event)) 1136 if (!gesture_provider_.OnTouchEvent(event))
1137 return false; 1137 return false;
1138 1138
1139 RenderWidgetHostImpl* host = RenderWidgetHostImpl::From( 1139 RenderWidgetHostImpl* host = RenderWidgetHostImpl::From(
1140 rwhv->GetRenderWidgetHost()); 1140 rwhv->GetRenderWidgetHost());
1141 if (!host->ShouldForwardTouchEvent()) { 1141 if (!host->ShouldForwardTouchEvent()) {
1142 ConfirmTouchEvent(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); 1142 ConfirmTouchEvent(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS);
1143 return true; 1143 return true;
1144 } 1144 }
1145 1145
1146 rwhv->SendTouchEvent( 1146 rwhv->SendTouchEvent(CreateWebTouchEventFromMotionEvent(event));
1147 CreateWebTouchEventFromMotionEvent(event, 1.f / dpi_scale()));
1148 return true; 1147 return true;
1149 } 1148 }
1150 1149
1151 void ContentViewCoreImpl::SendGestureEvent( 1150 void ContentViewCoreImpl::SendGestureEvent(
1152 const blink::WebGestureEvent& event) { 1151 const blink::WebGestureEvent& event) {
1153 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); 1152 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
1154 if (rwhv) 1153 if (rwhv)
1155 rwhv->SendGestureEvent(event); 1154 rwhv->SendGestureEvent(event);
1156 } 1155 }
1157 1156
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1798 reinterpret_cast<ui::ViewAndroid*>(view_android), 1797 reinterpret_cast<ui::ViewAndroid*>(view_android),
1799 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1798 reinterpret_cast<ui::WindowAndroid*>(window_android));
1800 return reinterpret_cast<intptr_t>(view); 1799 return reinterpret_cast<intptr_t>(view);
1801 } 1800 }
1802 1801
1803 bool RegisterContentViewCore(JNIEnv* env) { 1802 bool RegisterContentViewCore(JNIEnv* env) {
1804 return RegisterNativesImpl(env); 1803 return RegisterNativesImpl(env);
1805 } 1804 }
1806 1805
1807 } // namespace content 1806 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/motion_event_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698