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

Unified Diff: content/browser/renderer_host/overscroll_controller.cc

Issue 11574047: overscroll: Send all gesture-events to the gesture-event filter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add a test. Created 8 years 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 | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/overscroll_controller.cc
diff --git a/content/browser/renderer_host/overscroll_controller.cc b/content/browser/renderer_host/overscroll_controller.cc
index 5c6691825d677f0f3031e3ea55cb376bba214444..8c946c79db7b2d3a5eeadb83d5ddf1ca4840575c 100644
--- a/content/browser/renderer_host/overscroll_controller.cc
+++ b/content/browser/renderer_host/overscroll_controller.cc
@@ -10,26 +10,6 @@
#include "content/public/browser/overscroll_configuration.h"
#include "content/public/browser/render_widget_host_view.h"
-namespace {
-
-// Some gesture events can also be triggered from the trackpad. This function
-// checks to see if |event| was generated from a touchscreen.
-bool IsGestureEventFromTouchscreen(const WebKit::WebInputEvent& event) {
- if (!WebKit::WebInputEvent::isGestureEventType(event.type))
- return false;
-
- if (event.type == WebKit::WebInputEvent::GestureFlingStart) {
- const WebKit::WebGestureEvent& gevent =
- static_cast<const WebKit::WebGestureEvent&>(event);
- return gevent.data.flingStart.sourceDevice ==
- WebKit::WebGestureEvent::Touchscreen;
- }
-
- return true;
-}
-
-}
-
namespace content {
OverscrollController::OverscrollController(
@@ -55,14 +35,11 @@ bool OverscrollController::WillDispatchEvent(
// example), and the event that completes this action needs to be sent to
// the renderer so that those states can be updated/reset appropriately.
// Send the event through the gesture-event filter when appropriate.
- if (IsGestureEventFromTouchscreen(event)) {
- if (ShouldForwardToGestureFilter(event)) {
- const WebKit::WebGestureEvent& gevent =
- static_cast<const WebKit::WebGestureEvent&>(event);
- return render_widget_host_->gesture_event_filter()->
- ShouldForward(gevent);
- }
- return true;
+ if (ShouldForwardToGestureFilter(event)) {
+ const WebKit::WebGestureEvent& gevent =
+ static_cast<const WebKit::WebGestureEvent&>(event);
+ return render_widget_host_->gesture_event_filter()->
+ ShouldForward(gevent);
}
return false;
@@ -71,10 +48,10 @@ bool OverscrollController::WillDispatchEvent(
if (overscroll_mode_ != OVERSCROLL_NONE && DispatchEventResetsState(event)) {
SetOverscrollMode(OVERSCROLL_NONE);
// The overscroll gesture status is being reset. If the event is a
- // touch-screen gesture event, then make sure the gesture event filter gets
- // the event first (if it didn't already process it).
- if (IsGestureEventFromTouchscreen(event) &&
- ShouldForwardToGestureFilter(event)) {
+ // gesture event (from either touchscreen or trackpad), then make sure the
+ // gesture event filter gets the event first (if it didn't already process
+ // it).
+ if (ShouldForwardToGestureFilter(event)) {
const WebKit::WebGestureEvent& gevent =
static_cast<const WebKit::WebGestureEvent&>(event);
return render_widget_host_->gesture_event_filter()->ShouldForward(gevent);
@@ -270,7 +247,8 @@ void OverscrollController::SetOverscrollMode(OverscrollMode mode) {
bool OverscrollController::ShouldForwardToGestureFilter(
const WebKit::WebInputEvent& event) const {
- DCHECK(IsGestureEventFromTouchscreen(event));
+ if (!WebKit::WebInputEvent::isGestureEventType(event.type))
+ return false;
// If the GestureEventFilter already processed this event, then the event must
// not be sent to the filter again.
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698