Changeset 132052 in webkit


Ignore:
Timestamp:
Oct 22, 2012 2:48:58 AM (12 years ago)
Author:
allan.jensen@digia.com
Message:

[Qt] Basic gesture event handling
https://bugs.webkit.org/show_bug.cgi?id=66173

Reviewed by Simon Hausmann.

Source/WebKit/qt:

Implement basic handling of QGestureEvent converting and forwarding
Tap and TapAndHold gestures to WebCore.

  • Api/qwebpage.cpp:

(QWebPagePrivate::gestureEvent):
(QWebPage::event):

  • Api/qwebpage_p.h:

(QWebPagePrivate):

  • WebCoreSupport/WebEventConversion.cpp:

(WebKitPlatformGestureEvent):
(WebCore::WebKitPlatformGestureEvent::WebKitPlatformGestureEvent):
(WebCore::convertGesture):

  • WebCoreSupport/WebEventConversion.h:

Tools:

Add support for eventSender.gestureLongPress.

  • DumpRenderTree/qt/EventSenderQt.cpp:

(EventSender::EventSender):
(EventSender::gestureLongPress):

  • DumpRenderTree/qt/EventSenderQt.h:

(EventSender):

LayoutTests:

  • platform/qt-5.0-wk2/TestExpectations:
  • platform/qt/TestExpectations:
  • platform/qt/fast/events/touch/gesture/gesture-click-expected.txt: Added.
Location:
trunk
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r132047 r132052  
     12012-10-22  Allan Sandfeld Jensen  <allan.jensen@digia.com>
     2
     3        [Qt] Basic gesture event handling
     4        https://bugs.webkit.org/show_bug.cgi?id=66173
     5
     6        Reviewed by Simon Hausmann.
     7
     8        * platform/qt-5.0-wk2/TestExpectations:
     9        * platform/qt/TestExpectations:
     10        * platform/qt/fast/events/touch/gesture/gesture-click-expected.txt: Added.
     11
    1122012-10-22  Shinya Kawanaka  <shinyak@chromium.org>
    213
  • trunk/LayoutTests/platform/qt-5.0-wk2/TestExpectations

    r131909 r132052  
    6565# eventSender.gestureTap
    6666fast/events/touch/gesture/gesture-click.html
     67# eventSender.gestureLongPress
     68fast/events/touch/gesture/context-menu-on-long-press.html
     69touchadjustment/touch-links-longpress.html
    6770# eventSender.beginDragWithFiles
    6871fast/dom/Window/window-postmessage-clone-frames.html
     
    608611http/tests/security/cookies/third-party-cookie-blocking.html
    609612
    610 [Qt][WK2] http/tests/misc/willCacheResponse-delegate-callback.html fails
     613# [Qt][WK2] http/tests/misc/willCacheResponse-delegate-callback.html fails
    611614webkit.org/b/99148 http/tests/misc/willCacheResponse-delegate-callback.html
    612615
    613 [Qt][WK2] REGRESSION(r131057): It made plugins/plugin-document-back-forward.html timeout
     616# [Qt][WK2] REGRESSION(r131057): It made plugins/plugin-document-back-forward.html timeout
    614617webkit.org/b/99152 plugins/plugin-document-back-forward.html
    615618
    616 [Qt][WK2] http/tests/navigation/ping-cross-origin-from-https.html fails
     619# [Qt][WK2] http/tests/navigation/ping-cross-origin-from-https.html fails
    617620webkit.org/b/99155 http/tests/navigation/ping-cross-origin-from-https.html
    618621
  • trunk/LayoutTests/platform/qt/TestExpectations

    r132043 r132052  
    431431fast/js/names.html
    432432
    433 # Don't have GestureLongPress, GestureTapCancel event types
    434 touchadjustment/touch-links-longpress.html
     433# Don't have GestureTapCancel event type
    435434touchadjustment/touch-links-active.html
    436435
     
    19601959fast/dom/HTMLMeterElement/meter-appearances-rating-relevancy.html
    19611960fast/dynamic/text-combine.html
    1962 fast/events/touch/gesture/context-menu-on-long-press.html
    19631961fast/events/touch/gesture/context-menu-on-two-finger-tap.html
    19641962fast/images/pixel-crack-image-background-webkit-transform-scale.html
  • trunk/Source/WebKit/qt/Api/qwebpage.cpp

    r130612 r132052  
    9595#include "PageGroup.h"
    9696#include "Pasteboard.h"
     97#include "PlatformGestureEvent.h"
    9798#include "PlatformKeyboardEvent.h"
    9899#include "PlatformTouchEvent.h"
     
    132133#include <QDropEvent>
    133134#include <QFileDialog>
     135#include <QGestureEvent>
    134136#include <QInputDialog>
    135137#include <QLabel>
     
    13281330    // Return whether the default action was cancelled in the JS event handler
    13291331    return frame->eventHandler()->handleTouchEvent(convertTouchEvent(event));
     1332#else
     1333    event->ignore();
     1334    return false;
     1335#endif
     1336}
     1337
     1338bool QWebPagePrivate::gestureEvent(QGestureEvent* event)
     1339{
     1340#if ENABLE(GESTURE_EVENTS)
     1341    WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data());
     1342    if (!frame->view())
     1343        return false;
     1344
     1345    // QGestureEvents can contain updates for multiple gestures.
     1346    bool handled = false;
     1347    QGesture* gesture = event->gesture(Qt::TapGesture);
     1348    // Beware that gestures send by DumpRenderTree will have state Qt::NoGesture,
     1349    // due to not originating from a GestureRecognizer.
     1350    if (gesture && (gesture->state() == Qt::GestureStarted || gesture->state() == Qt::NoGesture)) {
     1351        frame->eventHandler()->handleGestureEvent(convertGesture(event, gesture));
     1352        event->setAccepted(true);
     1353        handled = true;
     1354    }
     1355    gesture = event->gesture(Qt::TapAndHoldGesture);
     1356    if (gesture && (gesture->state() == Qt::GestureStarted || gesture->state() == Qt::NoGesture)) {
     1357        frame->eventHandler()->sendContextMenuEventForGesture(convertGesture(event, gesture));
     1358        event->setAccepted(true);
     1359        handled = true;
     1360    }
     1361
     1362    return handled;
    13301363#else
    13311364    event->ignore();
     
    31443177        // Return whether the default action was cancelled in the JS event handler
    31453178        return d->touchEvent(static_cast<QTouchEvent*>(ev));
     3179#ifndef QT_NO_GESTURES
     3180    case QEvent::Gesture:
     3181        d->gestureEvent(static_cast<QGestureEvent*>(ev));
     3182        break;
     3183#endif
    31463184#ifndef QT_NO_PROPERTIES
    31473185    case QEvent::DynamicPropertyChange:
  • trunk/Source/WebKit/qt/Api/qwebpage_p.h

    r129750 r132052  
    2727#include <qnetworkproxy.h>
    2828#include <qevent.h>
     29#include <qgesture.h>
    2930#include <qgraphicssceneevent.h>
    3031
     
    134135    bool touchEvent(QTouchEvent*);
    135136
     137    bool gestureEvent(QGestureEvent*);
     138
    136139    class TouchAdjuster {
    137140    public:
  • trunk/Source/WebKit/qt/ChangeLog

    r131716 r132052  
     12012-10-22  Allan Sandfeld Jensen  <allan.jensen@digia.com>
     2
     3        [Qt] Basic gesture event handling
     4        https://bugs.webkit.org/show_bug.cgi?id=66173
     5
     6        Reviewed by Simon Hausmann.
     7
     8        Implement basic handling of QGestureEvent converting and forwarding
     9        Tap and TapAndHold gestures to WebCore.
     10
     11        * Api/qwebpage.cpp:
     12        (QWebPagePrivate::gestureEvent):
     13        (QWebPage::event):
     14        * Api/qwebpage_p.h:
     15        (QWebPagePrivate):
     16        * WebCoreSupport/WebEventConversion.cpp:
     17        (WebKitPlatformGestureEvent):
     18        (WebCore::WebKitPlatformGestureEvent::WebKitPlatformGestureEvent):
     19        (WebCore::convertGesture):
     20        * WebCoreSupport/WebEventConversion.h:
     21
    1222012-10-17  Tor Arne Vestbø  <tor.arne.vestbo@digia.com>
    223
  • trunk/Source/WebKit/qt/WebCoreSupport/WebEventConversion.cpp

    r124879 r132052  
    2323#include "WebEventConversion.h"
    2424
     25#include "PlatformGestureEvent.h"
    2526#include "PlatformMouseEvent.h"
    2627#include "PlatformTouchEvent.h"
     
    2829#include "PlatformWheelEvent.h"
    2930#include <QApplication>
     31#include <QGesture>
     32#include <QGestureEvent>
    3033#include <QGraphicsSceneMouseEvent>
    3134#include <QTouchEvent>
    3235#include <QWheelEvent>
     36#include <QWidget>
    3337#include <wtf/CurrentTime.h>
    3438
     
    303307#endif
    304308
     309#if ENABLE(GESTURE_EVENTS)
     310class WebKitPlatformGestureEvent : public PlatformGestureEvent {
     311public:
     312    WebKitPlatformGestureEvent(const QGestureEvent*, const QGesture*);
     313};
     314
     315WebKitPlatformGestureEvent::WebKitPlatformGestureEvent(const QGestureEvent* event, const QGesture* gesture)
     316{
     317    switch (gesture->gestureType()) {
     318    case Qt::TapGesture: {
     319        m_type = PlatformEvent::GestureTap;
     320        QPointF globalPos = static_cast<const QTapGesture*>(gesture)->position();
     321        m_globalPosition = globalPos.toPoint();
     322        m_position = event->widget()->mapFromGlobal(globalPos.toPoint());
     323        break;
     324    }
     325    case Qt::TapAndHoldGesture: {
     326        m_type = PlatformEvent::GestureLongPress;
     327        QPointF globalPos = static_cast<const QTapAndHoldGesture*>(gesture)->position();
     328        m_globalPosition = globalPos.toPoint();
     329        m_position = event->widget()->mapFromGlobal(globalPos.toPoint());
     330        break;
     331    }
     332    default:
     333        ASSERT_NOT_REACHED();
     334        break;
     335    }
     336    m_timestamp = WTF::currentTime();
     337}
     338
     339#endif
     340
    305341PlatformWheelEvent convertWheelEvent(QWheelEvent* event)
    306342{
     
    320356#endif
    321357
    322 }
     358#if ENABLE(GESTURE_EVENTS)
     359PlatformGestureEvent convertGesture(QGestureEvent* event, QGesture* gesture)
     360{
     361    return WebKitPlatformGestureEvent(event, gesture);
     362}
     363#endif
     364
     365}
  • trunk/Source/WebKit/qt/WebCoreSupport/WebEventConversion.h

    r115420 r132052  
    2828class QGraphicsSceneWheelEvent;
    2929class QTouchEvent;
     30class QGesture;
     31class QGestureEvent;
    3032QT_END_NAMESPACE
    3133
     
    3436class PlatformMouseEvent;
    3537class PlatformWheelEvent;
    36 
    3738
    3839PlatformMouseEvent convertMouseEvent(QInputEvent*, int clickCount);
     
    4546PlatformTouchEvent convertTouchEvent(QTouchEvent*);
    4647#endif
     48
     49#if ENABLE(GESTURE_EVENTS)
     50class PlatformGestureEvent;
     51PlatformGestureEvent convertGesture(QGestureEvent*, QGesture*);
     52#endif
    4753}
  • trunk/Tools/ChangeLog

    r132050 r132052  
     12012-10-22  Allan Sandfeld Jensen  <allan.jensen@digia.com>
     2
     3        [Qt] Basic gesture event handling
     4        https://bugs.webkit.org/show_bug.cgi?id=66173
     5
     6        Reviewed by Simon Hausmann.
     7
     8        Add support for eventSender.gestureLongPress.
     9
     10        * DumpRenderTree/qt/EventSenderQt.cpp:
     11        (EventSender::EventSender):
     12        (EventSender::gestureLongPress):
     13        * DumpRenderTree/qt/EventSenderQt.h:
     14        (EventSender):
     15
    1162012-10-22  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
    217
  • trunk/Tools/DumpRenderTree/qt/EventSenderQt.cpp

    r130877 r132052  
    6363#ifndef QT_NO_GESTURES
    6464    , m_tapGesture(parent)
     65    , m_tapAndHoldGesture(parent)
    6566#endif
    6667{
     
    578579    sendEvent(m_page, &event);
    579580}
     581
     582void EventSender::gestureLongPress(int x, int y)
     583{
     584    m_tapAndHoldGesture.setPosition(QPointF(x, y));
     585    m_gestures.clear();
     586    m_gestures.append(&m_tapAndHoldGesture);
     587    QGestureEvent event(m_gestures);
     588    sendEvent(m_page, &event);
     589}
    580590#endif
    581591
  • trunk/Tools/DumpRenderTree/qt/EventSenderQt.h

    r130877 r132052  
    8989#ifndef QT_NO_GESTURES
    9090    void gestureTap(int x, int y);
     91    void gestureLongPress(int x, int y);
    9192#endif
    9293    void beginDragWithFiles(const QStringList& files);
     
    124125#ifndef QT_NO_GESTURES
    125126    QTapGesture m_tapGesture;
     127    QTapAndHoldGesture m_tapAndHoldGesture;
    126128    QList<QGesture*> m_gestures;
    127129#endif
Note: See TracChangeset for help on using the changeset viewer.