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