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

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

Issue 165393014: [Android] Always use pixels for gestures handled in ContentViewCore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 382db082ec38eaec66f344b737c010195ad0ca3a..795caa232b8c6a2c0e977b893504bb7bf9a633db 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -577,8 +577,10 @@ void ContentViewCoreImpl::OnGestureEventAck(const blink::WebGestureEvent& event,
switch (event.type) {
case WebInputEvent::GestureFlingStart:
if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) {
+ // The view expects the fling velocity in pixels/s.
Java_ContentViewCore_onFlingStartEventConsumed(env, j_obj.obj(),
- event.data.flingStart.velocityX, event.data.flingStart.velocityY);
+ event.data.flingStart.velocityX * GetDpiScale(),
+ event.data.flingStart.velocityY * GetDpiScale());
} else {
// If a scroll ends with a fling, a SCROLL_END event is never sent.
// However, if that fling went unconsumed, we still need to let the
@@ -587,8 +589,10 @@ void ContentViewCoreImpl::OnGestureEventAck(const blink::WebGestureEvent& event,
}
if (ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS) {
+ // The view expects the fling velocity in pixels/s.
Java_ContentViewCore_onFlingStartEventHadNoConsumer(env, j_obj.obj(),
- event.data.flingStart.velocityX, event.data.flingStart.velocityY);
+ event.data.flingStart.velocityX * GetDpiScale(),
+ event.data.flingStart.velocityY * GetDpiScale());
}
break;
case WebInputEvent::GestureFlingCancel:
@@ -636,8 +640,8 @@ bool ContentViewCoreImpl::FilterInputEvent(const blink::WebInputEvent& event) {
return Java_ContentViewCore_filterTapOrPressEvent(env,
j_obj.obj(),
gesture_type,
- gesture.x,
- gesture.y);
+ gesture.x * GetDpiScale(),
+ gesture.y * GetDpiScale());
}
bool ContentViewCoreImpl::HasFocus() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698