1 | /* |
2 | * Copyright (C) 2011 Benjamin Poulain <[email protected]> |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions |
6 | * are met: |
7 | * 1. Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. |
9 | * 2. Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. |
12 | * |
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
23 | * THE POSSIBILITY OF SUCH DAMAGE. |
24 | */ |
25 | |
26 | #pragma once |
27 | |
28 | #include "WebEvent.h" |
29 | |
30 | #if ENABLE(TOUCH_EVENTS) |
31 | |
32 | #if PLATFORM(IOS_FAMILY) |
33 | #if defined(__OBJC__) |
34 | #include <UIKit/UIKit.h> |
35 | struct _UIWebTouchEvent; |
36 | #endif |
37 | #elif PLATFORM(GTK) |
38 | #include <WebCore/GUniquePtrGtk.h> |
39 | #elif USE(LIBWPE) |
40 | #include <wpe/wpe.h> |
41 | #endif |
42 | |
43 | #endif // ENABLE(TOUCH_EVENTS) |
44 | |
45 | namespace WebKit { |
46 | |
47 | #if ENABLE(TOUCH_EVENTS) |
48 | |
49 | class NativeWebTouchEvent : public WebTouchEvent { |
50 | public: |
51 | #if PLATFORM(IOS_FAMILY) |
52 | #if defined(__OBJC__) |
53 | explicit NativeWebTouchEvent(const _UIWebTouchEvent*, UIKeyModifierFlags); |
54 | #endif |
55 | #elif PLATFORM(GTK) |
56 | NativeWebTouchEvent(GdkEvent*, Vector<WebPlatformTouchPoint>&&); |
57 | NativeWebTouchEvent(const NativeWebTouchEvent&); |
58 | const GdkEvent* nativeEvent() const { return m_nativeEvent.get(); } |
59 | #elif USE(LIBWPE) |
60 | NativeWebTouchEvent(struct wpe_input_touch_event*, float deviceScaleFactor); |
61 | const struct wpe_input_touch_event_raw* nativeFallbackTouchPoint() const { return &m_fallbackTouchPoint; } |
62 | #elif PLATFORM(WIN) |
63 | NativeWebTouchEvent(); |
64 | #endif |
65 | |
66 | private: |
67 | #if PLATFORM(IOS_FAMILY) && defined(__OBJC__) |
68 | Vector<WebPlatformTouchPoint> extractWebTouchPoint(const _UIWebTouchEvent*); |
69 | #endif |
70 | |
71 | #if PLATFORM(GTK) |
72 | GUniquePtr<GdkEvent> m_nativeEvent; |
73 | #elif USE(LIBWPE) |
74 | struct wpe_input_touch_event_raw m_fallbackTouchPoint; |
75 | #endif |
76 | }; |
77 | |
78 | #endif // ENABLE(TOUCH_EVENTS) |
79 | |
80 | #if PLATFORM(IOS_FAMILY) && defined(__OBJC__) |
81 | OptionSet<WebEvent::Modifier> webEventModifierFlags(UIKeyModifierFlags); |
82 | #endif |
83 | |
84 | } // namespace WebKit |
85 | |