Changeset 52113 in webkit
- Timestamp:
- Dec 14, 2009 12:57:32 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r52109 r52113 1 2009-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 1 13 2009-12-14 Robert Hogan <robert@roberthogan.net> 2 14 -
trunk/LayoutTests/fast/events/basic-touch-events-expected.txt
r51982 r52113 5 5 PASS lastEvent.changedTouches.length is 1 6 6 PASS lastEvent.targetTouches.length is 1 7 PASS lastEvent.shiftKey is false 7 8 PASS lastEvent.touches[0].target.id is "touchtarget" 8 9 PASS lastEvent.touches[0].pageX is 10 … … 20 21 PASS lastEvent.touches[0].clientY is 15 21 22 PASS lastEvent.touches[0].identifier is 0 23 PASS lastEvent.shiftKey is true 24 PASS lastEvent.altKey is true 25 PASS lastEvent.ctrlKey is false 26 PASS lastEvent.metaKey is false 22 27 PASS lastEvent.type is "touchend" 23 28 PASS lastEvent.touches.length is 0 … … 29 34 PASS lastEvent.changedTouches[0].clientY is 15 30 35 PASS lastEvent.changedTouches[0].identifier is 0 36 PASS lastEvent.shiftKey is false 37 PASS lastEvent.altKey is false 31 38 multi touch sequence 32 39 PASS lastEvent.type is "touchstart" -
trunk/LayoutTests/fast/events/script-tests/basic-touch-events.js
r51982 r52113 47 47 48 48 verifyTouchEvent("touchstart", 1, 1, 1); 49 shouldBe("lastEvent.shiftKey", "false"); 49 50 shouldBeEqualToString("lastEvent.touches[0].target.id", "touchtarget"); 50 51 verifyTouchPoint("touches", 0, 10, 10, 0); 51 52 52 53 eventSender.updateTouchPoint(0, 20, 15); 54 eventSender.setTouchModifier("shift", true); 55 eventSender.setTouchModifier("alt", true); 53 56 eventSender.touchMove(); 54 57 55 58 verifyTouchEvent("touchmove", 1, 1, 1); 56 59 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); 57 67 58 68 eventSender.touchEnd(); … … 60 70 verifyTouchEvent("touchend", 0, 1, 0); 61 71 verifyTouchPoint("changedTouches", 0, 20, 15, 0); 72 shouldBe("lastEvent.shiftKey", "false"); 73 shouldBe("lastEvent.altKey", "false"); 62 74 } 63 75 -
trunk/WebCore/ChangeLog
r52112 r52113 1 2009-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 1 29 2009-12-14 Benjamin Poulain <benjamin.poulain@nokia.com> 2 30 -
trunk/WebCore/dom/TouchEvent.cpp
r51981 r52113 34 34 TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches, 35 35 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) 37 38 : MouseRelatedEvent(type, true, true, view, 0, screenX, screenY, pageX, pageY, 38 false, false, false, false)39 ctrlKey, altKey, shiftKey, metaKey) 39 40 , m_touches(touches) 40 41 , m_targetTouches(targetTouches) … … 45 46 void TouchEvent::initTouchEvent(TouchList* touches, TouchList* targetTouches, 46 47 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) 48 50 { 49 51 if (dispatched()) … … 54 56 m_screenX = screenX; 55 57 m_screenY = screenY; 58 m_ctrlKey = ctrlKey; 59 m_altKey = altKey; 60 m_shiftKey = shiftKey; 61 m_metaKey = metaKey; 56 62 initCoordinates(clientX, clientY); 57 63 } -
trunk/WebCore/dom/TouchEvent.h
r51981 r52113 43 43 TouchList* targetTouches, TouchList* changedTouches, 44 44 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) 46 47 { 47 48 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)); 49 51 } 50 52 … … 52 54 TouchList* changedTouches, const AtomicString& type, 53 55 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); 55 58 56 59 TouchList* touches() const { return m_touches.get(); } … … 63 66 TouchList* changedTouches, const AtomicString& type, 64 67 PassRefPtr<AbstractView>, int screenX, int screenY, int pageX, 65 int pageY); 68 int pageY, 69 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey); 66 70 67 71 virtual bool isTouchEvent() const { return true; } -
trunk/WebCore/dom/TouchEvent.idl
r51981 r52113 33 33 readonly attribute TouchList targetTouches; 34 34 readonly attribute TouchList changedTouches; 35 readonly attribute boolean ctrlKey; 36 readonly attribute boolean shiftKey; 37 readonly attribute boolean altKey; 38 readonly attribute boolean metaKey; 35 39 36 40 void initTouchEvent(in TouchList touches, … … 42 46 in long screenY, 43 47 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); 45 53 }; 46 54 } -
trunk/WebCore/page/EventHandler.cpp
r52063 r52113 2600 2600 *eventName, m_touchEventTarget->document()->defaultView(), 2601 2601 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()); 2603 2605 2604 2606 ExceptionCode ec = 0; -
trunk/WebCore/platform/PlatformTouchEvent.h
r51981 r52113 38 38 class PlatformTouchEvent { 39 39 public: 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 {} 41 47 #if PLATFORM(QT) 42 48 PlatformTouchEvent(QTouchEvent*); … … 46 52 const Vector<PlatformTouchPoint>& touchPoints() const { return m_touchPoints; } 47 53 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 48 59 private: 49 60 TouchEventType m_type; 50 61 Vector<PlatformTouchPoint> m_touchPoints; 62 bool m_ctrlKey; 63 bool m_altKey; 64 bool m_shiftKey; 65 bool m_metaKey; 51 66 }; 52 67 -
trunk/WebCore/platform/qt/PlatformTouchEventQt.cpp
r51981 r52113 38 38 for (int i = 0; i < points.count(); ++i) 39 39 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); 40 45 } 41 46 -
trunk/WebKitTools/ChangeLog
r52077 r52113 1 2009-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 1 15 2009-12-13 Maciej Stachowiak <mjs@apple.com> 2 16 -
trunk/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
r52037 r52113 275 275 } 276 276 277 void 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 277 297 void EventSender::touchStart() 278 298 { … … 302 322 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) 303 323 m_touchPoints.clear(); 324 m_touchModifiers = Qt::KeyboardModifiers(); 304 325 #endif 305 326 } … … 318 339 { 319 340 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) 320 QTouchEvent event(type );341 QTouchEvent event(type, QTouchEvent::TouchScreen, m_touchModifiers); 321 342 event.setTouchPoints(m_touchPoints); 322 343 QApplication::sendEvent(m_page, &event); -
trunk/WebKitTools/DumpRenderTree/qt/EventSenderQt.h
r52037 r52113 61 61 void addTouchPoint(int x, int y); 62 62 void updateTouchPoint(int index, int x, int y); 63 void setTouchModifier(const QString &modifier, bool enable); 63 64 void touchStart(); 64 65 void touchMove(); … … 75 76 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) 76 77 QList<QTouchEvent::TouchPoint> m_touchPoints; 78 Qt::KeyboardModifiers m_touchModifiers; 77 79 #endif 78 80 };
Note: See TracChangeset
for help on using the changeset viewer.