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

Unified Diff: cc/input/touch_action.h

Issue 2863693003: Unify TouchAction classes (Closed)
Patch Set: more tests Created 3 years, 7 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: cc/input/touch_action.h
diff --git a/cc/input/touch_action.h b/cc/input/touch_action.h
new file mode 100644
index 0000000000000000000000000000000000000000..1dcdd9a1a119170633f985cb6eee64088328a8ce
--- /dev/null
+++ b/cc/input/touch_action.h
@@ -0,0 +1,45 @@
+// Copyright 2017 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 CC_INPUT_TOUCH_ACTION_H_
+#define CC_INPUT_TOUCH_ACTION_H_
+
+namespace cc {
+
+// The current touch action specifies what accelerated browser operations
wkorman 2017/05/08 19:03:01 Could enhance comments here to add: - this is int
+// (panning and zooming) are currently permitted via touch input.
+// See http://www.w3.org/TR/pointerevents/#the-touch-action-css-property.
+const size_t kTouchActionBits = 6;
danakj 2017/05/09 14:29:46 whitespace before enum defn
+enum TouchAction {
jbroman 2017/05/09 14:40:26 nit: You might consider enum class, so that you ge
+ // No scrolling or zooming allowed.
+ kTouchActionNone = 0x0,
+ kTouchActionPanLeft = 0x1,
+ kTouchActionPanRight = 0x2,
+ kTouchActionPanX = kTouchActionPanLeft | kTouchActionPanRight,
+ kTouchActionPanUp = 0x4,
+ kTouchActionPanDown = 0x8,
+ kTouchActionPanY = kTouchActionPanUp | kTouchActionPanDown,
+ kTouchActionPan = kTouchActionPanX | kTouchActionPanY,
+ kTouchActionPinchZoom = 0x10,
+ kTouchActionManipulation = kTouchActionPan | kTouchActionPinchZoom,
+ kTouchActionDoubleTapZoom = 0x20,
+ kTouchActionAuto = kTouchActionManipulation | kTouchActionDoubleTapZoom,
+ kTouchActionMax = (1 << 6) - 1
+};
+inline TouchAction operator|(TouchAction a, TouchAction b) {
danakj 2017/05/09 14:29:46 whitespace before/after functions
+ return static_cast<TouchAction>(int(a) | int(b));
+}
+inline TouchAction& operator|=(TouchAction& a, TouchAction b) {
+ return a = a | b;
+}
+inline TouchAction operator&(TouchAction a, TouchAction b) {
+ return static_cast<TouchAction>(int(a) & int(b));
+}
+inline TouchAction& operator&=(TouchAction& a, TouchAction b) {
+ return a = a & b;
+}
+
+} // namespace cc
+
+#endif // CC_INPUT_TOUCH_ACTION_H_

Powered by Google App Engine
This is Rietveld 408576698