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

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

Issue 1053823002: [Android] Disable fling cancel filtering in the GestureEventQueue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup, working tests Created 5 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/gesture_event_queue.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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 break; 549 break;
550 default: 550 default:
551 break; 551 break;
552 } 552 }
553 } 553 }
554 554
555 bool ContentViewCoreImpl::FilterInputEvent(const blink::WebInputEvent& event) { 555 bool ContentViewCoreImpl::FilterInputEvent(const blink::WebInputEvent& event) {
556 if (event.type != WebInputEvent::GestureTap && 556 if (event.type != WebInputEvent::GestureTap &&
557 event.type != WebInputEvent::GestureDoubleTap && 557 event.type != WebInputEvent::GestureDoubleTap &&
558 event.type != WebInputEvent::GestureLongTap && 558 event.type != WebInputEvent::GestureLongTap &&
559 event.type != WebInputEvent::GestureLongPress) 559 event.type != WebInputEvent::GestureLongPress &&
560 event.type != WebInputEvent::GestureFlingCancel)
560 return false; 561 return false;
561 562
562 JNIEnv* env = AttachCurrentThread(); 563 JNIEnv* env = AttachCurrentThread();
563 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 564 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
564 if (j_obj.is_null()) 565 if (j_obj.is_null())
565 return false; 566 return false;
566 567
568 if (event.type == WebInputEvent::GestureFlingCancel) {
569 // If no fling is active, either in the compositor or externally-driven,
570 // there's no need to explicitly cancel the fling.
571 bool may_need_fling_cancel =
572 Java_ContentViewCore_isScrollInProgress(env, j_obj.obj());
573 return !may_need_fling_cancel;
574 }
575
567 const blink::WebGestureEvent& gesture = 576 const blink::WebGestureEvent& gesture =
568 static_cast<const blink::WebGestureEvent&>(event); 577 static_cast<const blink::WebGestureEvent&>(event);
569 int gesture_type = ToGestureEventType(event.type); 578 int gesture_type = ToGestureEventType(event.type);
570 return Java_ContentViewCore_filterTapOrPressEvent(env, 579 return Java_ContentViewCore_filterTapOrPressEvent(env,
571 j_obj.obj(), 580 j_obj.obj(),
572 gesture_type, 581 gesture_type,
573 gesture.x * dpi_scale(), 582 gesture.x * dpi_scale(),
574 gesture.y * dpi_scale()); 583 gesture.y * dpi_scale());
575 584
576 // TODO(jdduke): Also report double-tap UMA, crbug/347568. 585 // TODO(jdduke): Also report double-tap UMA, crbug/347568.
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 return NULL; 1397 return NULL;
1389 1398
1390 return view->GetJavaObject().Release(); 1399 return view->GetJavaObject().Release();
1391 } 1400 }
1392 1401
1393 bool RegisterContentViewCore(JNIEnv* env) { 1402 bool RegisterContentViewCore(JNIEnv* env) {
1394 return RegisterNativesImpl(env); 1403 return RegisterNativesImpl(env);
1395 } 1404 }
1396 1405
1397 } // namespace content 1406 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/gesture_event_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698