| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WebMouseEvent_h | 5 #ifndef WebMouseEvent_h |
| 6 #define WebMouseEvent_h | 6 #define WebMouseEvent_h |
| 7 | 7 |
| 8 #include "WebInputEvent.h" | 8 #include "WebInputEvent.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 class WebGestureEvent; |
| 13 |
| 12 // See WebInputEvent.h for details why this pack is here. | 14 // See WebInputEvent.h for details why this pack is here. |
| 13 #pragma pack(push, 4) | 15 #pragma pack(push, 4) |
| 14 | 16 |
| 15 // WebMouseEvent -------------------------------------------------------------- | 17 // WebMouseEvent -------------------------------------------------------------- |
| 16 | 18 |
| 17 class WebMouseEvent : public WebInputEvent, public WebPointerProperties { | 19 class WebMouseEvent : public WebInputEvent, public WebPointerProperties { |
| 18 public: | 20 public: |
| 19 // Renderer coordinates. Similar to viewport coordinates but without | 21 // Renderer coordinates. Similar to viewport coordinates but without |
| 20 // DevTools emulation transform or overscroll applied. i.e. the coordinates | 22 // DevTools emulation transform or overscroll applied. i.e. the coordinates |
| 21 // in Chromium's RenderView bounds. | 23 // in Chromium's RenderView bounds. |
| 22 int x; | 24 int x; |
| 23 int y; | 25 int y; |
| 24 | 26 |
| 25 // DEPRECATED (crbug.com/507787) | 27 // DEPRECATED (crbug.com/507787) |
| 26 int windowX; | 28 int windowX; |
| 27 int windowY; | 29 int windowY; |
| 28 | 30 |
| 29 // Screen coordinate | 31 // Screen coordinate |
| 30 int globalX; | 32 int globalX; |
| 31 int globalY; | 33 int globalY; |
| 32 | 34 |
| 33 int movementX; | 35 int movementX; |
| 34 int movementY; | 36 int movementY; |
| 35 int clickCount; | 37 int clickCount; |
| 36 | 38 |
| 37 WebMouseEvent(Type type, int modifiers, double timeStampSeconds) | 39 WebMouseEvent(Type typeParam, |
| 38 : WebInputEvent(sizeof(WebMouseEvent), type, modifiers, timeStampSeconds), | 40 int xParam, |
| 39 WebPointerProperties() {} | 41 int yParam, |
| 42 int globalXParam, |
| 43 int globalYParam, |
| 44 int modifiersParam, |
| 45 double timeStampSecondsParam) |
| 46 : WebInputEvent(sizeof(WebMouseEvent), |
| 47 typeParam, |
| 48 modifiersParam, |
| 49 timeStampSecondsParam), |
| 50 WebPointerProperties(), |
| 51 x(xParam), |
| 52 y(yParam), |
| 53 globalX(globalXParam), |
| 54 globalY(globalYParam) {} |
| 40 | 55 |
| 41 WebMouseEvent() | 56 WebMouseEvent(Type typeParam, |
| 42 : WebInputEvent(sizeof(WebMouseEvent)), WebPointerProperties() {} | 57 WebFloatPoint position, |
| 58 WebFloatPoint globalPosition, |
| 59 Button buttonParam, |
| 60 int clickCountParam, |
| 61 int modifiersParam, |
| 62 double timeStampSecondsParam) |
| 63 : WebInputEvent(sizeof(WebMouseEvent), |
| 64 typeParam, |
| 65 modifiersParam, |
| 66 timeStampSecondsParam), |
| 67 WebPointerProperties(buttonParam, PointerType::Mouse), |
| 68 x(position.x), |
| 69 y(position.y), |
| 70 globalX(globalPosition.x), |
| 71 globalY(globalPosition.y), |
| 72 clickCount(clickCountParam) {} |
| 73 |
| 74 WebMouseEvent(Type typeParam, |
| 75 int modifiersParam, |
| 76 double timeStampSecondsParam) |
| 77 : WebMouseEvent(sizeof(WebMouseEvent), |
| 78 typeParam, |
| 79 modifiersParam, |
| 80 timeStampSecondsParam) {} |
| 81 |
| 82 WebMouseEvent() : WebMouseEvent(sizeof(WebMouseEvent)) {} |
| 83 |
| 84 bool fromTouch() const { |
| 85 return (modifiers() & IsCompatibilityEventForTouch) != 0; |
| 86 } |
| 43 | 87 |
| 44 #if INSIDE_BLINK | 88 #if INSIDE_BLINK |
| 89 BLINK_PLATFORM_EXPORT WebMouseEvent(Type typeParam, |
| 90 const WebGestureEvent&, |
| 91 Button buttonParam, |
| 92 int clickCountParam, |
| 93 int modifiersParam, |
| 94 double timeStampSecondsParam); |
| 95 |
| 45 BLINK_PLATFORM_EXPORT WebFloatPoint movementInRootFrame() const; | 96 BLINK_PLATFORM_EXPORT WebFloatPoint movementInRootFrame() const; |
| 46 BLINK_PLATFORM_EXPORT WebFloatPoint positionInRootFrame() const; | 97 BLINK_PLATFORM_EXPORT WebFloatPoint positionInRootFrame() const; |
| 98 |
| 99 // Sets any scaled values to be their computed values and sets |frameScale| |
| 100 // back to 1 and |translateX|, |translateY| back to 0. |
| 101 BLINK_PLATFORM_EXPORT WebMouseEvent flattenTransform() const; |
| 47 #endif | 102 #endif |
| 48 | 103 |
| 49 protected: | 104 protected: |
| 50 explicit WebMouseEvent(unsigned sizeParam) | 105 explicit WebMouseEvent(unsigned sizeParam) |
| 51 : WebInputEvent(sizeParam), WebPointerProperties() {} | 106 : WebInputEvent(sizeParam), WebPointerProperties() {} |
| 52 | 107 |
| 53 WebMouseEvent(unsigned sizeParam, | 108 WebMouseEvent(unsigned sizeParam, |
| 54 Type type, | 109 Type type, |
| 55 int modifiers, | 110 int modifiers, |
| 56 double timeStampSeconds) | 111 double timeStampSeconds) |
| 57 : WebInputEvent(sizeParam, type, modifiers, timeStampSeconds), | 112 : WebInputEvent(sizeParam, type, modifiers, timeStampSeconds), |
| 58 WebPointerProperties() {} | 113 WebPointerProperties() {} |
| 59 | 114 |
| 60 void flattenTransformSelf(); | 115 void flattenTransformSelf(); |
| 61 }; | 116 }; |
| 62 | 117 |
| 63 #pragma pack(pop) | 118 #pragma pack(pop) |
| 64 | 119 |
| 65 } // namespace blink | 120 } // namespace blink |
| 66 | 121 |
| 67 #endif // WebMouseEvent_h | 122 #endif // WebMouseEvent_h |
| OLD | NEW |