Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 namespace cc { | |
| 9 | |
| 10 // The current touch action specifies what accelerated browser operations | |
| 11 // (panning and zooming) are currently permitted via touch input. | |
| 12 // See http://www.w3.org/TR/pointerevents/#the-touch-action-css-property. | |
| 13 // This is intended to be the single canonical definition of the enum, it's used | |
| 14 // elsewhere in both Blink and content since touch action logic spans those | |
| 15 // subsystems. | |
|
wkorman
2017/05/10 17:56:56
Suggest adding TODO, filing P3 bug and linking bug
| |
| 16 const size_t kTouchActionBits = 6; | |
| 17 | |
| 18 enum TouchAction { | |
| 19 // No scrolling or zooming allowed. | |
| 20 kTouchActionNone = 0x0, | |
| 21 kTouchActionPanLeft = 0x1, | |
| 22 kTouchActionPanRight = 0x2, | |
| 23 kTouchActionPanX = kTouchActionPanLeft | kTouchActionPanRight, | |
| 24 kTouchActionPanUp = 0x4, | |
| 25 kTouchActionPanDown = 0x8, | |
| 26 kTouchActionPanY = kTouchActionPanUp | kTouchActionPanDown, | |
| 27 kTouchActionPan = kTouchActionPanX | kTouchActionPanY, | |
| 28 kTouchActionPinchZoom = 0x10, | |
| 29 kTouchActionManipulation = kTouchActionPan | kTouchActionPinchZoom, | |
| 30 kTouchActionDoubleTapZoom = 0x20, | |
| 31 kTouchActionAuto = kTouchActionManipulation | kTouchActionDoubleTapZoom, | |
| 32 kTouchActionMax = (1 << 6) - 1 | |
| 33 }; | |
| 34 | |
| 35 inline TouchAction operator|(TouchAction a, TouchAction b) { | |
| 36 return static_cast<TouchAction>(int(a) | int(b)); | |
| 37 } | |
| 38 | |
| 39 inline TouchAction& operator|=(TouchAction& a, TouchAction b) { | |
| 40 return a = a | b; | |
| 41 } | |
| 42 | |
| 43 inline TouchAction operator&(TouchAction a, TouchAction b) { | |
| 44 return static_cast<TouchAction>(int(a) & int(b)); | |
| 45 } | |
| 46 | |
| 47 inline TouchAction& operator&=(TouchAction& a, TouchAction b) { | |
| 48 return a = a & b; | |
| 49 } | |
| 50 | |
| 51 } // namespace cc | |
| 52 | |
| 53 #endif // CC_INPUT_TOUCH_ACTION_H_ | |
| OLD | NEW |