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

Unified Diff: content/common/input/touch_action.h

Issue 1422513006: Simplify TouchAction enum to be a simple bit flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows build warning Created 5 years, 2 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
Index: content/common/input/touch_action.h
diff --git a/content/common/input/touch_action.h b/content/common/input/touch_action.h
index 89f000df7bd19124496f57e61bafb9874332c434..2b6c321a427517cbc00d741c818e6600ec023c37 100644
--- a/content/common/input/touch_action.h
+++ b/content/common/input/touch_action.h
@@ -11,33 +11,52 @@ namespace content {
// (panning and zooming) are currently permitted via touch input.
// See http://www.w3.org/TR/pointerevents/#the-touch-action-css-property.
enum TouchAction {
jdduke (slow) 2015/10/29 15:40:26 Now that we expose proper operators, should this b
jdduke (slow) 2015/10/29 15:41:44 Actually, not sure if that works if the operators
tdresser 2015/10/29 15:43:00 It would require renaming everything, but it's lik
- // All actions are pemitted (the default).
- TOUCH_ACTION_AUTO = 0,
-
// No scrolling or zooming allowed.
- TOUCH_ACTION_NONE = 1 << 0,
+ TOUCH_ACTION_NONE = 0,
- TOUCH_ACTION_PAN_LEFT = 1 << 1,
+ TOUCH_ACTION_PAN_LEFT = 1 << 0,
- TOUCH_ACTION_PAN_RIGHT = 1 << 2,
+ TOUCH_ACTION_PAN_RIGHT = 1 << 1,
TOUCH_ACTION_PAN_X = TOUCH_ACTION_PAN_LEFT | TOUCH_ACTION_PAN_RIGHT,
- TOUCH_ACTION_PAN_UP = 1 << 3,
+ TOUCH_ACTION_PAN_UP = 1 << 2,
- TOUCH_ACTION_PAN_DOWN = 1 << 4,
+ TOUCH_ACTION_PAN_DOWN = 1 << 3,
TOUCH_ACTION_PAN_Y = TOUCH_ACTION_PAN_UP | TOUCH_ACTION_PAN_DOWN,
- TOUCH_ACTION_PAN_X_Y = TOUCH_ACTION_PAN_X | TOUCH_ACTION_PAN_Y,
+ TOUCH_ACTION_PAN = TOUCH_ACTION_PAN_X | TOUCH_ACTION_PAN_Y,
+
+ TOUCH_ACTION_PINCH_ZOOM = 1 << 4,
- TOUCH_ACTION_PINCH_ZOOM = 1 << 5,
+ TOUCH_ACTION_MANIPULATION = TOUCH_ACTION_PAN | TOUCH_ACTION_PINCH_ZOOM,
- TOUCH_ACTION_MANIPULATION = TOUCH_ACTION_PAN_X_Y | TOUCH_ACTION_PINCH_ZOOM,
+ TOUCH_ACTION_DOUBLE_TAP_ZOOM = 1 << 5,
+
+ // All actions are pemitted (the default).
tdresser 2015/10/29 15:30:35 pemitted -> permitted
Rick Byers 2015/10/29 16:56:04 Done.
+ TOUCH_ACTION_AUTO = TOUCH_ACTION_MANIPULATION | TOUCH_ACTION_DOUBLE_TAP_ZOOM,
TOUCH_ACTION_MAX = (1 << 6) - 1
};
+inline TouchAction operator| (TouchAction a, TouchAction b)
+{
+ return TouchAction(int(a) | int(b));
tdresser 2015/10/29 15:30:35 Use static_cast.
dtapuska 2015/10/29 15:38:44 WebTouchAction also does this; and occurs in a few
Rick Byers 2015/10/29 16:56:04 I think I've found them all and switched to static
+}
+inline TouchAction& operator|= (TouchAction& a, TouchAction b)
+{
+ return a = a | b;
+}
+inline TouchAction operator& (TouchAction a, TouchAction b)
+{
+ return TouchAction(int(a) & int(b));
+}
+inline TouchAction& operator&= (TouchAction& a, TouchAction b)
+{
+ return a = a & b;
+}
+
} // namespace content
#endif // CONTENT_COMMON_INPUT_TOUCH_ACTION_H_
« no previous file with comments | « content/browser/renderer_host/input/touch_action_filter_unittest.cc ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698