OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebInputEventConversion_h | 31 #ifndef WebInputEventConversion_h |
32 #define WebInputEventConversion_h | 32 #define WebInputEventConversion_h |
33 | 33 |
34 #include "platform/PlatformMouseEvent.h" | 34 #include "platform/PlatformMouseEvent.h" |
35 #include "platform/PlatformTouchEvent.h" | 35 #include "platform/PlatformTouchEvent.h" |
36 #include "platform/PlatformWheelEvent.h" | |
37 #include "platform/scroll/ScrollTypes.h" | 36 #include "platform/scroll/ScrollTypes.h" |
38 #include "public/platform/WebInputEvent.h" | 37 #include "public/platform/WebInputEvent.h" |
39 #include "public/platform/WebMouseWheelEvent.h" | 38 #include "public/platform/WebMouseWheelEvent.h" |
40 #include "web/WebExport.h" | 39 #include "web/WebExport.h" |
41 #include "wtf/Compiler.h" | 40 #include "wtf/Compiler.h" |
42 #include <vector> | 41 #include <vector> |
43 | 42 |
44 namespace blink { | 43 namespace blink { |
45 | 44 |
46 class KeyboardEvent; | 45 class KeyboardEvent; |
47 class MouseEvent; | 46 class MouseEvent; |
48 class LayoutItem; | 47 class LayoutItem; |
49 class TouchEvent; | 48 class TouchEvent; |
50 class WebGestureEvent; | 49 class WebGestureEvent; |
51 class WebMouseEvent; | 50 class WebMouseEvent; |
52 class WebKeyboardEvent; | 51 class WebKeyboardEvent; |
53 class WebTouchEvent; | 52 class WebTouchEvent; |
54 class WheelEvent; | |
55 class Widget; | 53 class Widget; |
56 | 54 |
57 // These classes are used to convert from WebInputEvent subclasses to | 55 // These classes are used to convert from WebInputEvent subclasses to |
58 // corresponding WebCore events. | 56 // corresponding WebCore events. |
59 | 57 |
60 class WEB_EXPORT PlatformMouseEventBuilder | 58 class WEB_EXPORT PlatformMouseEventBuilder |
61 : NON_EXPORTED_BASE(public PlatformMouseEvent) { | 59 : NON_EXPORTED_BASE(public PlatformMouseEvent) { |
62 public: | 60 public: |
63 PlatformMouseEventBuilder(Widget*, const WebMouseEvent&); | 61 PlatformMouseEventBuilder(Widget*, const WebMouseEvent&); |
64 }; | 62 }; |
65 | 63 |
66 class WEB_EXPORT PlatformWheelEventBuilder | |
67 : NON_EXPORTED_BASE(public PlatformWheelEvent) { | |
68 public: | |
69 PlatformWheelEventBuilder(Widget*, const WebMouseWheelEvent&); | |
70 }; | |
71 | |
72 // Converts a WebTouchPoint to a PlatformTouchPoint. | 64 // Converts a WebTouchPoint to a PlatformTouchPoint. |
73 class WEB_EXPORT PlatformTouchPointBuilder | 65 class WEB_EXPORT PlatformTouchPointBuilder |
74 : NON_EXPORTED_BASE(public PlatformTouchPoint) { | 66 : NON_EXPORTED_BASE(public PlatformTouchPoint) { |
75 public: | 67 public: |
76 PlatformTouchPointBuilder(Widget*, const WebTouchPoint&); | 68 PlatformTouchPointBuilder(Widget*, const WebTouchPoint&); |
77 }; | 69 }; |
78 | 70 |
79 // Converts a WebTouchEvent to a PlatformTouchEvent. | 71 // Converts a WebTouchEvent to a PlatformTouchEvent. |
80 class WEB_EXPORT PlatformTouchEventBuilder | 72 class WEB_EXPORT PlatformTouchEventBuilder |
81 : NON_EXPORTED_BASE(public PlatformTouchEvent) { | 73 : NON_EXPORTED_BASE(public PlatformTouchEvent) { |
82 public: | 74 public: |
83 PlatformTouchEventBuilder(Widget*, const WebTouchEvent&); | 75 PlatformTouchEventBuilder(Widget*, const WebTouchEvent&); |
84 }; | 76 }; |
85 | 77 |
86 class WEB_EXPORT WebMouseEventBuilder | 78 class WEB_EXPORT WebMouseEventBuilder |
87 : NON_EXPORTED_BASE(public WebMouseEvent) { | 79 : NON_EXPORTED_BASE(public WebMouseEvent) { |
88 public: | 80 public: |
89 // Converts a MouseEvent to a corresponding WebMouseEvent. | 81 // Converts a MouseEvent to a corresponding WebMouseEvent. |
90 // NOTE: This is only implemented for mousemove, mouseover, mouseout, | 82 // NOTE: This is only implemented for mousemove, mouseover, mouseout, |
91 // mousedown and mouseup. If the event mapping fails, the event type will | 83 // mousedown and mouseup. If the event mapping fails, the event type will |
92 // be set to Undefined. | 84 // be set to Undefined. |
93 WebMouseEventBuilder(const Widget*, const LayoutItem, const MouseEvent&); | 85 WebMouseEventBuilder(const Widget*, const LayoutItem, const MouseEvent&); |
94 WebMouseEventBuilder(const Widget*, const LayoutItem, const TouchEvent&); | 86 WebMouseEventBuilder(const Widget*, const LayoutItem, const TouchEvent&); |
95 }; | 87 }; |
96 | 88 |
97 // Converts a WheelEvent to a corresponding WebMouseWheelEvent. | |
98 // If the event mapping fails, the event type will be set to Undefined. | |
99 class WEB_EXPORT WebMouseWheelEventBuilder | |
100 : NON_EXPORTED_BASE(public WebMouseWheelEvent) { | |
101 public: | |
102 WebMouseWheelEventBuilder(const Widget*, const LayoutItem, const WheelEvent&); | |
103 }; | |
104 | |
105 // Converts a KeyboardEvent to a corresponding WebKeyboardEvent. | 89 // Converts a KeyboardEvent to a corresponding WebKeyboardEvent. |
106 // NOTE: For KeyboardEvent, this is only implemented for keydown, | 90 // NOTE: For KeyboardEvent, this is only implemented for keydown, |
107 // keyup, and keypress. If the event mapping fails, the event type will be set | 91 // keyup, and keypress. If the event mapping fails, the event type will be set |
108 // to Undefined. | 92 // to Undefined. |
109 class WEB_EXPORT WebKeyboardEventBuilder | 93 class WEB_EXPORT WebKeyboardEventBuilder |
110 : NON_EXPORTED_BASE(public WebKeyboardEvent) { | 94 : NON_EXPORTED_BASE(public WebKeyboardEvent) { |
111 public: | 95 public: |
112 WebKeyboardEventBuilder(const KeyboardEvent&); | 96 WebKeyboardEventBuilder(const KeyboardEvent&); |
113 }; | 97 }; |
114 | 98 |
115 // Converts a TouchEvent to a corresponding WebTouchEvent. | 99 // Converts a TouchEvent to a corresponding WebTouchEvent. |
116 // NOTE: WebTouchEvents have a cap on the number of WebTouchPoints. Any points | 100 // NOTE: WebTouchEvents have a cap on the number of WebTouchPoints. Any points |
117 // exceeding that cap will be dropped. | 101 // exceeding that cap will be dropped. |
118 class WEB_EXPORT WebTouchEventBuilder | 102 class WEB_EXPORT WebTouchEventBuilder |
119 : NON_EXPORTED_BASE(public WebTouchEvent) { | 103 : NON_EXPORTED_BASE(public WebTouchEvent) { |
120 public: | 104 public: |
121 WebTouchEventBuilder(const LayoutItem, const TouchEvent&); | 105 WebTouchEventBuilder(const LayoutItem, const TouchEvent&); |
122 }; | 106 }; |
123 | 107 |
124 // Return a new transformed WebGestureEvent by applying the Widget's scale | 108 // Return a new transformed WebGestureEvent by applying the Widget's scale |
125 // and translation. | 109 // and translation. |
126 WEB_EXPORT WebGestureEvent TransformWebGestureEvent(Widget*, | 110 WEB_EXPORT WebGestureEvent TransformWebGestureEvent(Widget*, |
127 const WebGestureEvent&); | 111 const WebGestureEvent&); |
| 112 WEB_EXPORT WebMouseWheelEvent |
| 113 TransformWebMouseWheelEvent(Widget*, const WebMouseWheelEvent&); |
128 | 114 |
129 Vector<PlatformMouseEvent> WEB_EXPORT | 115 Vector<PlatformMouseEvent> WEB_EXPORT |
130 createPlatformMouseEventVector(Widget*, | 116 createPlatformMouseEventVector(Widget*, |
131 const std::vector<const WebInputEvent*>&); | 117 const std::vector<const WebInputEvent*>&); |
132 Vector<PlatformTouchEvent> WEB_EXPORT | 118 Vector<PlatformTouchEvent> WEB_EXPORT |
133 createPlatformTouchEventVector(Widget*, | 119 createPlatformTouchEventVector(Widget*, |
134 const std::vector<const WebInputEvent*>&); | 120 const std::vector<const WebInputEvent*>&); |
135 | 121 |
136 } // namespace blink | 122 } // namespace blink |
137 | 123 |
138 #endif | 124 #endif |
OLD | NEW |