[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 00:35:41 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 4a659891a5db273797ec807cd83a9f4196545ddd
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Dec 14 20:57:32 2009 +0000

    2009-12-14  Simon Hausmann  <hausmann at webkit.org>
    
            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  <hausmann at webkit.org>
    
            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  <hausmann at webkit.org>
    
            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:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52113 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index d75c252..6d8d7ac 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2009-12-14  Simon Hausmann  <hausmann at webkit.org>
+
+        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  Robert Hogan  <robert at roberthogan.net>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/fast/events/basic-touch-events-expected.txt b/LayoutTests/fast/events/basic-touch-events-expected.txt
index 85ede75..3841436 100644
--- a/LayoutTests/fast/events/basic-touch-events-expected.txt
+++ b/LayoutTests/fast/events/basic-touch-events-expected.txt
@@ -4,6 +4,7 @@ PASS lastEvent.type is "touchstart"
 PASS lastEvent.touches.length is 1
 PASS lastEvent.changedTouches.length is 1
 PASS lastEvent.targetTouches.length is 1
+PASS lastEvent.shiftKey is false
 PASS lastEvent.touches[0].target.id is "touchtarget"
 PASS lastEvent.touches[0].pageX is 10
 PASS lastEvent.touches[0].pageY is 10
@@ -19,6 +20,10 @@ PASS lastEvent.touches[0].pageY is 15
 PASS lastEvent.touches[0].clientX is 20
 PASS lastEvent.touches[0].clientY is 15
 PASS lastEvent.touches[0].identifier is 0
+PASS lastEvent.shiftKey is true
+PASS lastEvent.altKey is true
+PASS lastEvent.ctrlKey is false
+PASS lastEvent.metaKey is false
 PASS lastEvent.type is "touchend"
 PASS lastEvent.touches.length is 0
 PASS lastEvent.changedTouches.length is 1
@@ -28,6 +33,8 @@ PASS lastEvent.changedTouches[0].pageY is 15
 PASS lastEvent.changedTouches[0].clientX is 20
 PASS lastEvent.changedTouches[0].clientY is 15
 PASS lastEvent.changedTouches[0].identifier is 0
+PASS lastEvent.shiftKey is false
+PASS lastEvent.altKey is false
 multi touch sequence
 PASS lastEvent.type is "touchstart"
 PASS lastEvent.touches.length is 1
diff --git a/LayoutTests/fast/events/script-tests/basic-touch-events.js b/LayoutTests/fast/events/script-tests/basic-touch-events.js
index a0108b6..7eecd35 100644
--- a/LayoutTests/fast/events/script-tests/basic-touch-events.js
+++ b/LayoutTests/fast/events/script-tests/basic-touch-events.js
@@ -46,19 +46,31 @@ function singleTouchSequence()
     eventSender.touchStart();
 
     verifyTouchEvent("touchstart", 1, 1, 1);
+    shouldBe("lastEvent.shiftKey", "false");
     shouldBeEqualToString("lastEvent.touches[0].target.id", "touchtarget");
     verifyTouchPoint("touches", 0, 10, 10, 0);
 
     eventSender.updateTouchPoint(0, 20, 15);
+    eventSender.setTouchModifier("shift", true);
+    eventSender.setTouchModifier("alt", true);
     eventSender.touchMove();
 
     verifyTouchEvent("touchmove", 1, 1, 1);
     verifyTouchPoint("touches", 0, 20, 15, 0);
+    shouldBe("lastEvent.shiftKey", "true");
+    shouldBe("lastEvent.altKey", "true");
+    shouldBe("lastEvent.ctrlKey", "false");
+    shouldBe("lastEvent.metaKey", "false");
+
+    eventSender.setTouchModifier("shift", false);
+    eventSender.setTouchModifier("alt", false);
 
     eventSender.touchEnd();
 
     verifyTouchEvent("touchend", 0, 1, 0);
     verifyTouchPoint("changedTouches", 0, 20, 15, 0);
+    shouldBe("lastEvent.shiftKey", "false");
+    shouldBe("lastEvent.altKey", "false");
 }
 
 function multiTouchSequence()
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 45c5dd9..eab20ff 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,31 @@
+2009-12-14  Simon Hausmann  <hausmann at webkit.org>
+
+        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  Benjamin Poulain  <benjamin.poulain at nokia.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/dom/TouchEvent.cpp b/WebCore/dom/TouchEvent.cpp
index 54fff1e..bcc395f 100644
--- a/WebCore/dom/TouchEvent.cpp
+++ b/WebCore/dom/TouchEvent.cpp
@@ -33,9 +33,10 @@ namespace WebCore {
 
 TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches,
         TouchList* changedTouches, const AtomicString& type, 
-        PassRefPtr<AbstractView> view, int screenX, int screenY, int pageX, int pageY)
+        PassRefPtr<AbstractView> view, int screenX, int screenY, int pageX, int pageY,
+        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
     : MouseRelatedEvent(type, true, true, view, 0, screenX, screenY, pageX, pageY,
-                        false, false, false, false)
+                        ctrlKey, altKey, shiftKey, metaKey)
     , m_touches(touches)
     , m_targetTouches(targetTouches)
     , m_changedTouches(changedTouches)
@@ -44,7 +45,8 @@ TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches,
 
 void TouchEvent::initTouchEvent(TouchList* touches, TouchList* targetTouches,
         TouchList* changedTouches, const AtomicString& type, 
-        PassRefPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY)
+        PassRefPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY,
+        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
 {
     if (dispatched())
         return;
@@ -53,6 +55,10 @@ void TouchEvent::initTouchEvent(TouchList* touches, TouchList* targetTouches,
 
     m_screenX = screenX;
     m_screenY = screenY;
+    m_ctrlKey = ctrlKey;
+    m_altKey = altKey;
+    m_shiftKey = shiftKey;
+    m_metaKey = metaKey;
     initCoordinates(clientX, clientY);
 }
 
diff --git a/WebCore/dom/TouchEvent.h b/WebCore/dom/TouchEvent.h
index c5fcebd..080a495 100644
--- a/WebCore/dom/TouchEvent.h
+++ b/WebCore/dom/TouchEvent.h
@@ -42,16 +42,19 @@ public:
     static PassRefPtr<TouchEvent> create(TouchList* touches, 
             TouchList* targetTouches, TouchList* changedTouches, 
             const AtomicString& type, PassRefPtr<AbstractView> view,
-            int screenX, int screenY, int pageX, int pageY)
+            int screenX, int screenY, int pageX, int pageY,
+            bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
     {
         return adoptRef(new TouchEvent(touches, targetTouches, changedTouches,
-                type, view, screenX, screenY, pageX, pageY));
+                type, view, screenX, screenY, pageX, pageY,
+                ctrlKey, altKey, shiftKey, metaKey));
     }
 
     void initTouchEvent(TouchList* touches, TouchList* targetTouches,
             TouchList* changedTouches, const AtomicString& type, 
             PassRefPtr<AbstractView> view, int screenX, int screenY, 
-            int clientX, int clientY);
+            int clientX, int clientY,
+            bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
 
     TouchList* touches() const { return m_touches.get(); }
     TouchList* targetTouches() const { return m_targetTouches.get(); }
@@ -62,7 +65,8 @@ private:
     TouchEvent(TouchList* touches, TouchList* targetTouches,
             TouchList* changedTouches, const AtomicString& type,
             PassRefPtr<AbstractView>, int screenX, int screenY, int pageX,
-            int pageY);
+            int pageY,
+            bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
 
     virtual bool isTouchEvent() const { return true; }
 
diff --git a/WebCore/dom/TouchEvent.idl b/WebCore/dom/TouchEvent.idl
index b7148b0..010c36f 100644
--- a/WebCore/dom/TouchEvent.idl
+++ b/WebCore/dom/TouchEvent.idl
@@ -32,6 +32,10 @@ module events {
         readonly attribute TouchList touches;
         readonly attribute TouchList targetTouches;
         readonly attribute TouchList changedTouches;
+        readonly attribute boolean ctrlKey;
+        readonly attribute boolean shiftKey;
+        readonly attribute boolean altKey;
+        readonly attribute boolean metaKey;
 
         void initTouchEvent(in TouchList touches,
                             in TouchList targetTouches,
@@ -41,6 +45,10 @@ module events {
                             in long screenX, 
                             in long screenY, 
                             in long clientX, 
-                            in long clientY);
+                            in long clientY,
+                            in boolean ctrlKey,
+                            in boolean altKey,
+                            in boolean shiftKey,
+                            in boolean metaKey);
     };
 }
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp
index e1efa0e..452fd13 100644
--- a/WebCore/page/EventHandler.cpp
+++ b/WebCore/page/EventHandler.cpp
@@ -2599,7 +2599,9 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
     RefPtr<TouchEvent> ev = TouchEvent::create(touches.get(), targetTouches.get(), changedTouches.get(),
                                                *eventName, m_touchEventTarget->document()->defaultView(),
                                                m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(),
-                                               m_firstTouchPagePos.x(), m_firstTouchPagePos.y());
+                                               m_firstTouchPagePos.x(), m_firstTouchPagePos.y(),
+                                               event.ctrlKey(), event.altKey(), event.shiftKey(),
+                                               event.metaKey());
 
     ExceptionCode ec = 0;
     m_touchEventTarget->dispatchEvent(ev.get(), ec);
diff --git a/WebCore/platform/PlatformTouchEvent.h b/WebCore/platform/PlatformTouchEvent.h
index 0d38f8a..5c187d5 100644
--- a/WebCore/platform/PlatformTouchEvent.h
+++ b/WebCore/platform/PlatformTouchEvent.h
@@ -37,7 +37,13 @@ enum TouchEventType { TouchStart, TouchMove, TouchEnd };
 
 class PlatformTouchEvent {
 public:
-    PlatformTouchEvent() : m_type(TouchStart) {}
+    PlatformTouchEvent()
+        : m_type(TouchStart)
+        , m_ctrlKey(false)
+        , m_altKey(false)
+        , m_shiftKey(false)
+        , m_metaKey(false)
+    {}
 #if PLATFORM(QT)
     PlatformTouchEvent(QTouchEvent*);
 #endif
@@ -45,9 +51,18 @@ public:
     TouchEventType type() const { return m_type; }
     const Vector<PlatformTouchPoint>& touchPoints() const { return m_touchPoints; }
 
+    bool ctrlKey() const { return m_ctrlKey; }
+    bool altKey() const { return m_altKey; }
+    bool shiftKey() const { return m_shiftKey; }
+    bool metaKey() const { return m_metaKey; }
+
 private:
     TouchEventType m_type;
     Vector<PlatformTouchPoint> m_touchPoints;
+    bool m_ctrlKey;
+    bool m_altKey;
+    bool m_shiftKey;
+    bool m_metaKey;
 };
 
 }
diff --git a/WebCore/platform/qt/PlatformTouchEventQt.cpp b/WebCore/platform/qt/PlatformTouchEventQt.cpp
index b329b14..338e9d4 100644
--- a/WebCore/platform/qt/PlatformTouchEventQt.cpp
+++ b/WebCore/platform/qt/PlatformTouchEventQt.cpp
@@ -37,6 +37,11 @@ PlatformTouchEvent::PlatformTouchEvent(QTouchEvent* event)
     const QList<QTouchEvent::TouchPoint>& points = event->touchPoints();
     for (int i = 0; i < points.count(); ++i)
         m_touchPoints.append(PlatformTouchPoint(points.at(i)));
+
+    m_ctrlKey = (event->modifiers() & Qt::ControlModifier);
+    m_altKey = (event->modifiers() & Qt::AltModifier);
+    m_shiftKey = (event->modifiers() & Qt::ShiftModifier);
+    m_metaKey = (event->modifiers() & Qt::MetaModifier);
 }
 
 }
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 6a842ac..93cc4fa 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,17 @@
+2009-12-14  Simon Hausmann  <hausmann at webkit.org>
+
+        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:
+
 2009-12-13  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Gavin Barraclaugh.
diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
index b8dd45b..628ef80 100644
--- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
@@ -274,6 +274,26 @@ void EventSender::updateTouchPoint(int index, int x, int y)
 #endif
 }
 
+void EventSender::setTouchModifier(const QString &modifier, bool enable)
+{
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+    Qt::KeyboardModifier mod = Qt::NoModifier;
+    if (!modifier.compare(QLatin1String("shift"), Qt::CaseInsensitive))
+        mod = Qt::ShiftModifier;
+    else if (!modifier.compare(QLatin1String("alt"), Qt::CaseInsensitive))
+        mod = Qt::AltModifier;
+    else if (!modifier.compare(QLatin1String("meta"), Qt::CaseInsensitive))
+        mod = Qt::MetaModifier;
+    else if (!modifier.compare(QLatin1String("ctrl"), Qt::CaseInsensitive))
+        mod = Qt::ControlModifier;
+
+    if (enable)
+        m_touchModifiers |= mod;
+    else
+        m_touchModifiers &= ~mod;
+#endif
+}
+
 void EventSender::touchStart()
 {
 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
@@ -301,6 +321,7 @@ void EventSender::clearTouchPoints()
 {
 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
     m_touchPoints.clear();
+    m_touchModifiers = Qt::KeyboardModifiers();
 #endif
 }
 
@@ -317,7 +338,7 @@ void EventSender::releaseTouchPoint(int index)
 void EventSender::sendTouchEvent(QEvent::Type type)
 {
 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
-    QTouchEvent event(type);
+    QTouchEvent event(type, QTouchEvent::TouchScreen, m_touchModifiers);
     event.setTouchPoints(m_touchPoints);
     QApplication::sendEvent(m_page, &event);
     QList<QTouchEvent::TouchPoint>::Iterator it = m_touchPoints.begin();
diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.h b/WebKitTools/DumpRenderTree/qt/EventSenderQt.h
index 95e182d..30735c3 100644
--- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.h
+++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.h
@@ -60,6 +60,7 @@ public slots:
     void scheduleAsynchronousClick();
     void addTouchPoint(int x, int y);
     void updateTouchPoint(int index, int x, int y);
+    void setTouchModifier(const QString &modifier, bool enable);
     void touchStart();
     void touchMove();
     void touchEnd();
@@ -74,6 +75,7 @@ private:
     QWebFrame* frameUnderMouse() const;
 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
     QList<QTouchEvent::TouchPoint> m_touchPoints;
+    Qt::KeyboardModifiers m_touchModifiers;
 #endif
 };
 #endif //  EventSenderQt_h

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list