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