Chromium Code Reviews| 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 syntheticEventType() const { return m_synthesized; } | 89 SyntheticEventType syntheticEventType() 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 String m_region; | |
|
Rick Byers
2016/02/23 20:26:08
Conceptually this would probably make more sense t
zino
2016/03/08 12:33:48
Done.
I agree with you. I'll move the region data
Rick Byers
2016/03/08 15:57:34
Thanks. Note that I'm not convinced it's worth th
| |
| 104 }; | 111 }; |
| 105 | 112 |
| 106 } // namespace blink | 113 } // namespace blink |
| 107 | 114 |
| 108 #endif // PlatformMouseEvent_h | 115 #endif // PlatformMouseEvent_h |
| OLD | NEW |