OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 11 matching lines...) Expand all Loading... |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef PlatformMouseEvent_h | 26 #ifndef PlatformMouseEvent_h |
27 #define PlatformMouseEvent_h | 27 #define PlatformMouseEvent_h |
28 | 28 |
29 #include "platform/PlatformEvent.h" | 29 #include "platform/PlatformEvent.h" |
30 #include "platform/geometry/IntPoint.h" | 30 #include "platform/geometry/IntPoint.h" |
31 #include "public/platform/WebPointerProperties.h" | 31 #include "public/platform/WebPointerProperties.h" |
| 32 #include "wtf/text/WTFString.h" |
32 | 33 |
33 namespace blink { | 34 namespace blink { |
34 | 35 |
35 // These button numbers match the ones used in the DOM API, 0 through 2, except
for NoButton which is specified in PointerEvent | 36 // These button numbers match the ones used in the DOM API, 0 through 2, except
for NoButton which is specified in PointerEvent |
36 // spec but not in MouseEvent spec. | 37 // spec but not in MouseEvent spec. |
37 enum MouseButton { NoButton = -1, LeftButton, MiddleButton, RightButton }; | 38 enum MouseButton { NoButton = -1, LeftButton, MiddleButton, RightButton }; |
38 | 39 |
39 class PlatformMouseEvent : public PlatformEvent { | 40 class PlatformMouseEvent : public PlatformEvent { |
40 public: | 41 public: |
41 enum SyntheticEventType { | 42 enum SyntheticEventType { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 const WebPointerProperties& pointerProperties() const { return m_pointerProp
erties; } | 81 const WebPointerProperties& pointerProperties() const { return m_pointerProp
erties; } |
81 const IntPoint& position() const { return m_position; } | 82 const IntPoint& position() const { return m_position; } |
82 const IntPoint& globalPosition() const { return m_globalPosition; } | 83 const IntPoint& globalPosition() const { return m_globalPosition; } |
83 const IntPoint& movementDelta() const { return m_movementDelta; } | 84 const IntPoint& movementDelta() const { return m_movementDelta; } |
84 | 85 |
85 MouseButton button() const { return m_button; } | 86 MouseButton button() const { return m_button; } |
86 int clickCount() const { return m_clickCount; } | 87 int clickCount() const { return m_clickCount; } |
87 bool fromTouch() const { return m_synthesized == FromTouch; } | 88 bool fromTouch() const { return m_synthesized == FromTouch; } |
88 SyntheticEventType getSyntheticEventType() const { return m_synthesized; } | 89 SyntheticEventType getSyntheticEventType() const { return m_synthesized; } |
89 | 90 |
| 91 const String& region() const { return m_region; } |
| 92 void setRegion(const String& region) { m_region = region; } |
| 93 |
90 protected: | 94 protected: |
91 WebPointerProperties m_pointerProperties; | 95 WebPointerProperties m_pointerProperties; |
92 | 96 |
93 // In local root frame coordinates. (Except possibly if the Widget under | 97 // In local root frame coordinates. (Except possibly if the Widget under |
94 // the mouse is a popup, see FIXME in PlatformMouseEventBuilder). | 98 // the mouse is a popup, see FIXME in PlatformMouseEventBuilder). |
95 IntPoint m_position; | 99 IntPoint m_position; |
96 | 100 |
97 // In screen coordinates. | 101 // In screen coordinates. |
98 IntPoint m_globalPosition; | 102 IntPoint m_globalPosition; |
99 | 103 |
100 IntPoint m_movementDelta; | 104 IntPoint m_movementDelta; |
101 MouseButton m_button; | 105 MouseButton m_button; |
102 int m_clickCount; | 106 int m_clickCount; |
103 SyntheticEventType m_synthesized; | 107 SyntheticEventType m_synthesized; |
| 108 |
| 109 // For canvas hit region. |
| 110 // TODO(zino): This might make more sense to put in HitTestResults or |
| 111 // some other part of MouseEventWithHitTestResults, but for now it's |
| 112 // most convenient to stash it here. Please see: http://crbug.com/592947. |
| 113 String m_region; |
104 }; | 114 }; |
105 | 115 |
106 } // namespace blink | 116 } // namespace blink |
107 | 117 |
108 #endif // PlatformMouseEvent_h | 118 #endif // PlatformMouseEvent_h |
OLD | NEW |