Changeset 163749 in webkit
- Timestamp:
- Feb 9, 2014 2:55:50 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 28 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r163701 r163749 1 2014-02-09 Carlos Garnacho <carlosg@gnome.org> 2 3 [GTK] Enable touch features 4 https://bugs.webkit.org/show_bug.cgi?id=98931 5 6 Reviewed by Carlos Garcia Campos. 7 8 * Source/autotools/SetupWebKitFeatures.m4: 9 * Source/cmake/OptionsGTK.cmake: set ENABLE_TOUCH_EVENTS to 1 if building with GTK+. 10 1 11 2014-02-06 Andreas Kling <akling@apple.com> 2 12 -
trunk/LayoutTests/ChangeLog
r163742 r163749 1 2014-02-09 Carlos Garnacho <carlosg@gnome.org> 2 3 [GTK] Enable touch features 4 https://bugs.webkit.org/show_bug.cgi?id=98931 5 6 Reviewed by Carlos Garcia Campos. 7 8 * platform/gtk/TestExpectations: remove fast/events/touch 9 * platform/gtk-wk2/TestExpectations: Add new expectations on 10 fast/events/touch events. 11 1 12 2014-02-08 Brady Eidson <beidson@apple.com> 2 13 -
trunk/LayoutTests/platform/gtk-wk1/TestExpectations
r162963 r163749 258 258 Bug(GTK) http/tests/download [ Failure ] 259 259 260 # Touch support only implemented in WK2 261 fast/events/touch [ Skip ] 262 260 263 #//////////////////////////////////////////////////////////////////////////////////////// 261 264 # End of Tests failing -
trunk/LayoutTests/platform/gtk-wk2/TestExpectations
r163619 r163749 186 186 webkit.org/b/120401 fast/events [ Skip ] 187 187 webkit.org/b/120401 editing/selection [ Skip ] 188 189 # Tests in the gesture folder exercise IOS-specific code, non appliable to GTK+ 190 fast/events/touch/gesture [ Skip ] 191 192 # These tests rely on touch event grouping, which X11/GTK+ doesn't do by design 193 webkit.org/b/128172 fast/events/touch/basic-multi-touch-events-limited.html [ Failure ] 194 webkit.org/b/128172 fast/events/touch/basic-multi-touch-events.html [ Failure ] 195 webkit.org/b/128172 fast/events/touch/touch-input-element-change-documents.html [ Failure ] 196 webkit.org/b/128172 fast/events/touch/frame-hover-update.html [ Failure ] 197 webkit.org/b/128172 fast/events/touch/multi-touch-grouped-targets.html [ Timeout Failure ] 198 webkit.org/b/128172 fast/events/touch/multi-touch-inside-nested-iframes.html [ Timeout ] 199 webkit.org/b/128172 fast/events/touch/multi-touch-inside-iframes.html [ Timeout ] 200 webkit.org/b/128172 fast/events/touch/basic-single-touch-events.html [ Timeout ] 201 webkit.org/b/128172 fast/events/touch/page-scaled-touch-gesture-click.html [ Timeout ] 202 webkit.org/b/128172 fast/events/touch/touch-target.html [ Timeout ] 203 webkit.org/b/128172 fast/events/touch/touch-target-limited.html [ Timeout ] 204 webkit.org/b/128172 fast/events/touch/send-oncancel-event.html [ Timeout ] 188 205 189 206 #//////////////////////////////////////////////////////////////////////////////////////// -
trunk/LayoutTests/platform/gtk/TestExpectations
r163620 r163749 153 153 webkit.org/b/61140 fast/notifications [ Skip ] 154 154 webkit.org/b/61140 http/tests/notifications [ Skip ] 155 156 # These tests require touch support.157 webkit.org/b/98931 fast/events/touch [ Skip ]158 155 159 156 # StorageTracker is not enabled. -
trunk/Source/WebCore/ChangeLog
r163747 r163749 1 2014-02-09 Carlos Garnacho <carlosg@gnome.org> 2 3 [GTK] Add touch-events related code to build 4 https://bugs.webkit.org/show_bug.cgi?id=98931 5 6 Reviewed by Carlos Garcia Campos. 7 8 Tests in fast/events/touch have been enabled on GTK+ now that touch 9 support is implemented, and thus all expected bits are there. 10 11 * platform/gtk/GtkTouchContextHelper.cpp: 12 * platform/gtk/GtkTouchContextHelper.h: Add helper object to track all touchpoints, handy 13 when creating WebTouchEvents. 14 * GNUmakefile.list.am: 15 * PlatformGTK.cmake: 16 * bindings/gobject/GNUmakefile.am: Add touch related code and idls to build, those are 17 necessary now that GTK+ implements touch events. 18 1 19 2014-02-09 Zan Dobersek <zdobersek@igalia.com> 2 20 -
trunk/Source/WebCore/GNUmakefile.list.am
r163649 r163749 2998 2998 Source/WebCore/dom/TextNodeTraversal.h \ 2999 2999 Source/WebCore/dom/Text.h \ 3000 Source/WebCore/dom/Touch.cpp \ 3000 3001 Source/WebCore/dom/Touch.h \ 3002 Source/WebCore/dom/TouchEvent.cpp \ 3001 3003 Source/WebCore/dom/TouchEvent.h \ 3004 Source/WebCore/dom/TouchList.cpp \ 3002 3005 Source/WebCore/dom/TouchList.h \ 3003 3006 Source/WebCore/dom/TransformSource.h \ … … 6179 6182 Source/WebCore/platform/gtk/GtkPopupMenu.cpp \ 6180 6183 Source/WebCore/platform/gtk/GtkPopupMenu.h \ 6184 Source/WebCore/platform/gtk/GtkTouchContextHelper.cpp \ 6185 Source/WebCore/platform/gtk/GtkTouchContextHelper.h \ 6181 6186 Source/WebCore/platform/gtk/GtkUtilities.cpp \ 6182 6187 Source/WebCore/platform/gtk/GtkUtilities.h \ -
trunk/Source/WebCore/PlatformGTK.cmake
r163687 r163749 203 203 platform/gtk/GtkPluginWidget.cpp 204 204 platform/gtk/GtkPopupMenu.cpp 205 platform/gtk/GtkTouchContextHelper.cpp 205 206 platform/gtk/GtkUtilities.cpp 206 207 platform/gtk/GtkVersioning.c … … 530 531 dom/ShadowRoot.idl 531 532 dom/Text.idl 533 dom/Touch.idl 532 534 dom/TreeWalker.idl 533 535 dom/UIEvent.idl -
trunk/Source/WebCore/bindings/gobject/GNUmakefile.am
r163440 r163749 263 263 DerivedSources/webkitdom/WebKitDOMText.cpp \ 264 264 DerivedSources/webkitdom/WebKitDOMTextPrivate.h \ 265 DerivedSources/webkitdom/WebKitDOMTouch.cpp \ 266 DerivedSources/webkitdom/WebKitDOMTouchPrivate.h \ 265 267 DerivedSources/webkitdom/WebKitDOMTimeRanges.cpp \ 266 268 DerivedSources/webkitdom/WebKitDOMTimeRangesPrivate.h \ … … 324 326 DerivedSources/webkitdom/WebKitDOMRange.h \ 325 327 DerivedSources/webkitdom/WebKitDOMText.h \ 328 DerivedSources/webkitdom/WebKitDOMTouch.h \ 326 329 DerivedSources/webkitdom/WebKitDOMTreeWalker.h \ 327 330 DerivedSources/webkitdom/WebKitDOMUIEvent.h \ -
trunk/Source/WebCore/bindings/gobject/webkitdom.symbols
r161111 r163749 105 105 WebKitDOMXPathExpression* webkit_dom_document_create_expression(WebKitDOMDocument*, const gchar*, WebKitDOMXPathNSResolver*, GError**) 106 106 WebKitDOMXPathNSResolver* webkit_dom_document_create_ns_resolver(WebKitDOMDocument*, WebKitDOMNode*) 107 WebKitDOMTouch* webkit_dom_document_create_touch(WebKitDOMDocument*, WebKitDOMDOMWindow*, WebKitDOMEventTarget*, glong, glong, glong, glong, glong, glong, glong, gfloat, gfloat, GError**) 107 108 WebKitDOMXPathResult* webkit_dom_document_evaluate(WebKitDOMDocument*, const gchar*, WebKitDOMNode*, WebKitDOMXPathNSResolver*, gushort, WebKitDOMXPathResult*, GError**) 108 109 gboolean webkit_dom_document_exec_command(WebKitDOMDocument*, const gchar*, gboolean, const gchar*) … … 1663 1664 glong webkit_dom_wheel_event_get_wheel_delta(WebKitDOMWheelEvent*) 1664 1665 gboolean webkit_dom_wheel_event_get_webkit_direction_inverted_from_device(WebKitDOMWheelEvent*) 1666 WebKitDOMEventTarget* webkit_dom_touch_get_target(WebKitDOMTouch*) 1667 gfloat webkit_dom_touch_get_webkit_force(WebKitDOMTouch*) 1668 gfloat webkit_dom_touch_get_webkit_rotation_angle(WebKitDOMTouch*) 1669 glong webkit_dom_touch_get_client_x(WebKitDOMTouch*) 1670 glong webkit_dom_touch_get_client_y(WebKitDOMTouch*) 1671 glong webkit_dom_touch_get_page_x(WebKitDOMTouch*) 1672 glong webkit_dom_touch_get_page_y(WebKitDOMTouch*) 1673 glong webkit_dom_touch_get_screen_x(WebKitDOMTouch*) 1674 glong webkit_dom_touch_get_screen_y(WebKitDOMTouch*) 1675 glong webkit_dom_touch_get_webkit_radius_x(WebKitDOMTouch*) 1676 glong webkit_dom_touch_get_webkit_radius_y(WebKitDOMTouch*) 1677 gulong webkit_dom_touch_get_identifier(WebKitDOMTouch*) 1665 1678 gchar* webkit_dom_audio_track_get_id(WebKitDOMAudioTrack*) 1666 1679 gchar* webkit_dom_audio_track_get_kind(WebKitDOMAudioTrack*) -
trunk/Source/WebCore/platform/gtk/GtkTouchContextHelper.cpp
r163748 r163749 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. 2 * Copyright (C) 2013 Carlos Garnacho <carlosg@gnome.org> 4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 25 24 */ 26 25 27 #i fndef WebEventFactory_h28 # define WebEventFactory_h26 #include "config.h" 27 #include "GtkTouchContextHelper.h" 29 28 30 #include "WebEvent.h" 31 #include <WebCore/CompositionResults.h> 29 #include <gtk/gtk.h> 32 30 33 typedef union _GdkEvent GdkEvent; 31 namespace WebCore { 34 32 35 namespace WebKit { 33 bool GtkTouchContextHelper::handleEvent(GdkEvent* touchEvent) 34 { 35 #ifndef GTK_API_VERSION_2 36 uint32_t sequence = GPOINTER_TO_UINT(gdk_event_get_event_sequence(touchEvent)); 36 37 37 class WebEventFactory { 38 public: 39 static WebMouseEvent createWebMouseEvent(const GdkEvent*, int); 40 static WebWheelEvent createWebWheelEvent(const GdkEvent*); 41 static WebKeyboardEvent createWebKeyboardEvent(const GdkEvent*, const WebCore::CompositionResults&); 42 }; 38 switch (touchEvent->type) { 39 case GDK_TOUCH_BEGIN: { 40 ASSERT(m_touchEvents.contains(sequence)); 41 GUniquePtr<GdkEvent> event(gdk_event_copy(touchEvent)); 42 m_touchEvents.add(sequence, std::move(event)); 43 break; 44 } 45 case GDK_TOUCH_UPDATE: { 46 auto it = m_touchEvents.find(sequence); 47 ASSERT(it != m_touchEvents.end()); 48 it->value.reset(gdk_event_copy(touchEvent)); 49 break; 50 } 51 case GDK_TOUCH_END: 52 ASSERT(m_touchEvents.contains(sequence)); 53 m_touchEvents.remove(sequence); 54 break; 55 default: 56 return false; 57 } 58 #endif // GTK_API_VERSION_2 43 59 44 } // namespace WebKit 60 return true; 61 } 45 62 46 #endif // WebEventFactory_h 63 } // namespace WebCore -
trunk/Source/WebCore/platform/gtk/GtkTouchContextHelper.h
r163748 r163749 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. 2 * Copyright (C) 2013 Carlos Garnacho <carlosg@gnome.org> 4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 25 24 */ 26 25 27 #ifndef WebEventFactory_h28 #define WebEventFactory_h26 #ifndef GtkTouchContextHelper_h 27 #define GtkTouchContextHelper_h 29 28 30 #include "WebEvent.h" 31 #include <WebCore/CompositionResults.h> 29 #include "GUniquePtrGtk.h" 30 #include <wtf/HashMap.h> 31 #include <wtf/Noncopyable.h> 32 32 33 typedef union _GdkEvent GdkEvent; 33 namespace WebCore { 34 34 35 namespace WebKit { 35 typedef HashMap<uint32_t, GUniquePtr<GdkEvent>> TouchEventsMap; 36 36 37 class WebEventFactory { 37 class GtkTouchContextHelper { 38 WTF_MAKE_NONCOPYABLE(GtkTouchContextHelper); 38 39 public: 39 static WebMouseEvent createWebMouseEvent(const GdkEvent*, int); 40 static WebWheelEvent createWebWheelEvent(const GdkEvent*); 41 static WebKeyboardEvent createWebKeyboardEvent(const GdkEvent*, const WebCore::CompositionResults&); 40 GtkTouchContextHelper() { }; 41 bool handleEvent(GdkEvent*); 42 const TouchEventsMap& touchEvents() const { return m_touchEvents; }; 43 44 private: 45 TouchEventsMap m_touchEvents; 42 46 }; 43 47 44 } // namespace Web Kit48 } // namespace WebCore 45 49 46 #endif // WebEventFactory_h50 #endif -
trunk/Source/WebKit/gtk/ChangeLog
r163739 r163749 1 2014-02-09 Carlos Garnacho <carlosg@gnome.org> 2 3 [GTK] Allow building with touch events enabled 4 https://bugs.webkit.org/show_bug.cgi?id=98931 5 6 Reviewed by Carlos Garcia Campos. 7 8 Even though WebKit1 GTK code doesn't implement touch events, 9 Fix build if ENABLE_TOUCH_EVENTS is present for WK2. 10 11 * WebCoreSupport/ChromeClientGtk.h: 12 (WebKit::ChromeClient::needTouchEvents): Add empty stub 13 1 14 2014-02-08 Ryosuke Niwa <rniwa@webkit.org> 2 15 -
trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
r163724 r163749 142 142 143 143 virtual void numWheelEventHandlersChanged(unsigned) { } 144 virtual void needTouchEvents(bool) { } 144 145 145 146 virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*); -
trunk/Source/WebKit2/ChangeLog
r163748 r163749 1 2014-02-09 Carlos Garnacho <carlosg@gnome.org> 2 3 [GTK] Implement support touch events 4 https://bugs.webkit.org/show_bug.cgi?id=98931 5 6 Reviewed by Carlos Garcia Campos. 7 8 In GTK+ >= 3.4.0, GdkEventTouch is available to inform about multitouch events. Use these to implement 9 touch events on this platform. If a touch is left unhandled and is the "pointer emulating" one, mouse 10 events will be generated as a fallback. 11 12 * GNUmakefile.list.am: 13 * PlatformGTK.cmake: 14 * Shared/gtk/NativeWebTouchEventGtk.cpp: 15 * Shared/NativeWebTouchEvent.h: 16 (WebKit::NativeWebTouchEvent::nativeEvent): 17 (WebKit::NativeWebTouchEvent::touchContext): Add GTK+ implementation of NativeWebTouchEvent. 18 * Shared/gtk/WebEventFactory.cpp: 19 (WebKit::touchPhaseFromEvents): 20 (WebKit::WebEventFactory::createWebTouchEvent): Add methods to generate WebTouchEvents out 21 of GdkEventTouch events, a GtkTouchContextHelper object is used to hold information about all current 22 touches, in order to build information about all individual touchpoints. 23 * Shared/gtk/WebEventFactory.h: 24 * UIProcess/API/gtk/PageClientImpl.cpp: 25 (WebKit::PageClientImpl::doneWithTouchEvent): Implement pointer emulation. If a touch event was unhandled 26 in DOM and pertains to the touch sequence that emulates pointer events. The event gets transformed to its 27 mouse event counterpart and handled by the widget again. 28 * UIProcess/API/gtk/PageClientImpl.h: 29 * UIProcess/API/gtk/WebKitWebViewBase.cpp: 30 (webkitWebViewBaseRealize): Listen for touch events 31 (webkitWebViewBaseTouchEvent): 32 (webkit_web_view_base_class_init): Add implementation for the touch_events() handler, this merely 33 lets the pageProxy handle the NativeWebTouchEvent we create to wrap the GdkEvent received. 34 1 35 2014-02-09 Commit Queue <commit-queue@webkit.org> 2 36 -
trunk/Source/WebKit2/GNUmakefile.list.am
r163521 r163749 385 385 Source/WebKit2/Shared/gtk/NativeWebKeyboardEventGtk.cpp \ 386 386 Source/WebKit2/Shared/gtk/NativeWebMouseEventGtk.cpp \ 387 Source/WebKit2/Shared/gtk/NativeWebTouchEventGtk.cpp \ 387 388 Source/WebKit2/Shared/gtk/NativeWebWheelEventGtk.cpp \ 388 389 Source/WebKit2/Shared/gtk/PrintInfoGtk.cpp \ -
trunk/Source/WebKit2/PlatformGTK.cmake
r163155 r163749 57 57 Shared/gtk/NativeWebKeyboardEventGtk.cpp 58 58 Shared/gtk/NativeWebMouseEventGtk.cpp 59 Shared/gtk/NativeWebTouchEventGtk.cpp 59 60 Shared/gtk/NativeWebWheelEventGtk.cpp 60 61 Shared/gtk/PrintInfoGtk.cpp … … 566 567 Shared/WebKit2Initialize.cpp 567 568 Shared/WebMouseEvent.cpp 569 Shared/WebPlatformTouchPoint.cpp 570 Shared/WebTouchEvent.cpp 568 571 Shared/WebWheelEvent.cpp 569 572 … … 584 587 Shared/gtk/NativeWebKeyboardEventGtk.cpp 585 588 Shared/gtk/NativeWebMouseEventGtk.cpp 589 Shared/gtk/NativeWebTouchEventGtk.cpp 586 590 Shared/gtk/NativeWebWheelEventGtk.cpp 587 591 Shared/gtk/ProcessExecutablePathGtk.cpp -
trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h
r159985 r163749 32 32 #include <wtf/RetainPtr.h> 33 33 OBJC_CLASS UIWebTouchEventsGestureRecognizer; 34 #endif // PLATFORM(IOS) 35 36 #if PLATFORM(EFL) 34 #elif PLATFORM(GTK) 35 #include <WebCore/GUniquePtrGtk.h> 36 #include <WebCore/GtkTouchContextHelper.h> 37 #elif PLATFORM(EFL) 37 38 #include "EwkTouchEvent.h" 38 39 #include <WebCore/AffineTransform.h> … … 47 48 explicit NativeWebTouchEvent(UIWebTouchEventsGestureRecognizer *); 48 49 const UIWebTouchEventsGestureRecognizer* nativeEvent() const { return m_nativeEvent.get(); } 49 #endif 50 #if PLATFORM(EFL) 50 #elif PLATFORM(GTK) 51 NativeWebTouchEvent(const NativeWebTouchEvent&); 52 NativeWebTouchEvent(GdkEvent*, WebCore::GtkTouchContextHelper&); 53 const GdkEvent* nativeEvent() const { return m_nativeEvent.get(); } 54 const WebCore::GtkTouchContextHelper& touchContext() const { return m_touchContext; } 55 #elif PLATFORM(EFL) 51 56 NativeWebTouchEvent(EwkTouchEvent*, const WebCore::AffineTransform&); 52 57 const EwkTouchEvent* nativeEvent() const { return m_nativeEvent.get(); } … … 56 61 #if PLATFORM(IOS) 57 62 RetainPtr<UIWebTouchEventsGestureRecognizer> m_nativeEvent; 58 #endif 59 #if PLATFORM(EFL) 63 #elif PLATFORM(GTK) 64 GUniquePtr<GdkEvent> m_nativeEvent; 65 const WebCore::GtkTouchContextHelper& m_touchContext; 66 #elif PLATFORM(EFL) 60 67 RefPtr<EwkTouchEvent> m_nativeEvent; 61 68 #endif -
trunk/Source/WebKit2/Shared/gtk/NativeWebTouchEventGtk.cpp
r163748 r163749 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 * Portions Copyright (c) 2010 Motorola Mobility, Inc. All rights reserved. 2 * Copyright (C) 2013 Carlos Garnacho <carlosg@gnome.org> 4 3 * 5 4 * Redistribution and use in source and binary forms, with or without … … 25 24 */ 26 25 27 #i fndef WebEventFactory_h28 # define WebEventFactory_h26 #include "config.h" 27 #include "NativeWebTouchEvent.h" 29 28 30 #include "WebEvent.h" 31 #include <WebCore/CompositionResults.h> 32 33 typedef union _GdkEvent GdkEvent; 29 #include "WebEventFactory.h" 30 #include <gdk/gdk.h> 34 31 35 32 namespace WebKit { 36 33 37 class WebEventFactory { 38 public: 39 static WebMouseEvent createWebMouseEvent(const GdkEvent*, int); 40 static WebWheelEvent createWebWheelEvent(const GdkEvent*); 41 static WebKeyboardEvent createWebKeyboardEvent(const GdkEvent*, const WebCore::CompositionResults&); 42 }; 34 NativeWebTouchEvent::NativeWebTouchEvent(GdkEvent* event, WebCore::GtkTouchContextHelper& context) 35 : WebTouchEvent(WebEventFactory::createWebTouchEvent(event, context)) 36 , m_nativeEvent(gdk_event_copy(event)) 37 , m_touchContext(context) 38 { 39 } 40 41 NativeWebTouchEvent::NativeWebTouchEvent(const NativeWebTouchEvent& event) 42 : WebTouchEvent(WebEventFactory::createWebTouchEvent(event.nativeEvent(), event.touchContext())) 43 , m_nativeEvent(gdk_event_copy(event.nativeEvent())) 44 , m_touchContext(event.touchContext()) 45 { 46 } 43 47 44 48 } // namespace WebKit 45 46 #endif // WebEventFactory_h -
trunk/Source/WebKit2/Shared/gtk/WebEventFactory.cpp
r147137 r163749 35 35 #include <gdk/gdk.h> 36 36 #include <gdk/gdkkeysyms.h> 37 #include <gtk/gtk.h> 37 38 #include <wtf/ASCIICType.h> 38 39 … … 204 205 } 205 206 207 #ifndef GTK_API_VERSION_2 208 static WebPlatformTouchPoint::TouchPointState touchPhaseFromEvents(const GdkEvent* current, const GdkEvent* event) 209 { 210 if (gdk_event_get_event_sequence(current) != gdk_event_get_event_sequence(event)) 211 return WebPlatformTouchPoint::TouchStationary; 212 213 switch (current->type) { 214 case GDK_TOUCH_UPDATE: 215 return WebPlatformTouchPoint::TouchMoved; 216 case GDK_TOUCH_BEGIN: 217 return WebPlatformTouchPoint::TouchPressed; 218 case GDK_TOUCH_END: 219 return WebPlatformTouchPoint::TouchReleased; 220 default: 221 return WebPlatformTouchPoint::TouchStationary; 222 } 223 } 224 225 static void appendTouchEvent(Vector<WebPlatformTouchPoint>& touchPointList, const GdkEvent* event, WebPlatformTouchPoint::TouchPointState state) 226 { 227 uint32_t identifier = GPOINTER_TO_UINT(gdk_event_get_event_sequence(event)); 228 229 gdouble x, y; 230 gdk_event_get_coords(event, &x, &y); 231 232 gdouble xRoot, yRoot; 233 gdk_event_get_root_coords(event, &xRoot, &yRoot); 234 235 WebPlatformTouchPoint touchPoint(identifier, state, IntPoint(xRoot, yRoot), IntPoint(x, y)); 236 touchPointList.uncheckedAppend(touchPoint); 237 } 238 #endif // GTK_API_VERSION_2 239 240 WebTouchEvent WebEventFactory::createWebTouchEvent(const GdkEvent* event, const WebCore::GtkTouchContextHelper& touchContext) 241 { 242 #ifndef GTK_API_VERSION_2 243 WebEvent::Type type = WebEvent::NoType; 244 const auto& touchEvents = touchContext.touchEvents(); 245 int numEvents = touchEvents.size(); 246 247 switch (event->type) { 248 case GDK_TOUCH_BEGIN: 249 type = WebEvent::TouchStart; 250 break; 251 case GDK_TOUCH_UPDATE: 252 type = WebEvent::TouchMove; 253 break; 254 case GDK_TOUCH_END: 255 type = WebEvent::TouchEnd; 256 ++numEvents; 257 break; 258 default: 259 ASSERT_NOT_REACHED(); 260 } 261 262 Vector<WebPlatformTouchPoint> touchPointList; 263 touchPointList.reserveInitialCapacity(numEvents); 264 265 for (auto it = touchEvents.begin(); it != touchEvents.end(); ++it) 266 appendTouchEvent(touchPointList, it->value.get(), touchPhaseFromEvents(it->value.get(), event)); 267 268 // Touch was already removed from the GtkTouchContextHelper, add it here. 269 if (event->type == GDK_TOUCH_END) 270 appendTouchEvent(touchPointList, event, WebPlatformTouchPoint::TouchReleased); 271 272 return WebTouchEvent(type, touchPointList, modifiersForEvent(event), gdk_event_get_time(event)); 273 #else 274 return WebTouchEvent(); 275 #endif // GTK_API_VERSION_2 276 } 277 206 278 } // namespace WebKit -
trunk/Source/WebKit2/Shared/gtk/WebEventFactory.h
r138544 r163749 30 30 #include "WebEvent.h" 31 31 #include <WebCore/CompositionResults.h> 32 #include <WebCore/GtkTouchContextHelper.h> 32 33 33 34 typedef union _GdkEvent GdkEvent; … … 40 41 static WebWheelEvent createWebWheelEvent(const GdkEvent*); 41 42 static WebKeyboardEvent createWebKeyboardEvent(const GdkEvent*, const WebCore::CompositionResults&); 43 static WebTouchEvent createWebTouchEvent(const GdkEvent*, const WebCore::GtkTouchContextHelper&); 42 44 }; 43 45 -
trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp
r163116 r163749 328 328 #endif // ENABLE(FULLSCREEN_API) 329 329 330 void PageClientImpl::doneWithTouchEvent(const NativeWebTouchEvent& event, bool wasEventHandled) 331 { 332 if (wasEventHandled) 333 return; 334 335 // Emulate pointer events if unhandled. 336 const GdkEvent* touchEvent = event.nativeEvent(); 337 338 if (!touchEvent->touch.emulating_pointer) 339 return; 340 341 GUniquePtr<GdkEvent> pointerEvent; 342 343 if (touchEvent->type == GDK_TOUCH_UPDATE) { 344 pointerEvent.reset(gdk_event_new(GDK_MOTION_NOTIFY)); 345 pointerEvent->motion.time = touchEvent->touch.time; 346 pointerEvent->motion.x = touchEvent->touch.x; 347 pointerEvent->motion.y = touchEvent->touch.y; 348 pointerEvent->motion.x_root = touchEvent->touch.x_root; 349 pointerEvent->motion.y_root = touchEvent->touch.y_root; 350 pointerEvent->motion.state = touchEvent->touch.state | GDK_BUTTON1_MASK; 351 } else { 352 switch (touchEvent->type) { 353 case GDK_TOUCH_END: 354 pointerEvent.reset(gdk_event_new(GDK_BUTTON_RELEASE)); 355 pointerEvent->button.state = touchEvent->touch.state | GDK_BUTTON1_MASK; 356 break; 357 case GDK_TOUCH_BEGIN: 358 pointerEvent.reset(gdk_event_new(GDK_BUTTON_PRESS)); 359 break; 360 default: 361 ASSERT_NOT_REACHED(); 362 } 363 364 pointerEvent->button.button = 1; 365 pointerEvent->button.time = touchEvent->touch.time; 366 pointerEvent->button.x = touchEvent->touch.x; 367 pointerEvent->button.y = touchEvent->touch.y; 368 pointerEvent->button.x_root = touchEvent->touch.x_root; 369 pointerEvent->button.y_root = touchEvent->touch.y_root; 370 } 371 372 gdk_event_set_device(pointerEvent.get(), gdk_event_get_device(touchEvent)); 373 gdk_event_set_source_device(pointerEvent.get(), gdk_event_get_source_device(touchEvent)); 374 pointerEvent->any.window = GDK_WINDOW(g_object_ref(touchEvent->any.window)); 375 pointerEvent->any.send_event = TRUE; 376 377 gtk_widget_event(m_viewWidget, pointerEvent.get()); 378 } 379 330 380 } // namespace WebKit -
trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h
r163116 r163749 120 120 #endif 121 121 122 virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) override; 123 122 124 // Members of PageClientImpl class 123 125 GtkWidget* m_viewWidget; -
trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp
r163708 r163749 54 54 #include <WebCore/GtkClickCounter.h> 55 55 #include <WebCore/GtkDragAndDropHelper.h> 56 #include <WebCore/GtkTouchContextHelper.h> 56 57 #include <WebCore/GtkUtilities.h> 57 58 #include <WebCore/GtkVersioning.h> … … 111 112 WebContextMenuProxyGtk* activeContextMenuProxy; 112 113 WebViewBaseInputMethodFilter inputMethodFilter; 114 GtkTouchContextHelper touchContext; 113 115 114 116 GtkWindow* toplevelOnScreenWindow; … … 273 275 | GDK_BUTTON1_MOTION_MASK 274 276 | GDK_BUTTON2_MOTION_MASK 275 | GDK_BUTTON3_MOTION_MASK; 277 | GDK_BUTTON3_MOTION_MASK 278 | GDK_TOUCH_MASK; 276 279 277 280 gint attributesMask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; … … 709 712 710 713 priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(reinterpret_cast<GdkEvent*>(event), 0 /* currentClickCount */)); 714 715 return TRUE; 716 } 717 718 static gboolean webkitWebViewBaseTouchEvent(GtkWidget* widget, GdkEventTouch* event) 719 { 720 WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv; 721 722 if (priv->authenticationDialog) 723 return TRUE; 724 725 priv->touchContext.handleEvent(reinterpret_cast<GdkEvent*>(event)); 726 priv->pageProxy->handleTouchEvent(NativeWebTouchEvent(reinterpret_cast<GdkEvent*>(event), priv->touchContext)); 711 727 712 728 return TRUE; … … 897 913 widgetClass->scroll_event = webkitWebViewBaseScrollEvent; 898 914 widgetClass->motion_notify_event = webkitWebViewBaseMotionNotifyEvent; 915 widgetClass->touch_event = webkitWebViewBaseTouchEvent; 899 916 widgetClass->query_tooltip = webkitWebViewBaseQueryTooltip; 900 917 #if ENABLE(DRAG_SUPPORT) -
trunk/Source/autotools/SetupWebKitFeatures.m4
r163483 r163749 160 160 ENABLE_SATURATED_LAYOUT_ARITHMETIC=1\ 161 161 ENABLE_TEXT_AUTOSIZING=0 \ 162 ENABLE_TOUCH_EVENTS= 0\162 ENABLE_TOUCH_EVENTS=1 \ 163 163 ENABLE_TOUCH_ICON_LOADING=0 \ 164 164 ENABLE_USER_TIMING=0 \ -
trunk/Source/cmake/OptionsGTK.cmake
r163440 r163749 67 67 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SPELLCHECK ON) 68 68 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TEMPLATE_ELEMENT ON) 69 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS O FF)69 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS ON) 70 70 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USERSELECT_ALL ON) 71 71 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIBRATION OFF) -
trunk/Tools/ChangeLog
r163743 r163749 1 2014-02-09 Carlos Garnacho <carlosg@gnome.org> 2 3 [GTK] Enable touch features 4 https://bugs.webkit.org/show_bug.cgi?id=98931 5 6 Reviewed by Carlos Garcia Campos. 7 8 * WebKitTestRunner/EventSenderProxy.h: 9 * WebKitTestRunner/gtk/EventSenderProxyGtk.cpp: 10 (WTR::updateEventCoordinates): 11 (WTR::EventSenderProxy::createTouchEvent): 12 (WTR::EventSenderProxy::addTouchPoint): 13 (WTR::EventSenderProxy::updateTouchPoint): 14 (WTR::EventSenderProxy::sendUpdatedTouchEvents): 15 (WTR::EventSenderProxy::setTouchPointRadius): 16 (WTR::EventSenderProxy::setTouchModifier): Implement touch event proxying. 17 1 18 2014-02-08 Andreas Kling <akling@apple.com> 2 19 -
trunk/Tools/DumpRenderTree/gtk/EventSender.cpp
r162599 r163749 913 913 } 914 914 915 static JSValueRef clearTouchPointsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 916 { 917 return JSValueMakeUndefined(context); 918 } 919 915 920 static JSStaticFunction staticFunctions[] = { 916 921 { "mouseScrollBy", mouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, -
trunk/Tools/Scripts/webkitperl/FeatureList.pm
r163483 r163749 427 427 428 428 { option => "touch-events", desc => "Toggle Touch Events support", 429 define => "ENABLE_TOUCH_EVENTS", default => (isIOSWebKit() || isEfl() ), value => \$touchEventsSupport },429 define => "ENABLE_TOUCH_EVENTS", default => (isIOSWebKit() || isEfl() || isGtk()), value => \$touchEventsSupport }, 430 430 431 431 { option => "touch-slider", desc => "Toggle Touch Slider support", -
trunk/Tools/WebKitTestRunner/EventSenderProxy.h
r156797 r163749 29 29 30 30 #include <wtf/Deque.h> 31 #include <wtf/HashMap.h> 32 #include <wtf/Vector.h> 31 33 32 34 #if PLATFORM(GTK) 35 #include <WebCore/GUniquePtrGtk.h> 33 36 #include <gdk/gdk.h> 37 #include <wtf/HashSet.h> 34 38 #elif PLATFORM(EFL) 35 39 #include <WebKit2/EWebKit2.h> … … 91 95 void sendOrQueueEvent(GdkEvent*); 92 96 GdkEvent* createMouseButtonEvent(GdkEventType, unsigned button, WKEventModifiers); 97 GUniquePtr<GdkEvent> createTouchEvent(GdkEventType, int id); 98 void sendUpdatedTouchEvents(); 93 99 #elif PLATFORM(EFL) 94 100 void sendOrQueueEvent(const WTREvent&); … … 111 117 Deque<WTREventQueueItem> m_eventQueue; 112 118 unsigned m_mouseButtonCurrentlyDown; 119 Vector<GUniquePtr<GdkEvent>> m_touchEvents; 120 HashSet<int> m_updatedTouchEvents; 113 121 #elif PLATFORM(EFL) 114 122 Deque<WTREvent> m_eventQueue; -
trunk/Tools/WebKitTestRunner/gtk/EventSenderProxyGtk.cpp
r163373 r163749 34 34 #include "EventSenderProxy.h" 35 35 36 #include "NotImplemented.h" 36 37 #include "PlatformWebView.h" 37 38 #include "TestController.h" … … 442 443 } 443 444 445 void updateEventCoordinates(GdkEvent* touchEvent, int x, int y) 446 { 447 touchEvent->touch.x = x; 448 touchEvent->touch.y = y; 449 450 int xRoot, yRoot; 451 gdk_window_get_root_coords(touchEvent->touch.window, x, y, &xRoot, &yRoot); 452 touchEvent->touch.x_root = xRoot; 453 touchEvent->touch.y_root = yRoot; 454 } 455 456 GUniquePtr<GdkEvent> EventSenderProxy::createTouchEvent(GdkEventType eventType, int id) 457 { 458 GUniquePtr<GdkEvent> touchEvent(gdk_event_new(eventType)); 459 460 touchEvent->touch.sequence = static_cast<GdkEventSequence*>(GINT_TO_POINTER(id)); 461 touchEvent->touch.window = gtk_widget_get_window(GTK_WIDGET(m_testController->mainWebView()->platformView())); 462 g_object_ref(touchEvent->touch.window); 463 gdk_event_set_device(touchEvent.get(), gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(gdk_window_get_display(touchEvent->button.window)))); 464 touchEvent->touch.time = GDK_CURRENT_TIME; 465 466 return touchEvent; 467 } 468 469 void EventSenderProxy::addTouchPoint(int x, int y) 470 { 471 // Touch ID is array index plus one, so 0 is skipped. 472 GUniquePtr<GdkEvent> event = createTouchEvent(static_cast<GdkEventType>(GDK_TOUCH_BEGIN), m_touchEvents.size() + 1); 473 updateEventCoordinates(event.get(), x, y); 474 m_touchEvents.append(std::move(event)); 475 m_updatedTouchEvents.add(GPOINTER_TO_INT(event->touch.sequence)); 476 } 477 478 void EventSenderProxy::updateTouchPoint(int index, int x, int y) 479 { 480 ASSERT(index >= 0 && index < m_touchEvents.size()); 481 482 const auto& event = m_touchEvents[index]; 483 ASSERT(event); 484 485 event->type = GDK_TOUCH_UPDATE; 486 updateEventCoordinates(event.get(), x, y); 487 m_updatedTouchEvents.add(GPOINTER_TO_INT(event->touch.sequence)); 488 } 489 490 void EventSenderProxy::sendUpdatedTouchEvents() 491 { 492 for (auto id : m_updatedTouchEvents) 493 sendOrQueueEvent(gdk_event_copy(m_touchEvents[id - 1].get())); 494 495 m_updatedTouchEvents.clear(); 496 } 497 498 void EventSenderProxy::touchStart() 499 { 500 sendUpdatedTouchEvents(); 501 } 502 503 void EventSenderProxy::touchMove() 504 { 505 sendUpdatedTouchEvents(); 506 } 507 508 void EventSenderProxy::touchEnd() 509 { 510 sendUpdatedTouchEvents(); 511 } 512 513 void EventSenderProxy::touchCancel() 514 { 515 notImplemented(); 516 } 517 518 void EventSenderProxy::clearTouchPoints() 519 { 520 m_updatedTouchEvents.clear(); 521 m_touchEvents.clear(); 522 } 523 524 void EventSenderProxy::releaseTouchPoint(int index) 525 { 526 ASSERT(index >= 0 && index < m_touchEvents.size()); 527 528 const auto& event = m_touchEvents[index]; 529 event->type = GDK_TOUCH_END; 530 m_updatedTouchEvents.add(GPOINTER_TO_INT(event->touch.sequence)); 531 } 532 533 void EventSenderProxy::cancelTouchPoint(int index) 534 { 535 notImplemented(); 536 } 537 538 void EventSenderProxy::setTouchPointRadius(int radiusX, int radiusY) 539 { 540 notImplemented(); 541 } 542 543 void EventSenderProxy::setTouchModifier(WKEventModifiers modifier, bool enable) 544 { 545 guint state = webkitModifiersToGDKModifiers(modifier); 546 547 for (const auto& event : m_touchEvents) { 548 if (event->type == GDK_TOUCH_END) 549 continue; 550 551 if (enable) 552 event->touch.state |= state; 553 else 554 event->touch.state &= ~(state); 555 556 m_updatedTouchEvents.add(GPOINTER_TO_INT(event->touch.sequence)); 557 } 558 } 559 560 444 561 } // namespace WTR
Note: See TracChangeset
for help on using the changeset viewer.