| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 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. | |
| 29 */ | |
| 30 | |
| 31 #ifndef WebInputEventConversion_h | |
| 32 #define WebInputEventConversion_h | |
| 33 | |
| 34 #include <vector> | |
| 35 #include "platform/scroll/ScrollTypes.h" | |
| 36 #include "platform/wtf/Compiler.h" | |
| 37 #include "public/platform/WebInputEvent.h" | |
| 38 #include "public/platform/WebKeyboardEvent.h" | |
| 39 #include "public/platform/WebMouseWheelEvent.h" | |
| 40 #include "public/platform/WebTouchEvent.h" | |
| 41 #include "web/WebExport.h" | |
| 42 | |
| 43 namespace blink { | |
| 44 | |
| 45 class FrameView; | |
| 46 class KeyboardEvent; | |
| 47 class MouseEvent; | |
| 48 class LayoutItem; | |
| 49 class TouchEvent; | |
| 50 class WebGestureEvent; | |
| 51 class WebKeyboardEvent; | |
| 52 | |
| 53 // These classes are used to convert from WebInputEvent subclasses to | |
| 54 // corresponding WebCore events. | |
| 55 | |
| 56 | |
| 57 class WEB_EXPORT WebMouseEventBuilder | |
| 58 : NON_EXPORTED_BASE(public WebMouseEvent) { | |
| 59 public: | |
| 60 // Converts a MouseEvent to a corresponding WebMouseEvent. | |
| 61 // NOTE: This is only implemented for mousemove, mouseover, mouseout, | |
| 62 // mousedown and mouseup. If the event mapping fails, the event type will | |
| 63 // be set to Undefined. | |
| 64 WebMouseEventBuilder(const FrameView*, const LayoutItem, const MouseEvent&); | |
| 65 WebMouseEventBuilder(const FrameView*, const LayoutItem, const TouchEvent&); | |
| 66 }; | |
| 67 | |
| 68 // Converts a KeyboardEvent to a corresponding WebKeyboardEvent. | |
| 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 | |
| 71 // to Undefined. | |
| 72 class WEB_EXPORT WebKeyboardEventBuilder | |
| 73 : NON_EXPORTED_BASE(public WebKeyboardEvent) { | |
| 74 public: | |
| 75 WebKeyboardEventBuilder(const KeyboardEvent&); | |
| 76 }; | |
| 77 | |
| 78 // Converts a TouchEvent to a corresponding WebTouchEvent. | |
| 79 // NOTE: WebTouchEvents have a cap on the number of WebTouchPoints. Any points | |
| 80 // exceeding that cap will be dropped. | |
| 81 class WEB_EXPORT WebTouchEventBuilder | |
| 82 : NON_EXPORTED_BASE(public WebTouchEvent) { | |
| 83 public: | |
| 84 WebTouchEventBuilder(const LayoutItem, const TouchEvent&); | |
| 85 }; | |
| 86 | |
| 87 // Return a new transformed WebGestureEvent by applying the Widget's scale | |
| 88 // and translation. | |
| 89 WEB_EXPORT WebGestureEvent TransformWebGestureEvent(FrameView*, | |
| 90 const WebGestureEvent&); | |
| 91 WEB_EXPORT WebMouseEvent TransformWebMouseEvent(FrameView*, | |
| 92 const WebMouseEvent&); | |
| 93 | |
| 94 WEB_EXPORT WebMouseWheelEvent | |
| 95 TransformWebMouseWheelEvent(FrameView*, const WebMouseWheelEvent&); | |
| 96 | |
| 97 WEB_EXPORT WebTouchEvent TransformWebTouchEvent(FrameView*, | |
| 98 const WebTouchEvent&); | |
| 99 | |
| 100 Vector<WebMouseEvent> WEB_EXPORT | |
| 101 TransformWebMouseEventVector(FrameView*, | |
| 102 const std::vector<const WebInputEvent*>&); | |
| 103 Vector<WebTouchEvent> WEB_EXPORT | |
| 104 TransformWebTouchEventVector(FrameView*, | |
| 105 const std::vector<const WebInputEvent*>&); | |
| 106 | |
| 107 } // namespace blink | |
| 108 | |
| 109 #endif | |
| OLD | NEW |