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

Unified Diff: content/browser/renderer_host/input/touch_action_filter.h

Issue 67383002: Initial browser-side implementation for touch-action (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add back accidentally removed line Created 7 years, 1 month 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
Index: content/browser/renderer_host/input/touch_action_filter.h
diff --git a/content/browser/renderer_host/input/touch_action_filter.h b/content/browser/renderer_host/input/touch_action_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..cce6abb98c8501d5bafea9473935a4130b4c7905
--- /dev/null
+++ b/content/browser/renderer_host/input/touch_action_filter.h
@@ -0,0 +1,49 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_ACTION_FILTER_H_
+#define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_ACTION_FILTER_H_
+
+#include "base/basictypes.h"
+#include "content/common/content_export.h"
+#include "content/public/common/touch_action.h"
+
+namespace blink {
+class WebGestureEvent;
+}
+
+namespace content {
+
+// The TouchActionFilter is responsible for filtering scroll and pinch gesture
+// events according to the CSS touch-action values the renderer has sent for
+// each touch point.
+// For details see the touch-action design doc at http://goo.gl/KcKbxQ.
+class CONTENT_EXPORT TouchActionFilter {
+public:
+ TouchActionFilter() :
+ drop_scroll_gesture_events_(false),
+ allowed_touch_action_(TOUCH_ACTION_AUTO)
+ {
+ }
+
+ // Returns true if the supplied gesture event should be dropped based on
+ // the current touch-action state.
+ bool FilterGestureEvent(const blink::WebGestureEvent& gesture_event);
+
+ // Called when a set-touch-action message is received from the renderer
+ // for a touch start event that is currently in flight.
+ void OnSetTouchAction(int touch_id, content::TouchAction touchAction);
+
+private:
+ // Whether GestureScroll events should be discarded due to touch-action.
+ bool drop_scroll_gesture_events_;
+
+ // What touch actions are currently permitted.
+ content::TouchAction allowed_touch_action_;
+
+ DISALLOW_COPY_AND_ASSIGN(TouchActionFilter);
+};
+
+}
+#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_ACTION_FILTER_H_

Powered by Google App Engine
This is Rietveld 408576698