| 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 24 matching lines...) Expand all Loading... |
| 35 #include "public/platform/WebInputEvent.h" | 35 #include "public/platform/WebInputEvent.h" |
| 36 #include "public/platform/WebKeyboardEvent.h" | 36 #include "public/platform/WebKeyboardEvent.h" |
| 37 #include "public/platform/WebMouseWheelEvent.h" | 37 #include "public/platform/WebMouseWheelEvent.h" |
| 38 #include "public/platform/WebTouchEvent.h" | 38 #include "public/platform/WebTouchEvent.h" |
| 39 #include "web/WebExport.h" | 39 #include "web/WebExport.h" |
| 40 #include "wtf/Compiler.h" | 40 #include "wtf/Compiler.h" |
| 41 #include <vector> | 41 #include <vector> |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 class FrameViewBase; |
| 45 class KeyboardEvent; | 46 class KeyboardEvent; |
| 46 class MouseEvent; | 47 class MouseEvent; |
| 47 class LayoutItem; | 48 class LayoutItem; |
| 48 class TouchEvent; | 49 class TouchEvent; |
| 49 class WebGestureEvent; | 50 class WebGestureEvent; |
| 50 class WebKeyboardEvent; | 51 class WebKeyboardEvent; |
| 51 class Widget; | |
| 52 | 52 |
| 53 // These classes are used to convert from WebInputEvent subclasses to | 53 // These classes are used to convert from WebInputEvent subclasses to |
| 54 // corresponding WebCore events. | 54 // corresponding WebCore events. |
| 55 | 55 |
| 56 | 56 |
| 57 class WEB_EXPORT WebMouseEventBuilder | 57 class WEB_EXPORT WebMouseEventBuilder |
| 58 : NON_EXPORTED_BASE(public WebMouseEvent) { | 58 : NON_EXPORTED_BASE(public WebMouseEvent) { |
| 59 public: | 59 public: |
| 60 // Converts a MouseEvent to a corresponding WebMouseEvent. | 60 // Converts a MouseEvent to a corresponding WebMouseEvent. |
| 61 // NOTE: This is only implemented for mousemove, mouseover, mouseout, | 61 // NOTE: This is only implemented for mousemove, mouseover, mouseout, |
| 62 // mousedown and mouseup. If the event mapping fails, the event type will | 62 // mousedown and mouseup. If the event mapping fails, the event type will |
| 63 // be set to Undefined. | 63 // be set to Undefined. |
| 64 WebMouseEventBuilder(const Widget*, const LayoutItem, const MouseEvent&); | 64 WebMouseEventBuilder(const FrameViewBase*, const LayoutItem, const MouseEvent&
); |
| 65 WebMouseEventBuilder(const Widget*, const LayoutItem, const TouchEvent&); | 65 WebMouseEventBuilder(const FrameViewBase*, const LayoutItem, const TouchEvent&
); |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 // Converts a KeyboardEvent to a corresponding WebKeyboardEvent. | 68 // Converts a KeyboardEvent to a corresponding WebKeyboardEvent. |
| 69 // NOTE: For KeyboardEvent, this is only implemented for keydown, | 69 // NOTE: For KeyboardEvent, this is only implemented for keydown, |
| 70 // keyup, and keypress. If the event mapping fails, the event type will be set | 70 // keyup, and keypress. If the event mapping fails, the event type will be set |
| 71 // to Undefined. | 71 // to Undefined. |
| 72 class WEB_EXPORT WebKeyboardEventBuilder | 72 class WEB_EXPORT WebKeyboardEventBuilder |
| 73 : NON_EXPORTED_BASE(public WebKeyboardEvent) { | 73 : NON_EXPORTED_BASE(public WebKeyboardEvent) { |
| 74 public: | 74 public: |
| 75 WebKeyboardEventBuilder(const KeyboardEvent&); | 75 WebKeyboardEventBuilder(const KeyboardEvent&); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 // Converts a TouchEvent to a corresponding WebTouchEvent. | 78 // Converts a TouchEvent to a corresponding WebTouchEvent. |
| 79 // NOTE: WebTouchEvents have a cap on the number of WebTouchPoints. Any points | 79 // NOTE: WebTouchEvents have a cap on the number of WebTouchPoints. Any points |
| 80 // exceeding that cap will be dropped. | 80 // exceeding that cap will be dropped. |
| 81 class WEB_EXPORT WebTouchEventBuilder | 81 class WEB_EXPORT WebTouchEventBuilder |
| 82 : NON_EXPORTED_BASE(public WebTouchEvent) { | 82 : NON_EXPORTED_BASE(public WebTouchEvent) { |
| 83 public: | 83 public: |
| 84 WebTouchEventBuilder(const LayoutItem, const TouchEvent&); | 84 WebTouchEventBuilder(const LayoutItem, const TouchEvent&); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 // Return a new transformed WebGestureEvent by applying the Widget's scale | 87 // Return a new transformed WebGestureEvent by applying the Widget's scale |
| 88 // and translation. | 88 // and translation. |
| 89 WEB_EXPORT WebGestureEvent TransformWebGestureEvent(Widget*, | 89 WEB_EXPORT WebGestureEvent TransformWebGestureEvent(FrameViewBase*, |
| 90 const WebGestureEvent&); | 90 const WebGestureEvent&); |
| 91 WEB_EXPORT WebMouseEvent TransformWebMouseEvent(Widget*, const WebMouseEvent&); | 91 WEB_EXPORT WebMouseEvent TransformWebMouseEvent(FrameViewBase*, const WebMouseEv
ent&); |
| 92 | 92 |
| 93 WEB_EXPORT WebMouseWheelEvent | 93 WEB_EXPORT WebMouseWheelEvent |
| 94 TransformWebMouseWheelEvent(Widget*, const WebMouseWheelEvent&); | 94 TransformWebMouseWheelEvent(FrameViewBase*, const WebMouseWheelEvent&); |
| 95 | 95 |
| 96 WEB_EXPORT WebTouchEvent TransformWebTouchEvent(Widget*, const WebTouchEvent&); | 96 WEB_EXPORT WebTouchEvent TransformWebTouchEvent(FrameViewBase*, const WebTouchEv
ent&); |
| 97 | 97 |
| 98 Vector<WebMouseEvent> WEB_EXPORT | 98 Vector<WebMouseEvent> WEB_EXPORT |
| 99 TransformWebMouseEventVector(Widget*, const std::vector<const WebInputEvent*>&); | 99 TransformWebMouseEventVector(FrameViewBase*, const std::vector<const WebInputEve
nt*>&); |
| 100 Vector<WebTouchEvent> WEB_EXPORT | 100 Vector<WebTouchEvent> WEB_EXPORT |
| 101 TransformWebTouchEventVector(Widget*, const std::vector<const WebInputEvent*>&); | 101 TransformWebTouchEventVector(FrameViewBase*, const std::vector<const WebInputEve
nt*>&); |
| 102 | 102 |
| 103 } // namespace blink | 103 } // namespace blink |
| 104 | 104 |
| 105 #endif | 105 #endif |
| OLD | NEW |