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 19 matching lines...) Expand all Loading... | |
30 #include "platform/geometry/IntPoint.h" | 30 #include "platform/geometry/IntPoint.h" |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 // These button numbers match the ones used in the DOM API, 0 through 2, except for NoButton which isn't specified. | 34 // These button numbers match the ones used in the DOM API, 0 through 2, except for NoButton which isn't specified. |
35 enum MouseButton { NoButton = -1, LeftButton, MiddleButton, RightButton }; | 35 enum MouseButton { NoButton = -1, LeftButton, MiddleButton, RightButton }; |
36 | 36 |
37 class PlatformMouseEvent : public PlatformEvent { | 37 class PlatformMouseEvent : public PlatformEvent { |
38 public: | 38 public: |
39 enum SyntheticEventType { | 39 enum SyntheticEventType { |
40 NotFromTouch, | 40 NotSyntheticOrIndistinguishable, // Real mouse input events or synthetic events that behave just like real events |
Rick Byers
2014/08/22 18:11:13
nit: maybe put these comments on the line above th
Rick Byers
2014/08/22 18:11:13
nit: this name is a bit of a mouthful. I like tha
Ignacio Solla
2014/08/26 13:40:53
Done.
Ignacio Solla
2014/08/26 13:40:53
I agree, it is a mouthful, I've changed it now to
| |
41 FromTouch, | 41 FromTouch, // Mouse events derived from touch input |
42 NotFromInput, // Blink can generate fake mouse events after scrolling or re-layout, see for example EventHandler::dispatchFakeMouseMoveEventSoon | |
42 }; | 43 }; |
43 | 44 |
44 PlatformMouseEvent() | 45 PlatformMouseEvent() |
45 : PlatformEvent(PlatformEvent::MouseMoved) | 46 : PlatformEvent(PlatformEvent::MouseMoved) |
46 , m_button(NoButton) | 47 , m_button(NoButton) |
47 , m_clickCount(0) | 48 , m_clickCount(0) |
48 , m_synthesized(NotFromTouch) | 49 , m_synthesized(NotSyntheticOrIndistinguishable) |
49 , m_modifierFlags(0) | 50 , m_modifierFlags(0) |
50 { | 51 { |
51 } | 52 } |
52 | 53 |
53 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie rs, double timestamp) | 54 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie rs, double timestamp) |
54 : PlatformEvent(type, modifiers, timestamp) | 55 : PlatformEvent(type, modifiers, timestamp) |
55 , m_position(position) | 56 , m_position(position) |
56 , m_globalPosition(globalPosition) | 57 , m_globalPosition(globalPosition) |
57 , m_button(button) | 58 , m_button(button) |
58 , m_clickCount(clickCount) | 59 , m_clickCount(clickCount) |
59 , m_synthesized(NotFromTouch) | 60 , m_synthesized(NotSyntheticOrIndistinguishable) |
60 , m_modifierFlags(0) | 61 , m_modifierFlags(0) |
61 { | 62 { |
62 } | 63 } |
63 | 64 |
64 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie rs, SyntheticEventType synthesized, double timestamp) | 65 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, Modifiers modifie rs, SyntheticEventType synthesized, double timestamp) |
65 : PlatformEvent(type, modifiers, timestamp) | 66 : PlatformEvent(type, modifiers, timestamp) |
66 , m_position(position) | 67 , m_position(position) |
67 , m_globalPosition(globalPosition) | 68 , m_globalPosition(globalPosition) |
68 , m_button(button) | 69 , m_button(button) |
69 , m_clickCount(clickCount) | 70 , m_clickCount(clickCount) |
70 , m_synthesized(synthesized) | 71 , m_synthesized(synthesized) |
71 , m_modifierFlags(0) | 72 , m_modifierFlags(0) |
72 { | 73 { |
73 } | 74 } |
74 | 75 |
75 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, bool shiftKey, bo ol ctrlKey, bool altKey, bool metaKey, double timestamp) | 76 PlatformMouseEvent(const IntPoint& position, const IntPoint& globalPosition, MouseButton button, PlatformEvent::Type type, int clickCount, bool shiftKey, bo ol ctrlKey, bool altKey, bool metaKey, double timestamp, SyntheticEventType synt hesized = NotSyntheticOrIndistinguishable) |
Rick Byers
2014/08/22 18:11:13
I think we should try to keep the parameter order
Ignacio Solla
2014/08/26 13:40:53
Done.
Added a non-optional arg and updated all c
Rick Byers
2014/08/26 15:25:46
Thank you!
Ignacio Solla
2014/08/26 17:30:42
Acknowledged.
| |
76 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp) | 77 : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp) |
77 , m_position(position) | 78 , m_position(position) |
78 , m_globalPosition(globalPosition) | 79 , m_globalPosition(globalPosition) |
79 , m_button(button) | 80 , m_button(button) |
80 , m_clickCount(clickCount) | 81 , m_clickCount(clickCount) |
81 , m_synthesized(NotFromTouch) | 82 , m_synthesized(synthesized) |
82 , m_modifierFlags(0) | 83 , m_modifierFlags(0) |
83 { | 84 { |
84 } | 85 } |
85 | 86 |
86 const IntPoint& position() const { return m_position; } | 87 const IntPoint& position() const { return m_position; } |
87 const IntPoint& globalPosition() const { return m_globalPosition; } | 88 const IntPoint& globalPosition() const { return m_globalPosition; } |
88 const IntPoint& movementDelta() const { return m_movementDelta; } | 89 const IntPoint& movementDelta() const { return m_movementDelta; } |
89 | 90 |
90 MouseButton button() const { return m_button; } | 91 MouseButton button() const { return m_button; } |
91 int clickCount() const { return m_clickCount; } | 92 int clickCount() const { return m_clickCount; } |
92 unsigned modifierFlags() const { return m_modifierFlags; } | 93 unsigned modifierFlags() const { return m_modifierFlags; } |
93 bool fromTouch() const { return m_synthesized == FromTouch; } | 94 bool fromTouch() const { return m_synthesized == FromTouch; } |
95 SyntheticEventType syntheticEventType() const { return m_synthesized; } | |
94 | 96 |
95 protected: | 97 protected: |
96 IntPoint m_position; | 98 IntPoint m_position; |
97 IntPoint m_globalPosition; | 99 IntPoint m_globalPosition; |
98 IntPoint m_movementDelta; | 100 IntPoint m_movementDelta; |
99 MouseButton m_button; | 101 MouseButton m_button; |
100 int m_clickCount; | 102 int m_clickCount; |
101 SyntheticEventType m_synthesized; | 103 SyntheticEventType m_synthesized; |
102 unsigned m_modifierFlags; | 104 unsigned m_modifierFlags; |
103 }; | 105 }; |
104 | 106 |
105 } // namespace blink | 107 } // namespace blink |
106 | 108 |
107 #endif // PlatformMouseEvent_h | 109 #endif // PlatformMouseEvent_h |
OLD | NEW |