Changeset 90550 in webkit
- Timestamp:
- Jul 7, 2011 2:06:37 AM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 11 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r90458 r90550 1 2011-07-07 Benjamin Poulain <benjamin@webkit.org> 2 3 [Qt] [WK2] Improve the handling of touch events to use them as main input 4 https://bugs.webkit.org/show_bug.cgi?id=63991 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 Promote touch event for use as primary input. 9 10 The touch events now use the responsiveness timer like the other input events. 11 12 The touch events also have a callback to the UI signaling if the event was used 13 or not: PageClient::doneWithTouchEvent(). 14 This is similar to what is done with key events (PageClient::doneWithKeyEvent()). 15 16 * Shared/NativeWebTouchEvent.h: Copied from Source/WebKit2/Shared/qt/WebEventFactoryQt.h. 17 (WebKit::NativeWebTouchEvent::nativeEvent): 18 * Shared/qt/NativeWebTouchEventQt.cpp: Copied from Source/WebKit2/Shared/qt/WebEventFactoryQt.h. 19 (WebKit::NativeWebTouchEvent::NativeWebTouchEvent): 20 * Shared/qt/WebEventFactoryQt.cpp: 21 (WebKit::webEventTypeForEvent): 22 (WebKit::WebEventFactory::createWebTouchEvent): 23 * Shared/qt/WebEventFactoryQt.h: 24 * UIProcess/PageClient.h: 25 * UIProcess/WebPageProxy.cpp: 26 (WebKit::WebPageProxy::handleTouchEvent): 27 (WebKit::WebPageProxy::didReceiveEvent): 28 * UIProcess/WebPageProxy.h: 29 * UIProcess/qt/qdesktopwebpageproxy.cpp: 30 (QDesktopWebPageProxy::doneWithTouchEvent): 31 * UIProcess/qt/qdesktopwebpageproxy.h: 32 * UIProcess/qt/qtouchwebpageproxy.cpp: 33 (QTouchWebPageProxy::doneWithTouchEvent): 34 (QTouchWebPageProxy::touchEvent): 35 * UIProcess/qt/qtouchwebpageproxy.h: 36 * WebKit2.pro: 37 1 38 2011-07-06 Andreas Kling <kling@webkit.org> 2 39 -
trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h
r90549 r90550 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2011 Benjamin Poulain <benjamin@webkit.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 NativeWebTouchEvent_h 27 #define NativeWebTouchEvent_h 29 28 30 29 #include "WebEvent.h" 31 30 32 #if ENABLE(TOUCH_EVENTS)33 class QTouchEvent; 31 #if PLATFORM(QT) 32 #include <QTouchEvent> 34 33 #endif 35 36 class QGraphicsSceneMouseEvent;37 class QGraphicsSceneWheelEvent;38 class QKeyEvent;39 34 40 35 namespace WebKit { 41 36 42 class WebEventFactory{37 class NativeWebTouchEvent : public WebTouchEvent { 43 38 public: 44 static WebMouseEvent createWebMouseEvent(QGraphicsSceneMouseEvent* event, int eventClickCount); 45 static WebWheelEvent createWebWheelEvent(QGraphicsSceneWheelEvent* event); 46 static WebKeyboardEvent createWebKeyboardEvent(QKeyEvent* event); 47 #if ENABLE(TOUCH_EVENTS) 48 static WebTouchEvent createWebTouchEvent(QTouchEvent* event); 39 #if PLATFORM(QT) 40 explicit NativeWebTouchEvent(const QTouchEvent*); 41 #endif 42 43 #if PLATFORM(QT) 44 const QTouchEvent* nativeEvent() const { return &m_nativeEvent; } 45 #endif 46 47 private: 48 #if PLATFORM(QT) 49 const QTouchEvent m_nativeEvent; 49 50 #endif 50 51 }; … … 52 53 } // namespace WebKit 53 54 54 #endif // WebEventFactory_h55 #endif // NativeWebTouchEvent_h -
trunk/Source/WebKit2/Shared/qt/NativeWebTouchEventQt.cpp
r90549 r90550 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2011 Benjamin Poulain <benjamin@webkit.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 32 #if ENABLE(TOUCH_EVENTS) 33 class QTouchEvent; 34 #endif 35 36 class QGraphicsSceneMouseEvent; 37 class QGraphicsSceneWheelEvent; 38 class QKeyEvent; 29 #include "WebEventFactoryQt.h" 39 30 40 31 namespace WebKit { 41 32 42 class WebEventFactory { 43 public: 44 static WebMouseEvent createWebMouseEvent(QGraphicsSceneMouseEvent* event, int eventClickCount); 45 static WebWheelEvent createWebWheelEvent(QGraphicsSceneWheelEvent* event); 46 static WebKeyboardEvent createWebKeyboardEvent(QKeyEvent* event); 47 #if ENABLE(TOUCH_EVENTS) 48 static WebTouchEvent createWebTouchEvent(QTouchEvent* event); 49 #endif 50 }; 33 NativeWebTouchEvent::NativeWebTouchEvent(const QTouchEvent* event) 34 : WebTouchEvent(WebEventFactory::createWebTouchEvent(event)) 35 , m_nativeEvent(*event) 36 { 37 } 51 38 52 39 } // namespace WebKit 53 54 #endif // WebEventFactory_h -
trunk/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp
r76916 r90550 51 51 } 52 52 53 static WebEvent::Type webEventTypeForEvent( QEvent* event)53 static WebEvent::Type webEventTypeForEvent(const QEvent* event) 54 54 { 55 55 switch (event->type()) { … … 164 164 165 165 #if ENABLE(TOUCH_EVENTS) 166 167 WebTouchEvent WebEventFactory::createWebTouchEvent(QTouchEvent* event) 166 WebTouchEvent WebEventFactory::createWebTouchEvent(const QTouchEvent* event) 168 167 { 169 168 WebEvent::Type type = webEventTypeForEvent(event); -
trunk/Source/WebKit2/Shared/qt/WebEventFactoryQt.h
r65788 r90550 46 46 static WebKeyboardEvent createWebKeyboardEvent(QKeyEvent* event); 47 47 #if ENABLE(TOUCH_EVENTS) 48 static WebTouchEvent createWebTouchEvent( QTouchEvent* event);48 static WebTouchEvent createWebTouchEvent(const QTouchEvent*); 49 49 #endif 50 50 }; -
trunk/Source/WebKit2/UIProcess/PageClient.h
r89582 r90550 52 52 class FindIndicator; 53 53 class NativeWebKeyboardEvent; 54 class NativeWebKeyboardEvent; 54 #if ENABLE(TOUCH_EVENTS) 55 class NativeWebTouchEvent; 56 #endif 55 57 class WebContextMenuProxy; 56 58 class WebEditCommandProxy; … … 138 140 139 141 virtual void doneWithKeyEvent(const NativeWebKeyboardEvent&, bool wasEventHandled) = 0; 142 #if ENABLE(TOUCH_EVENTS) 143 virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) = 0; 144 #endif 140 145 141 146 virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) = 0; -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r89720 r90550 973 973 974 974 #if ENABLE(TOUCH_EVENTS) 975 void WebPageProxy::handleTouchEvent(const WebTouchEvent& event) 976 { 977 if (!isValid()) 978 return; 975 void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event) 976 { 977 if (!isValid()) 978 return; 979 980 m_touchEventQueue.append(event); 981 process()->responsivenessTimer()->start(); 979 982 process()->send(Messages::WebPage::TouchEvent(event), m_pageID); 980 983 } … … 2713 2716 case WebEvent::GestureScrollEnd: 2714 2717 #endif 2718 #if ENABLE(TOUCH_EVENTS) 2719 case WebEvent::TouchStart: 2720 case WebEvent::TouchMove: 2721 case WebEvent::TouchEnd: 2722 case WebEvent::TouchCancel: 2723 #endif 2715 2724 process()->responsivenessTimer()->stop(); 2716 2725 break; … … 2780 2789 break; 2781 2790 } 2791 #if ENABLE(TOUCH_EVENTS) 2792 case WebEvent::TouchStart: 2793 case WebEvent::TouchMove: 2794 case WebEvent::TouchEnd: 2795 case WebEvent::TouchCancel: { 2796 NativeWebTouchEvent event = m_touchEventQueue.first(); 2797 MESSAGE_CHECK(type == event.type()); 2798 m_touchEventQueue.removeFirst(); 2799 2800 m_pageClient->doneWithTouchEvent(event, handled); 2801 break; 2802 } 2803 #endif 2782 2804 } 2783 2805 } -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r90457 r90550 34 34 #include "EditorState.h" 35 35 #include "GeolocationPermissionRequestManagerProxy.h" 36 #if ENABLE(TOUCH_EVENTS) 37 #include "NativeWebTouchEvent.h" 38 #endif 36 39 #include "PlatformProcessIdentifier.h" 37 40 #include "SandboxExtension.h" … … 333 336 #endif 334 337 #if ENABLE(TOUCH_EVENTS) 335 void handleTouchEvent(const WebTouchEvent&);338 void handleTouchEvent(const NativeWebTouchEvent&); 336 339 #endif 337 340 … … 867 870 868 871 Deque<NativeWebKeyboardEvent> m_keyEventQueue; 869 872 #if ENABLE(TOUCH_EVENTS) 873 Deque<NativeWebTouchEvent> m_touchEventQueue; 874 #endif 870 875 Deque<NativeWebWheelEvent> m_wheelEventQueue; 871 876 Vector<NativeWebWheelEvent> m_currentlyProcessedWheelEvents; -
trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.cpp
r90458 r90550 70 70 // We ignore the viewport definition on the Desktop. 71 71 } 72 73 #if ENABLE(TOUCH_EVENTS) 74 void QDesktopWebPageProxy::doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) 75 { 76 // We do not handle touch on Desktop for now, the events are not supposed to be forwarded to the WebProcess. 77 ASSERT_NOT_REACHED(); 78 } 79 #endif 72 80 73 81 bool QDesktopWebPageProxy::handleEvent(QEvent* ev) -
trunk/Source/WebKit2/UIProcess/qt/qdesktopwebpageproxy.h
r90458 r90550 44 44 virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy(); 45 45 virtual void setViewportArguments(const WebCore::ViewportArguments&); 46 #if ENABLE(TOUCH_EVENTS) 47 virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled); 48 #endif 46 49 47 50 virtual void timerEvent(QTimerEvent*); -
trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp
r90458 r90550 50 50 } 51 51 52 #if ENABLE(TOUCH_EVENTS) 53 void QTouchWebPageProxy::doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled) 54 { 55 // FIXME: Add gesture and synthetic click. 56 } 57 #endif 58 52 59 bool QTouchWebPageProxy::handleEvent(QEvent* ev) 53 60 { … … 62 69 } 63 70 64 void QTouchWebPageProxy::touchEvent(QTouchEvent* ev )71 void QTouchWebPageProxy::touchEvent(QTouchEvent* event) 65 72 { 66 73 #if ENABLE(TOUCH_EVENTS) 67 WebTouchEvent touchEvent = WebEventFactory::createWebTouchEvent(ev);68 m_webPageProxy->handleTouchEvent(touchEvent);74 m_webPageProxy->handleTouchEvent(NativeWebTouchEvent(event)); 75 event->accept(); 69 76 #else 70 77 ASSERT_NOT_REACHED(); -
trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h
r90458 r90550 43 43 virtual PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy(); 44 44 virtual void setViewportArguments(const WebCore::ViewportArguments&); 45 #if ENABLE(TOUCH_EVENTS) 46 virtual void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled); 47 #endif 45 48 46 49 TouchViewInterface* touchViewInterface() const { return static_cast<TouchViewInterface*>(m_viewInterface); } -
trunk/Source/WebKit2/WebKit2.pro
r90458 r90550 571 571 $$WEBKIT2_GENERATED_SOURCES 572 572 573 contains(DEFINES, ENABLE_TOUCH_EVENTS=1) { 574 HEADERS += \ 575 Shared/NativeWebTouchEvent.h 576 SOURCES += \ 577 Shared/qt/NativeWebTouchEventQt.cpp 578 }
Note: See TracChangeset
for help on using the changeset viewer.