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

Side by Side Diff: cc/input/touch_action.h

Issue 2863693003: Unify TouchAction classes (Closed)
Patch Set: add cstdlib 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 unified diff | Download patch
« no previous file with comments | « cc/BUILD.gn ('k') | content/browser/renderer_host/input/input_router_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_INPUT_TOUCH_ACTION_H_
6 #define CC_INPUT_TOUCH_ACTION_H_
7
8 #include <cstdlib>
9
10 namespace cc {
11
12 // The current touch action specifies what accelerated browser operations
13 // (panning and zooming) are currently permitted via touch input.
14 // See http://www.w3.org/TR/pointerevents/#the-touch-action-css-property.
15 // This is intended to be the single canonical definition of the enum, it's used
16 // elsewhere in both Blink and content since touch action logic spans those
17 // subsystems.
18 // TODO(crbug.com/720553): rework this enum to enum class.
19 const size_t kTouchActionBits = 6;
20
21 enum TouchAction {
22 // No scrolling or zooming allowed.
23 kTouchActionNone = 0x0,
24 kTouchActionPanLeft = 0x1,
25 kTouchActionPanRight = 0x2,
26 kTouchActionPanX = kTouchActionPanLeft | kTouchActionPanRight,
27 kTouchActionPanUp = 0x4,
28 kTouchActionPanDown = 0x8,
29 kTouchActionPanY = kTouchActionPanUp | kTouchActionPanDown,
30 kTouchActionPan = kTouchActionPanX | kTouchActionPanY,
31 kTouchActionPinchZoom = 0x10,
32 kTouchActionManipulation = kTouchActionPan | kTouchActionPinchZoom,
33 kTouchActionDoubleTapZoom = 0x20,
34 kTouchActionAuto = kTouchActionManipulation | kTouchActionDoubleTapZoom,
35 kTouchActionMax = (1 << 6) - 1
36 };
37
38 inline TouchAction operator|(TouchAction a, TouchAction b) {
39 return static_cast<TouchAction>(int(a) | int(b));
40 }
41
42 inline TouchAction& operator|=(TouchAction& a, TouchAction b) {
43 return a = a | b;
44 }
45
46 inline TouchAction operator&(TouchAction a, TouchAction b) {
47 return static_cast<TouchAction>(int(a) & int(b));
48 }
49
50 inline TouchAction& operator&=(TouchAction& a, TouchAction b) {
51 return a = a & b;
52 }
53
54 } // namespace cc
55
56 #endif // CC_INPUT_TOUCH_ACTION_H_
OLDNEW
« no previous file with comments | « cc/BUILD.gn ('k') | content/browser/renderer_host/input/input_router_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698