| 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; | 12 class WebGestureEvent; | 
| 13 | 13 | 
| 14 // See WebInputEvent.h for details why this pack is here. | 14 // See WebInputEvent.h for details why this pack is here. | 
| 15 #pragma pack(push, 4) | 15 #pragma pack(push, 4) | 
| 16 | 16 | 
| 17 // WebMouseEvent -------------------------------------------------------------- | 17 // WebMouseEvent -------------------------------------------------------------- | 
| 18 | 18 | 
|  | 19 // TODO(mustaq): We are truncating |float|s to integers whenever setting | 
|  | 20 //   coordinate values, to avoid regressions for now. Will be fixed later | 
|  | 21 //   on. crbug.com/456625 | 
| 19 class WebMouseEvent : public WebInputEvent, public WebPointerProperties { | 22 class WebMouseEvent : public WebInputEvent, public WebPointerProperties { | 
| 20  public: | 23  public: | 
| 21   // Renderer coordinates. Similar to viewport coordinates but without |  | 
| 22   // DevTools emulation transform or overscroll applied. i.e. the coordinates |  | 
| 23   // in Chromium's RenderView bounds. |  | 
| 24   int x; |  | 
| 25   int y; |  | 
| 26 |  | 
| 27   // Screen coordinate |  | 
| 28   int globalX; |  | 
| 29   int globalY; |  | 
| 30 |  | 
| 31   int clickCount; | 24   int clickCount; | 
| 32 | 25 | 
| 33   WebMouseEvent(Type typeParam, | 26   WebMouseEvent(Type typeParam, | 
| 34                 int xParam, | 27                 int xParam, | 
| 35                 int yParam, | 28                 int yParam, | 
| 36                 int globalXParam, | 29                 int globalXParam, | 
| 37                 int globalYParam, | 30                 int globalYParam, | 
| 38                 int modifiersParam, | 31                 int modifiersParam, | 
| 39                 double timeStampSecondsParam) | 32                 double timeStampSecondsParam) | 
| 40       : WebInputEvent(sizeof(WebMouseEvent), | 33       : WebInputEvent(sizeof(WebMouseEvent), | 
| 41                       typeParam, | 34                       typeParam, | 
| 42                       modifiersParam, | 35                       modifiersParam, | 
| 43                       timeStampSecondsParam), | 36                       timeStampSecondsParam), | 
| 44         WebPointerProperties(), | 37         WebPointerProperties(), | 
| 45         x(xParam), | 38         m_positionInWidget(xParam, yParam), | 
| 46         y(yParam), | 39         m_positionInScreen(globalXParam, globalYParam) {} | 
| 47         globalX(globalXParam), |  | 
| 48         globalY(globalYParam) {} |  | 
| 49 | 40 | 
| 50   WebMouseEvent(Type typeParam, | 41   WebMouseEvent(Type typeParam, | 
| 51                 WebFloatPoint position, | 42                 WebFloatPoint position, | 
| 52                 WebFloatPoint globalPosition, | 43                 WebFloatPoint globalPosition, | 
| 53                 Button buttonParam, | 44                 Button buttonParam, | 
| 54                 int clickCountParam, | 45                 int clickCountParam, | 
| 55                 int modifiersParam, | 46                 int modifiersParam, | 
| 56                 double timeStampSecondsParam) | 47                 double timeStampSecondsParam) | 
| 57       : WebInputEvent(sizeof(WebMouseEvent), | 48       : WebInputEvent(sizeof(WebMouseEvent), | 
| 58                       typeParam, | 49                       typeParam, | 
| 59                       modifiersParam, | 50                       modifiersParam, | 
| 60                       timeStampSecondsParam), | 51                       timeStampSecondsParam), | 
| 61         WebPointerProperties(buttonParam, PointerType::Mouse), | 52         WebPointerProperties(buttonParam, PointerType::Mouse), | 
| 62         x(position.x), | 53         clickCount(clickCountParam), | 
| 63         y(position.y), | 54         m_positionInWidget(floor(position.x), floor(position.y)), | 
| 64         globalX(globalPosition.x), | 55         m_positionInScreen(floor(globalPosition.x), floor(globalPosition.y)) {} | 
| 65         globalY(globalPosition.y), |  | 
| 66         clickCount(clickCountParam) {} |  | 
| 67 | 56 | 
| 68   WebMouseEvent(Type typeParam, | 57   WebMouseEvent(Type typeParam, | 
| 69                 int modifiersParam, | 58                 int modifiersParam, | 
| 70                 double timeStampSecondsParam) | 59                 double timeStampSecondsParam) | 
| 71       : WebMouseEvent(sizeof(WebMouseEvent), | 60       : WebMouseEvent(sizeof(WebMouseEvent), | 
| 72                       typeParam, | 61                       typeParam, | 
| 73                       modifiersParam, | 62                       modifiersParam, | 
| 74                       timeStampSecondsParam) {} | 63                       timeStampSecondsParam) {} | 
| 75 | 64 | 
| 76   WebMouseEvent() : WebMouseEvent(sizeof(WebMouseEvent)) {} | 65   WebMouseEvent() : WebMouseEvent(sizeof(WebMouseEvent)) {} | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 88                                       double timeStampSecondsParam); | 77                                       double timeStampSecondsParam); | 
| 89 | 78 | 
| 90   BLINK_PLATFORM_EXPORT WebFloatPoint movementInRootFrame() const; | 79   BLINK_PLATFORM_EXPORT WebFloatPoint movementInRootFrame() const; | 
| 91   BLINK_PLATFORM_EXPORT WebFloatPoint positionInRootFrame() const; | 80   BLINK_PLATFORM_EXPORT WebFloatPoint positionInRootFrame() const; | 
| 92 | 81 | 
| 93   // Sets any scaled values to be their computed values and sets |frameScale| | 82   // Sets any scaled values to be their computed values and sets |frameScale| | 
| 94   // back to 1 and |translateX|, |translateY| back to 0. | 83   // back to 1 and |translateX|, |translateY| back to 0. | 
| 95   BLINK_PLATFORM_EXPORT WebMouseEvent flattenTransform() const; | 84   BLINK_PLATFORM_EXPORT WebMouseEvent flattenTransform() const; | 
| 96 #endif | 85 #endif | 
| 97 | 86 | 
|  | 87   WebFloatPoint positionInWidget() const { return m_positionInWidget; } | 
|  | 88   void setPositionInWidget(float x, float y) { | 
|  | 89     m_positionInWidget = WebFloatPoint(floor(x), floor(y)); | 
|  | 90   } | 
|  | 91 | 
|  | 92   WebFloatPoint positionInScreen() const { return m_positionInScreen; } | 
|  | 93   void setPositionInScreen(float x, float y) { | 
|  | 94     m_positionInScreen = WebFloatPoint(floor(x), floor(y)); | 
|  | 95   } | 
|  | 96 | 
| 98  protected: | 97  protected: | 
| 99   explicit WebMouseEvent(unsigned sizeParam) | 98   explicit WebMouseEvent(unsigned sizeParam) | 
| 100       : WebInputEvent(sizeParam), WebPointerProperties() {} | 99       : WebInputEvent(sizeParam), WebPointerProperties() {} | 
| 101 | 100 | 
| 102   WebMouseEvent(unsigned sizeParam, | 101   WebMouseEvent(unsigned sizeParam, | 
| 103                 Type type, | 102                 Type type, | 
| 104                 int modifiers, | 103                 int modifiers, | 
| 105                 double timeStampSeconds) | 104                 double timeStampSeconds) | 
| 106       : WebInputEvent(sizeParam, type, modifiers, timeStampSeconds), | 105       : WebInputEvent(sizeParam, type, modifiers, timeStampSeconds), | 
| 107         WebPointerProperties() {} | 106         WebPointerProperties() {} | 
| 108 | 107 | 
| 109   void flattenTransformSelf(); | 108   void flattenTransformSelf(); | 
|  | 109 | 
|  | 110  private: | 
|  | 111   // Widget coordinate, which is relative to the bound of current RenderWidget | 
|  | 112   // (e.g. a plugin or OOPIF inside a RenderView). Similar to viewport | 
|  | 113   // coordinates but without DevTools emulation transform or overscroll applied. | 
|  | 114   WebFloatPoint m_positionInWidget; | 
|  | 115 | 
|  | 116   // Screen coordinate | 
|  | 117   WebFloatPoint m_positionInScreen; | 
| 110 }; | 118 }; | 
| 111 | 119 | 
| 112 #pragma pack(pop) | 120 #pragma pack(pop) | 
| 113 | 121 | 
| 114 }  // namespace blink | 122 }  // namespace blink | 
| 115 | 123 | 
| 116 #endif  // WebMouseEvent_h | 124 #endif  // WebMouseEvent_h | 
| OLD | NEW | 
|---|