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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #ifndef WebInputEventConversion_h | 31 #ifndef WebInputEventConversion_h |
32 #define WebInputEventConversion_h | 32 #define WebInputEventConversion_h |
33 | 33 |
34 #include "platform/PlatformGestureEvent.h" | 34 #include "platform/PlatformGestureEvent.h" |
35 #include "platform/PlatformKeyboardEvent.h" | 35 #include "platform/PlatformKeyboardEvent.h" |
36 #include "platform/PlatformMouseEvent.h" | 36 #include "platform/PlatformMouseEvent.h" |
37 #include "platform/PlatformTouchEvent.h" | 37 #include "platform/PlatformTouchEvent.h" |
38 #include "platform/PlatformWheelEvent.h" | 38 #include "platform/PlatformWheelEvent.h" |
39 #include "public/web/WebInputEvent.h" | 39 #include "public/web/WebInputEvent.h" |
| 40 #include "wtf/Allocator.h" |
40 | 41 |
41 namespace blink { | 42 namespace blink { |
42 | 43 |
43 class GestureEvent; | 44 class GestureEvent; |
44 class KeyboardEvent; | 45 class KeyboardEvent; |
45 class MouseEvent; | 46 class MouseEvent; |
46 class LayoutObject; | 47 class LayoutObject; |
47 class TouchEvent; | 48 class TouchEvent; |
48 class WebMouseEvent; | 49 class WebMouseEvent; |
49 class WebMouseWheelEvent; | 50 class WebMouseWheelEvent; |
50 class WebKeyboardEvent; | 51 class WebKeyboardEvent; |
51 class WebTouchEvent; | 52 class WebTouchEvent; |
52 class WebGestureEvent; | 53 class WebGestureEvent; |
53 class WheelEvent; | 54 class WheelEvent; |
54 class Widget; | 55 class Widget; |
55 | 56 |
56 // These classes are used to convert from WebInputEvent subclasses to | 57 // These classes are used to convert from WebInputEvent subclasses to |
57 // corresponding WebCore events. | 58 // corresponding WebCore events. |
58 | 59 |
59 class PlatformMouseEventBuilder : public PlatformMouseEvent { | 60 class PlatformMouseEventBuilder : public PlatformMouseEvent { |
| 61 DISALLOW_ALLOCATION(); |
60 public: | 62 public: |
61 PlatformMouseEventBuilder(Widget*, const WebMouseEvent&); | 63 PlatformMouseEventBuilder(Widget*, const WebMouseEvent&); |
62 }; | 64 }; |
63 | 65 |
64 class PlatformWheelEventBuilder : public PlatformWheelEvent { | 66 class PlatformWheelEventBuilder : public PlatformWheelEvent { |
| 67 DISALLOW_ALLOCATION(); |
65 public: | 68 public: |
66 PlatformWheelEventBuilder(Widget*, const WebMouseWheelEvent&); | 69 PlatformWheelEventBuilder(Widget*, const WebMouseWheelEvent&); |
67 }; | 70 }; |
68 | 71 |
69 class PlatformGestureEventBuilder : public PlatformGestureEvent { | 72 class PlatformGestureEventBuilder : public PlatformGestureEvent { |
| 73 DISALLOW_ALLOCATION(); |
70 public: | 74 public: |
71 PlatformGestureEventBuilder(Widget*, const WebGestureEvent&); | 75 PlatformGestureEventBuilder(Widget*, const WebGestureEvent&); |
72 }; | 76 }; |
73 | 77 |
74 class PlatformKeyboardEventBuilder : public PlatformKeyboardEvent { | 78 class PlatformKeyboardEventBuilder : public PlatformKeyboardEvent { |
| 79 DISALLOW_ALLOCATION(); |
75 public: | 80 public: |
76 PlatformKeyboardEventBuilder(const WebKeyboardEvent&); | 81 PlatformKeyboardEventBuilder(const WebKeyboardEvent&); |
77 void setKeyType(Type); | 82 void setKeyType(Type); |
78 bool isCharacterKey() const; | 83 bool isCharacterKey() const; |
79 }; | 84 }; |
80 | 85 |
81 // Converts a WebTouchPoint to a PlatformTouchPoint. | 86 // Converts a WebTouchPoint to a PlatformTouchPoint. |
82 class PlatformTouchPointBuilder : public PlatformTouchPoint { | 87 class PlatformTouchPointBuilder : public PlatformTouchPoint { |
| 88 DISALLOW_ALLOCATION(); |
83 public: | 89 public: |
84 PlatformTouchPointBuilder(Widget*, const WebTouchPoint&); | 90 PlatformTouchPointBuilder(Widget*, const WebTouchPoint&); |
85 }; | 91 }; |
86 | 92 |
87 // Converts a WebTouchEvent to a PlatformTouchEvent. | 93 // Converts a WebTouchEvent to a PlatformTouchEvent. |
88 class PlatformTouchEventBuilder : public PlatformTouchEvent { | 94 class PlatformTouchEventBuilder : public PlatformTouchEvent { |
| 95 DISALLOW_ALLOCATION(); |
89 public: | 96 public: |
90 PlatformTouchEventBuilder(Widget*, const WebTouchEvent&); | 97 PlatformTouchEventBuilder(Widget*, const WebTouchEvent&); |
91 }; | 98 }; |
92 | 99 |
93 class WebMouseEventBuilder : public WebMouseEvent { | 100 class WebMouseEventBuilder : public WebMouseEvent { |
| 101 WTF_MAKE_FAST_ALLOCATED(WebMouseEventBuilder); |
94 public: | 102 public: |
95 // Converts a MouseEvent to a corresponding WebMouseEvent. | 103 // Converts a MouseEvent to a corresponding WebMouseEvent. |
96 // NOTE: This is only implemented for mousemove, mouseover, mouseout, | 104 // NOTE: This is only implemented for mousemove, mouseover, mouseout, |
97 // mousedown and mouseup. If the event mapping fails, the event type will | 105 // mousedown and mouseup. If the event mapping fails, the event type will |
98 // be set to Undefined. | 106 // be set to Undefined. |
99 WebMouseEventBuilder(const Widget*, const LayoutObject*, const MouseEvent&); | 107 WebMouseEventBuilder(const Widget*, const LayoutObject*, const MouseEvent&); |
100 WebMouseEventBuilder(const Widget*, const LayoutObject*, const TouchEvent&); | 108 WebMouseEventBuilder(const Widget*, const LayoutObject*, const TouchEvent&); |
101 }; | 109 }; |
102 | 110 |
103 // Converts a WheelEvent to a corresponding WebMouseWheelEvent. | 111 // Converts a WheelEvent to a corresponding WebMouseWheelEvent. |
104 // If the event mapping fails, the event type will be set to Undefined. | 112 // If the event mapping fails, the event type will be set to Undefined. |
105 class WebMouseWheelEventBuilder : public WebMouseWheelEvent { | 113 class WebMouseWheelEventBuilder : public WebMouseWheelEvent { |
| 114 WTF_MAKE_FAST_ALLOCATED(WebMouseWheelEventBuilder); |
106 public: | 115 public: |
107 WebMouseWheelEventBuilder(const Widget*, const LayoutObject*, const WheelEve
nt&); | 116 WebMouseWheelEventBuilder(const Widget*, const LayoutObject*, const WheelEve
nt&); |
108 }; | 117 }; |
109 | 118 |
110 // Converts a KeyboardEvent or PlatformKeyboardEvent to a | 119 // Converts a KeyboardEvent or PlatformKeyboardEvent to a |
111 // corresponding WebKeyboardEvent. | 120 // corresponding WebKeyboardEvent. |
112 // NOTE: For KeyboardEvent, this is only implemented for keydown, | 121 // NOTE: For KeyboardEvent, this is only implemented for keydown, |
113 // keyup, and keypress. If the event mapping fails, the event type will be set | 122 // keyup, and keypress. If the event mapping fails, the event type will be set |
114 // to Undefined. | 123 // to Undefined. |
115 class WebKeyboardEventBuilder : public WebKeyboardEvent { | 124 class WebKeyboardEventBuilder : public WebKeyboardEvent { |
| 125 WTF_MAKE_FAST_ALLOCATED(WebKeyboardEventBuilder); |
116 public: | 126 public: |
117 WebKeyboardEventBuilder(const KeyboardEvent&); | 127 WebKeyboardEventBuilder(const KeyboardEvent&); |
118 }; | 128 }; |
119 | 129 |
120 // Converts a TouchEvent to a corresponding WebTouchEvent. | 130 // Converts a TouchEvent to a corresponding WebTouchEvent. |
121 // NOTE: WebTouchEvents have a cap on the number of WebTouchPoints. Any points | 131 // NOTE: WebTouchEvents have a cap on the number of WebTouchPoints. Any points |
122 // exceeding that cap will be dropped. | 132 // exceeding that cap will be dropped. |
123 class WebTouchEventBuilder : public WebTouchEvent { | 133 class WebTouchEventBuilder : public WebTouchEvent { |
| 134 DISALLOW_ALLOCATION(); |
124 public: | 135 public: |
125 WebTouchEventBuilder(const LayoutObject*, const TouchEvent&); | 136 WebTouchEventBuilder(const LayoutObject*, const TouchEvent&); |
126 }; | 137 }; |
127 | 138 |
128 // Converts GestureEvent to a corresponding WebGestureEvent. | 139 // Converts GestureEvent to a corresponding WebGestureEvent. |
129 // NOTE: If event mapping fails, the type will be set to Undefined. | 140 // NOTE: If event mapping fails, the type will be set to Undefined. |
130 class WebGestureEventBuilder : public WebGestureEvent { | 141 class WebGestureEventBuilder : public WebGestureEvent { |
| 142 DISALLOW_ALLOCATION(); |
131 public: | 143 public: |
132 WebGestureEventBuilder(const LayoutObject*, const GestureEvent&); | 144 WebGestureEventBuilder(const LayoutObject*, const GestureEvent&); |
133 }; | 145 }; |
134 | 146 |
135 unsigned toPlatformMouseEventModifiers(int webModifiers); | 147 unsigned toPlatformMouseEventModifiers(int webModifiers); |
136 | 148 |
137 } // namespace blink | 149 } // namespace blink |
138 | 150 |
139 #endif | 151 #endif |
OLD | NEW |