| 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/PlatformTouchEvent.h" | |
| 37 #include "sky/engine/public/platform/WebInputEvent.h" | 36 #include "sky/engine/public/platform/WebInputEvent.h" |
| 38 | 37 |
| 39 namespace blink { | 38 namespace blink { |
| 40 | 39 |
| 41 class GestureEvent; | 40 class GestureEvent; |
| 42 class KeyboardEvent; | 41 class KeyboardEvent; |
| 43 class RenderObject; | 42 class RenderObject; |
| 44 class TouchEvent; | |
| 45 class WebKeyboardEvent; | 43 class WebKeyboardEvent; |
| 46 class WebTouchEvent; | |
| 47 class WebGestureEvent; | 44 class WebGestureEvent; |
| 48 class Widget; | 45 class Widget; |
| 49 | 46 |
| 50 // These classes are used to convert from WebInputEvent subclasses to | 47 // These classes are used to convert from WebInputEvent subclasses to |
| 51 // corresponding WebCore events. | 48 // corresponding WebCore events. |
| 52 | 49 |
| 53 class PlatformGestureEventBuilder : public PlatformGestureEvent { | 50 class PlatformGestureEventBuilder : public PlatformGestureEvent { |
| 54 public: | 51 public: |
| 55 PlatformGestureEventBuilder(Widget*, const WebGestureEvent&); | 52 PlatformGestureEventBuilder(Widget*, const WebGestureEvent&); |
| 56 }; | 53 }; |
| 57 | 54 |
| 58 class PlatformKeyboardEventBuilder : public PlatformKeyboardEvent { | 55 class PlatformKeyboardEventBuilder : public PlatformKeyboardEvent { |
| 59 public: | 56 public: |
| 60 PlatformKeyboardEventBuilder(const WebKeyboardEvent&); | 57 PlatformKeyboardEventBuilder(const WebKeyboardEvent&); |
| 61 void setKeyType(Type); | 58 void setKeyType(Type); |
| 62 bool isCharacterKey() const; | 59 bool isCharacterKey() const; |
| 63 }; | 60 }; |
| 64 | 61 |
| 65 // Converts a WebTouchPoint to a PlatformTouchPoint. | |
| 66 class PlatformTouchPointBuilder : public PlatformTouchPoint { | |
| 67 public: | |
| 68 PlatformTouchPointBuilder(Widget*, const WebTouchPoint&); | |
| 69 }; | |
| 70 | |
| 71 // Converts a WebTouchEvent to a PlatformTouchEvent. | |
| 72 class PlatformTouchEventBuilder : public PlatformTouchEvent { | |
| 73 public: | |
| 74 PlatformTouchEventBuilder(Widget*, const WebTouchEvent&); | |
| 75 }; | |
| 76 | |
| 77 // Converts a KeyboardEvent or PlatformKeyboardEvent to a | 62 // Converts a KeyboardEvent or PlatformKeyboardEvent to a |
| 78 // corresponding WebKeyboardEvent. | 63 // corresponding WebKeyboardEvent. |
| 79 // NOTE: For KeyboardEvent, this is only implemented for keydown, | 64 // NOTE: For KeyboardEvent, this is only implemented for keydown, |
| 80 // keyup, and keypress. If the event mapping fails, the event type will be set | 65 // keyup, and keypress. If the event mapping fails, the event type will be set |
| 81 // to Undefined. | 66 // to Undefined. |
| 82 class WebKeyboardEventBuilder : public WebKeyboardEvent { | 67 class WebKeyboardEventBuilder : public WebKeyboardEvent { |
| 83 public: | 68 public: |
| 84 WebKeyboardEventBuilder(const KeyboardEvent&); | 69 WebKeyboardEventBuilder(const KeyboardEvent&); |
| 85 WebKeyboardEventBuilder(const PlatformKeyboardEvent&); | 70 WebKeyboardEventBuilder(const PlatformKeyboardEvent&); |
| 86 }; | 71 }; |
| 87 | 72 |
| 88 // Converts a TouchEvent to a corresponding WebTouchEvent. | |
| 89 // NOTE: WebTouchEvents have a cap on the number of WebTouchPoints. Any points | |
| 90 // exceeding that cap will be dropped. | |
| 91 class WebTouchEventBuilder : public WebTouchEvent { | |
| 92 public: | |
| 93 WebTouchEventBuilder(const Widget*, const RenderObject*, const TouchEvent&); | |
| 94 }; | |
| 95 | |
| 96 // Converts GestureEvent to a corresponding WebGestureEvent. | 73 // Converts GestureEvent to a corresponding WebGestureEvent. |
| 97 // NOTE: If event mapping fails, the type will be set to Undefined. | 74 // NOTE: If event mapping fails, the type will be set to Undefined. |
| 98 class WebGestureEventBuilder : public WebGestureEvent { | 75 class WebGestureEventBuilder : public WebGestureEvent { |
| 99 public: | 76 public: |
| 100 WebGestureEventBuilder(const Widget*, const RenderObject*, const GestureEven
t&); | 77 WebGestureEventBuilder(const Widget*, const RenderObject*, const GestureEven
t&); |
| 101 }; | 78 }; |
| 102 | 79 |
| 103 } // namespace blink | 80 } // namespace blink |
| 104 | 81 |
| 105 #endif // SKY_ENGINE_WEB_WEBINPUTEVENTCONVERSION_H_ | 82 #endif // SKY_ENGINE_WEB_WEBINPUTEVENTCONVERSION_H_ |
| OLD | NEW |