Changeset 52113 in webkit


Ignore:
Timestamp:
Dec 14, 2009 12:57:32 PM (14 years ago)
Author:
eric@webkit.org
Message:

2009-12-14 Simon Hausmann <Simon Hausmann>

Reviewed by Holger Freyther.

[Qt] Extend basic touch event test with a simple keyboard modifier test.

https://bugs.webkit.org/show_bug.cgi?id=32482

  • fast/events/basic-touch-events-expected.txt:
  • fast/events/script-tests/basic-touch-events.js: (singleTouchSequence):

2009-12-14 Simon Hausmann <Simon Hausmann>

Reviewed by Holger Freyther.

[Qt] Add support for keyboard modifiers to TouchEvent

https://bugs.webkit.org/show_bug.cgi?id=32482

Similar to other ui events with keyboard state, get the alt, shift,
meta and ctrl modifiers straight from the platform event.

  • dom/TouchEvent.cpp: (WebCore::TouchEvent::TouchEvent): (WebCore::TouchEvent::initTouchEvent):
  • dom/TouchEvent.h: (WebCore::TouchEvent::create):
  • dom/TouchEvent.idl:
  • page/EventHandler.cpp: (WebCore::EventHandler::handleTouchEvent):
  • platform/PlatformTouchEvent.h: (WebCore::PlatformTouchEvent::PlatformTouchEvent): (WebCore::PlatformTouchEvent::shiftKey): (WebCore::PlatformTouchEvent::ctrlKey): (WebCore::PlatformTouchEvent::altKey): (WebCore::PlatformTouchEvent::metaKey):
  • platform/qt/PlatformTouchEventQt.cpp: (WebCore::PlatformTouchEvent::PlatformTouchEvent):

2009-12-14 Simon Hausmann <Simon Hausmann>

Reviewed by Holger Freyther.

[Qt] Add support for keyboard modifiers to Qt DRT's EventSender for touch events

https://bugs.webkit.org/show_bug.cgi?id=32482

  • DumpRenderTree/qt/EventSenderQt.cpp: (EventSender::setTouchModifier): (EventSender::clearTouchPoints): (EventSender::sendTouchEvent):
  • DumpRenderTree/qt/EventSenderQt.h:
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r52109 r52113  
     12009-12-14  Simon Hausmann  <hausmann@webkit.org>
     2
     3        Reviewed by Holger Freyther.
     4
     5        [Qt] Extend basic touch event test with a simple keyboard modifier test.
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=32482
     8
     9        * fast/events/basic-touch-events-expected.txt:
     10        * fast/events/script-tests/basic-touch-events.js:
     11        (singleTouchSequence):
     12
    1132009-12-14  Robert Hogan  <robert@roberthogan.net>
    214
  • trunk/LayoutTests/fast/events/basic-touch-events-expected.txt

    r51982 r52113  
    55PASS lastEvent.changedTouches.length is 1
    66PASS lastEvent.targetTouches.length is 1
     7PASS lastEvent.shiftKey is false
    78PASS lastEvent.touches[0].target.id is "touchtarget"
    89PASS lastEvent.touches[0].pageX is 10
     
    2021PASS lastEvent.touches[0].clientY is 15
    2122PASS lastEvent.touches[0].identifier is 0
     23PASS lastEvent.shiftKey is true
     24PASS lastEvent.altKey is true
     25PASS lastEvent.ctrlKey is false
     26PASS lastEvent.metaKey is false
    2227PASS lastEvent.type is "touchend"
    2328PASS lastEvent.touches.length is 0
     
    2934PASS lastEvent.changedTouches[0].clientY is 15
    3035PASS lastEvent.changedTouches[0].identifier is 0
     36PASS lastEvent.shiftKey is false
     37PASS lastEvent.altKey is false
    3138multi touch sequence
    3239PASS lastEvent.type is "touchstart"
  • trunk/LayoutTests/fast/events/script-tests/basic-touch-events.js

    r51982 r52113  
    4747
    4848    verifyTouchEvent("touchstart", 1, 1, 1);
     49    shouldBe("lastEvent.shiftKey", "false");
    4950    shouldBeEqualToString("lastEvent.touches[0].target.id", "touchtarget");
    5051    verifyTouchPoint("touches", 0, 10, 10, 0);
    5152
    5253    eventSender.updateTouchPoint(0, 20, 15);
     54    eventSender.setTouchModifier("shift", true);
     55    eventSender.setTouchModifier("alt", true);
    5356    eventSender.touchMove();
    5457
    5558    verifyTouchEvent("touchmove", 1, 1, 1);
    5659    verifyTouchPoint("touches", 0, 20, 15, 0);
     60    shouldBe("lastEvent.shiftKey", "true");
     61    shouldBe("lastEvent.altKey", "true");
     62    shouldBe("lastEvent.ctrlKey", "false");
     63    shouldBe("lastEvent.metaKey", "false");
     64
     65    eventSender.setTouchModifier("shift", false);
     66    eventSender.setTouchModifier("alt", false);
    5767
    5868    eventSender.touchEnd();
     
    6070    verifyTouchEvent("touchend", 0, 1, 0);
    6171    verifyTouchPoint("changedTouches", 0, 20, 15, 0);
     72    shouldBe("lastEvent.shiftKey", "false");
     73    shouldBe("lastEvent.altKey", "false");
    6274}
    6375
  • trunk/WebCore/ChangeLog

    r52112 r52113  
     12009-12-14  Simon Hausmann  <hausmann@webkit.org>
     2
     3        Reviewed by Holger Freyther.
     4
     5        [Qt] Add support for keyboard modifiers to TouchEvent
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=32482
     8
     9        Similar to other ui events with keyboard state, get the alt, shift,
     10        meta and ctrl modifiers straight from the platform event.
     11
     12        * dom/TouchEvent.cpp:
     13        (WebCore::TouchEvent::TouchEvent):
     14        (WebCore::TouchEvent::initTouchEvent):
     15        * dom/TouchEvent.h:
     16        (WebCore::TouchEvent::create):
     17        * dom/TouchEvent.idl:
     18        * page/EventHandler.cpp:
     19        (WebCore::EventHandler::handleTouchEvent):
     20        * platform/PlatformTouchEvent.h:
     21        (WebCore::PlatformTouchEvent::PlatformTouchEvent):
     22        (WebCore::PlatformTouchEvent::shiftKey):
     23        (WebCore::PlatformTouchEvent::ctrlKey):
     24        (WebCore::PlatformTouchEvent::altKey):
     25        (WebCore::PlatformTouchEvent::metaKey):
     26        * platform/qt/PlatformTouchEventQt.cpp:
     27        (WebCore::PlatformTouchEvent::PlatformTouchEvent):
     28
    1292009-12-14  Benjamin Poulain  <benjamin.poulain@nokia.com>
    230
  • trunk/WebCore/dom/TouchEvent.cpp

    r51981 r52113  
    3434TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches,
    3535        TouchList* changedTouches, const AtomicString& type,
    36         PassRefPtr<AbstractView> view, int screenX, int screenY, int pageX, int pageY)
     36        PassRefPtr<AbstractView> view, int screenX, int screenY, int pageX, int pageY,
     37        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
    3738    : MouseRelatedEvent(type, true, true, view, 0, screenX, screenY, pageX, pageY,
    38                         false, false, false, false)
     39                        ctrlKey, altKey, shiftKey, metaKey)
    3940    , m_touches(touches)
    4041    , m_targetTouches(targetTouches)
     
    4546void TouchEvent::initTouchEvent(TouchList* touches, TouchList* targetTouches,
    4647        TouchList* changedTouches, const AtomicString& type,
    47         PassRefPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY)
     48        PassRefPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY,
     49        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
    4850{
    4951    if (dispatched())
     
    5456    m_screenX = screenX;
    5557    m_screenY = screenY;
     58    m_ctrlKey = ctrlKey;
     59    m_altKey = altKey;
     60    m_shiftKey = shiftKey;
     61    m_metaKey = metaKey;
    5662    initCoordinates(clientX, clientY);
    5763}
  • trunk/WebCore/dom/TouchEvent.h

    r51981 r52113  
    4343            TouchList* targetTouches, TouchList* changedTouches,
    4444            const AtomicString& type, PassRefPtr<AbstractView> view,
    45             int screenX, int screenY, int pageX, int pageY)
     45            int screenX, int screenY, int pageX, int pageY,
     46            bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
    4647    {
    4748        return adoptRef(new TouchEvent(touches, targetTouches, changedTouches,
    48                 type, view, screenX, screenY, pageX, pageY));
     49                type, view, screenX, screenY, pageX, pageY,
     50                ctrlKey, altKey, shiftKey, metaKey));
    4951    }
    5052
     
    5254            TouchList* changedTouches, const AtomicString& type,
    5355            PassRefPtr<AbstractView> view, int screenX, int screenY,
    54             int clientX, int clientY);
     56            int clientX, int clientY,
     57            bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
    5558
    5659    TouchList* touches() const { return m_touches.get(); }
     
    6366            TouchList* changedTouches, const AtomicString& type,
    6467            PassRefPtr<AbstractView>, int screenX, int screenY, int pageX,
    65             int pageY);
     68            int pageY,
     69            bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
    6670
    6771    virtual bool isTouchEvent() const { return true; }
  • trunk/WebCore/dom/TouchEvent.idl

    r51981 r52113  
    3333        readonly attribute TouchList targetTouches;
    3434        readonly attribute TouchList changedTouches;
     35        readonly attribute boolean ctrlKey;
     36        readonly attribute boolean shiftKey;
     37        readonly attribute boolean altKey;
     38        readonly attribute boolean metaKey;
    3539
    3640        void initTouchEvent(in TouchList touches,
     
    4246                            in long screenY,
    4347                            in long clientX,
    44                             in long clientY);
     48                            in long clientY,
     49                            in boolean ctrlKey,
     50                            in boolean altKey,
     51                            in boolean shiftKey,
     52                            in boolean metaKey);
    4553    };
    4654}
  • trunk/WebCore/page/EventHandler.cpp

    r52063 r52113  
    26002600                                               *eventName, m_touchEventTarget->document()->defaultView(),
    26012601                                               m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(),
    2602                                                m_firstTouchPagePos.x(), m_firstTouchPagePos.y());
     2602                                               m_firstTouchPagePos.x(), m_firstTouchPagePos.y(),
     2603                                               event.ctrlKey(), event.altKey(), event.shiftKey(),
     2604                                               event.metaKey());
    26032605
    26042606    ExceptionCode ec = 0;
  • trunk/WebCore/platform/PlatformTouchEvent.h

    r51981 r52113  
    3838class PlatformTouchEvent {
    3939public:
    40     PlatformTouchEvent() : m_type(TouchStart) {}
     40    PlatformTouchEvent()
     41        : m_type(TouchStart)
     42        , m_ctrlKey(false)
     43        , m_altKey(false)
     44        , m_shiftKey(false)
     45        , m_metaKey(false)
     46    {}
    4147#if PLATFORM(QT)
    4248    PlatformTouchEvent(QTouchEvent*);
     
    4652    const Vector<PlatformTouchPoint>& touchPoints() const { return m_touchPoints; }
    4753
     54    bool ctrlKey() const { return m_ctrlKey; }
     55    bool altKey() const { return m_altKey; }
     56    bool shiftKey() const { return m_shiftKey; }
     57    bool metaKey() const { return m_metaKey; }
     58
    4859private:
    4960    TouchEventType m_type;
    5061    Vector<PlatformTouchPoint> m_touchPoints;
     62    bool m_ctrlKey;
     63    bool m_altKey;
     64    bool m_shiftKey;
     65    bool m_metaKey;
    5166};
    5267
  • trunk/WebCore/platform/qt/PlatformTouchEventQt.cpp

    r51981 r52113  
    3838    for (int i = 0; i < points.count(); ++i)
    3939        m_touchPoints.append(PlatformTouchPoint(points.at(i)));
     40
     41    m_ctrlKey = (event->modifiers() & Qt::ControlModifier);
     42    m_altKey = (event->modifiers() & Qt::AltModifier);
     43    m_shiftKey = (event->modifiers() & Qt::ShiftModifier);
     44    m_metaKey = (event->modifiers() & Qt::MetaModifier);
    4045}
    4146
  • trunk/WebKitTools/ChangeLog

    r52077 r52113  
     12009-12-14  Simon Hausmann  <hausmann@webkit.org>
     2
     3        Reviewed by Holger Freyther.
     4
     5        [Qt] Add support for keyboard modifiers to Qt DRT's EventSender for touch events
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=32482
     8
     9        * DumpRenderTree/qt/EventSenderQt.cpp:
     10        (EventSender::setTouchModifier):
     11        (EventSender::clearTouchPoints):
     12        (EventSender::sendTouchEvent):
     13        * DumpRenderTree/qt/EventSenderQt.h:
     14
    1152009-12-13  Maciej Stachowiak  <mjs@apple.com>
    216
  • trunk/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp

    r52037 r52113  
    275275}
    276276
     277void EventSender::setTouchModifier(const QString &modifier, bool enable)
     278{
     279#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
     280    Qt::KeyboardModifier mod = Qt::NoModifier;
     281    if (!modifier.compare(QLatin1String("shift"), Qt::CaseInsensitive))
     282        mod = Qt::ShiftModifier;
     283    else if (!modifier.compare(QLatin1String("alt"), Qt::CaseInsensitive))
     284        mod = Qt::AltModifier;
     285    else if (!modifier.compare(QLatin1String("meta"), Qt::CaseInsensitive))
     286        mod = Qt::MetaModifier;
     287    else if (!modifier.compare(QLatin1String("ctrl"), Qt::CaseInsensitive))
     288        mod = Qt::ControlModifier;
     289
     290    if (enable)
     291        m_touchModifiers |= mod;
     292    else
     293        m_touchModifiers &= ~mod;
     294#endif
     295}
     296
    277297void EventSender::touchStart()
    278298{
     
    302322#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
    303323    m_touchPoints.clear();
     324    m_touchModifiers = Qt::KeyboardModifiers();
    304325#endif
    305326}
     
    318339{
    319340#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
    320     QTouchEvent event(type);
     341    QTouchEvent event(type, QTouchEvent::TouchScreen, m_touchModifiers);
    321342    event.setTouchPoints(m_touchPoints);
    322343    QApplication::sendEvent(m_page, &event);
  • trunk/WebKitTools/DumpRenderTree/qt/EventSenderQt.h

    r52037 r52113  
    6161    void addTouchPoint(int x, int y);
    6262    void updateTouchPoint(int index, int x, int y);
     63    void setTouchModifier(const QString &modifier, bool enable);
    6364    void touchStart();
    6465    void touchMove();
     
    7576#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
    7677    QList<QTouchEvent::TouchPoint> m_touchPoints;
     78    Qt::KeyboardModifiers m_touchModifiers;
    7779#endif
    7880};
Note: See TracChangeset for help on using the changeset viewer.