Changeset 52922 in webkit
- Timestamp:
- Jan 7, 2010 6:37:26 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r52904 r52922 1 2010-01-07 Kim Grönholm <kim.gronholm@nomovok.com> 2 3 Reviewed by Antti Koivisto. 4 5 Wrong state and TouchLists in TouchEvents 6 https://bugs.webkit.org/show_bug.cgi?id=32878 7 8 Touch event tests changed to match the API and semantics of iPhone and 9 Android. Each new touch point press dispatches a touchstart event with 10 the pressed touch point(s) in the changedTouches list, and a release 11 dispatches a touchend event with the released touch point(s) in 12 changedTouches. Moved points dispatch a touchmove event, with the moved 13 points in changedTouches. Old behaviour emitted only one touchstart when 14 the first point was pressed and one touchend when the last point was 15 released, and any events in between were touchmoves. New presses or 16 releases could only be detected by comparing the lists touches and 17 changedTouches. 18 19 * fast/events/basic-touch-events-expected.txt: 20 * fast/events/script-tests/basic-touch-events.js: 21 (singleTouchSequence): 22 (multiTouchSequence): 23 1 24 2010-01-06 MORITA Hajime <morrita@gmail.com> 2 25 -
trunk/LayoutTests/fast/events/basic-touch-events-expected.txt
r52113 r52922 12 12 PASS lastEvent.touches[0].clientY is 10 13 13 PASS lastEvent.touches[0].identifier is 0 14 PASS lastEvent.changedTouches[0].pageX is 10 15 PASS lastEvent.changedTouches[0].pageY is 10 16 PASS lastEvent.changedTouches[0].clientX is 10 17 PASS lastEvent.changedTouches[0].clientY is 10 18 PASS lastEvent.changedTouches[0].identifier is 0 19 PASS lastEvent.targetTouches[0].pageX is 10 20 PASS lastEvent.targetTouches[0].pageY is 10 21 PASS lastEvent.targetTouches[0].clientX is 10 22 PASS lastEvent.targetTouches[0].clientY is 10 23 PASS lastEvent.targetTouches[0].identifier is 0 14 24 PASS lastEvent.type is "touchmove" 15 25 PASS lastEvent.touches.length is 1 … … 37 47 PASS lastEvent.altKey is false 38 48 multi touch sequence 49 Two touchpoints pressed 39 50 PASS lastEvent.type is "touchstart" 40 PASS lastEvent.touches.length is 141 PASS lastEvent.changedTouches.length is 142 PASS lastEvent.targetTouches.length is 143 PASS lastEvent.touches[0].target.id is "touchtarget"44 PASS lastEvent.touches[0].pageX is 1045 PASS lastEvent.touches[0].pageY is 1046 PASS lastEvent.touches[0].clientX is 1047 PASS lastEvent.touches[0].clientY is 1048 PASS lastEvent.touches[0].identifier is 049 PASS lastEvent.type is "touchmove"50 51 PASS lastEvent.touches.length is 2 51 PASS lastEvent.changedTouches.length is 152 PASS lastEvent.changedTouches.length is 2 52 53 PASS lastEvent.targetTouches.length is 2 53 54 PASS lastEvent.touches[0].pageX is 10 … … 61 62 PASS lastEvent.touches[1].clientY is 30 62 63 PASS lastEvent.touches[1].identifier is 1 63 PASS lastEvent.changedTouches[0].pageX is 20 64 PASS lastEvent.changedTouches[0].pageY is 30 65 PASS lastEvent.changedTouches[0].clientX is 20 66 PASS lastEvent.changedTouches[0].clientY is 30 67 PASS lastEvent.changedTouches[0].identifier is 1 64 PASS lastEvent.changedTouches[0].pageX is 10 65 PASS lastEvent.changedTouches[0].pageY is 10 66 PASS lastEvent.changedTouches[0].clientX is 10 67 PASS lastEvent.changedTouches[0].clientY is 10 68 PASS lastEvent.changedTouches[0].identifier is 0 69 PASS lastEvent.changedTouches[1].pageX is 20 70 PASS lastEvent.changedTouches[1].pageY is 30 71 PASS lastEvent.changedTouches[1].clientX is 20 72 PASS lastEvent.changedTouches[1].clientY is 30 73 PASS lastEvent.changedTouches[1].identifier is 1 74 PASS lastEvent.targetTouches[0].pageX is 10 75 PASS lastEvent.targetTouches[0].pageY is 10 76 PASS lastEvent.targetTouches[0].clientX is 10 77 PASS lastEvent.targetTouches[0].clientY is 10 78 PASS lastEvent.targetTouches[0].identifier is 0 79 PASS lastEvent.targetTouches[1].pageX is 20 80 PASS lastEvent.targetTouches[1].pageY is 30 81 PASS lastEvent.targetTouches[1].clientX is 20 82 PASS lastEvent.targetTouches[1].clientY is 30 83 PASS lastEvent.targetTouches[1].identifier is 1 84 First touchpoint moved 68 85 PASS lastEvent.type is "touchmove" 69 86 PASS lastEvent.touches.length is 2 … … 85 102 PASS lastEvent.touches[1].clientY is 30 86 103 PASS lastEvent.touches[1].identifier is 1 87 PASS lastEvent.type is "touchmove" 104 First touchpoint is released 105 PASS lastEvent.type is "touchend" 88 106 PASS lastEvent.touches.length is 1 89 107 PASS lastEvent.changedTouches.length is 1 … … 99 117 PASS lastEvent.changedTouches[0].clientY is 15 100 118 PASS lastEvent.changedTouches[0].identifier is 0 119 PASS lastEvent.targetTouches[0].pageX is 20 120 PASS lastEvent.targetTouches[0].pageY is 30 121 PASS lastEvent.targetTouches[0].clientX is 20 122 PASS lastEvent.targetTouches[0].clientY is 30 123 PASS lastEvent.targetTouches[0].identifier is 1 124 Last remaining touchpoint is released 101 125 PASS lastEvent.type is "touchend" 102 126 PASS lastEvent.touches.length is 0 -
trunk/LayoutTests/fast/events/script-tests/basic-touch-events.js
r52113 r52922 50 50 shouldBeEqualToString("lastEvent.touches[0].target.id", "touchtarget"); 51 51 verifyTouchPoint("touches", 0, 10, 10, 0); 52 verifyTouchPoint("changedTouches", 0, 10, 10, 0); 53 verifyTouchPoint("targetTouches", 0, 10, 10, 0); 52 54 53 55 eventSender.updateTouchPoint(0, 20, 15); … … 66 68 eventSender.setTouchModifier("alt", false); 67 69 70 eventSender.releaseTouchPoint(0); 68 71 eventSender.touchEnd(); 69 72 … … 78 81 debug("multi touch sequence"); 79 82 83 debug("Two touchpoints pressed"); 80 84 eventSender.addTouchPoint(10, 10); 85 eventSender.addTouchPoint(20, 30); 81 86 eventSender.touchStart(); 82 83 verifyTouchEvent("touchstart", 1, 1, 1); 84 shouldBeEqualToString("lastEvent.touches[0].target.id", "touchtarget"); 85 verifyTouchPoint("touches", 0, 10, 10, 0); 86 87 eventSender.addTouchPoint(20, 30); 88 eventSender.touchMove(); 89 90 verifyTouchEvent("touchmove", 2, 1, 2); 87 verifyTouchEvent("touchstart", 2, 2, 2); 91 88 verifyTouchPoint("touches", 0, 10, 10, 0); 92 89 verifyTouchPoint("touches", 1, 20, 30, 1); 93 verifyTouchPoint("changedTouches", 0, 20, 30, 1); 90 verifyTouchPoint("changedTouches", 0, 10, 10, 0); 91 verifyTouchPoint("changedTouches", 1, 20, 30, 1); 92 verifyTouchPoint("targetTouches", 0, 10, 10, 0); 93 verifyTouchPoint("targetTouches", 1, 20, 30, 1); 94 94 95 debug("First touchpoint moved"); 95 96 eventSender.updateTouchPoint(0, 15, 15); 96 97 eventSender.touchMove(); 97 98 98 verifyTouchEvent("touchmove", 2, 1, 2); 99 99 verifyTouchPoint("touches", 0, 15, 15, 0); … … 101 101 verifyTouchPoint("touches", 1, 20, 30, 1); 102 102 103 debug("First touchpoint is released"); 103 104 eventSender.releaseTouchPoint(0); 104 eventSender.touchMove(); 105 106 verifyTouchEvent("touchmove", 1, 1, 1); 105 eventSender.touchEnd(); 106 verifyTouchEvent("touchend", 1, 1, 1); 107 107 verifyTouchPoint("touches", 0, 20, 30, 1); 108 108 verifyTouchPoint("changedTouches", 0, 15, 15, 0); 109 verifyTouchPoint("targetTouches", 0, 20, 30, 1); 109 110 111 debug("Last remaining touchpoint is released"); 112 eventSender.releaseTouchPoint(0); 110 113 eventSender.touchEnd(); 111 112 114 verifyTouchEvent("touchend", 0, 1, 0); 113 115 verifyTouchPoint("changedTouches", 0, 20, 30, 1); -
trunk/WebCore/ChangeLog
r52921 r52922 1 2010-01-07 Kim Grönholm <kim.gronholm@nomovok.com> 2 3 Reviewed by Antti Koivisto. 4 5 Wrong state and TouchLists in TouchEvents 6 https://bugs.webkit.org/show_bug.cgi?id=32878 7 8 Touch events changed to match the API and semantics of iPhone and 9 Android. Each new touch point press dispatches a touchstart event with 10 the pressed touch point(s) in the changedTouches list, and a release 11 dispatches a touchend event with the released touch point(s) in 12 changedTouches. Moved points dispatch a touchmove event, with the moved 13 points in changedTouches. Old behaviour emitted only one touchstart when 14 the first point was pressed and one touchend when the last point was 15 released, and any events in between were touchmoves. New presses or 16 releases could only be detected by comparing the lists touches and 17 changedTouches. 18 19 * page/EventHandler.cpp: 20 (WebCore::EventHandler::handleTouchEvent): 21 * page/EventHandler.h: 22 1 23 2010-01-07 Kent Tamura <tkent@chromium.org> 2 24 -
trunk/WebCore/page/EventHandler.cpp
r52791 r52922 2546 2546 2547 2547 RefPtr<TouchList> touches = TouchList::create(); 2548 RefPtr<TouchList> changedTouches = TouchList::create(); 2548 RefPtr<TouchList> pressedTouches = TouchList::create(); 2549 RefPtr<TouchList> releasedTouches = TouchList::create(); 2550 RefPtr<TouchList> movedTouches = TouchList::create(); 2549 2551 RefPtr<TouchList> targetTouches = TouchList::create(); 2550 2552 2551 2553 const Vector<PlatformTouchPoint>& points = event.touchPoints(); 2554 AtomicString* eventName = 0; 2555 2552 2556 for (int i = 0; i < points.size(); ++i) { 2553 2557 const PlatformTouchPoint& point = points[i]; 2554 2555 2558 IntPoint framePoint = documentPointForWindowPoint(m_frame, point.pos()); 2556 2559 HitTestResult result = hitTestResultAtPoint(framePoint, /*allowShadowContent*/ false); 2557 2558 2560 Node* target = result.innerNode(); 2561 2559 2562 // Touch events should not go to text nodes 2560 2563 if (target && target->isTextNode()) … … 2571 2574 } 2572 2575 2573 if (point.state() != PlatformTouchPoint::TouchReleased) { 2574 touches->append(touch); 2575 2576 if (m_touchEventTarget == target) 2577 targetTouches->append(touch); 2578 } 2579 2580 if (point.state() != PlatformTouchPoint::TouchStationary) 2581 changedTouches->append(touch); 2582 } 2583 2584 AtomicString* eventName = 0; 2585 switch (event.type()) { 2586 case TouchStart: 2576 if (point.state() == PlatformTouchPoint::TouchReleased) 2577 releasedTouches->append(touch); 2578 else { 2579 if (point.state() == PlatformTouchPoint::TouchPressed) 2580 pressedTouches->append(touch); 2581 else { 2582 touches->append(touch); 2583 if (m_touchEventTarget == target) 2584 targetTouches->append(touch); 2585 if (point.state() == PlatformTouchPoint::TouchMoved) 2586 movedTouches->append(touch); 2587 } 2588 } 2589 } 2590 2591 if (!m_touchEventTarget) 2592 return false; 2593 2594 bool defaultPrevented = false; 2595 2596 if (releasedTouches->length() > 0) { 2597 eventName = &eventNames().touchendEvent; 2598 RefPtr<TouchEvent> endEv = 2599 TouchEvent::create(touches.get(), targetTouches.get(), releasedTouches.get(), 2600 *eventName, m_touchEventTarget->document()->defaultView(), 2601 m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(), 2602 m_firstTouchPagePos.x(), m_firstTouchPagePos.y(), 2603 event.ctrlKey(), event.altKey(), event.shiftKey(), 2604 event.metaKey()); 2605 ExceptionCode ec = 0; 2606 m_touchEventTarget->dispatchEvent(endEv.get(), ec); 2607 defaultPrevented = endEv->defaultPrevented(); 2608 } 2609 if (pressedTouches->length() > 0) { 2610 // Add pressed touchpoints to touches and targetTouches 2611 for (int i = 0; i < pressedTouches->length(); ++i) { 2612 touches->append(pressedTouches->item(i)); 2613 if (m_touchEventTarget == pressedTouches->item(i)->target()) 2614 targetTouches->append(pressedTouches->item(i)); 2615 } 2616 2587 2617 eventName = &eventNames().touchstartEvent; 2588 break; 2589 case TouchMove: 2618 RefPtr<TouchEvent> startEv = 2619 TouchEvent::create(touches.get(), targetTouches.get(), pressedTouches.get(), 2620 *eventName, m_touchEventTarget->document()->defaultView(), 2621 m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(), 2622 m_firstTouchPagePos.x(), m_firstTouchPagePos.y(), 2623 event.ctrlKey(), event.altKey(), event.shiftKey(), 2624 event.metaKey()); 2625 ExceptionCode ec = 0; 2626 m_touchEventTarget->dispatchEvent(startEv.get(), ec); 2627 defaultPrevented |= startEv->defaultPrevented(); 2628 } 2629 if (movedTouches->length() > 0) { 2590 2630 eventName = &eventNames().touchmoveEvent; 2591 break; 2592 case TouchEnd: 2593 eventName = &eventNames().touchendEvent; 2594 break; 2595 } 2596 2597 if (!m_touchEventTarget) 2598 return false; 2599 2600 RefPtr<TouchEvent> ev = TouchEvent::create(touches.get(), targetTouches.get(), changedTouches.get(), 2601 *eventName, m_touchEventTarget->document()->defaultView(), 2602 m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(), 2603 m_firstTouchPagePos.x(), m_firstTouchPagePos.y(), 2604 event.ctrlKey(), event.altKey(), event.shiftKey(), 2605 event.metaKey()); 2606 2607 ExceptionCode ec = 0; 2608 m_touchEventTarget->dispatchEvent(ev.get(), ec); 2631 RefPtr<TouchEvent> moveEv = 2632 TouchEvent::create(touches.get(), targetTouches.get(), movedTouches.get(), 2633 *eventName, m_touchEventTarget->document()->defaultView(), 2634 m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(), 2635 m_firstTouchPagePos.x(), m_firstTouchPagePos.y(), 2636 event.ctrlKey(), event.altKey(), event.shiftKey(), 2637 event.metaKey()); 2638 ExceptionCode ec = 0; 2639 m_touchEventTarget->dispatchEvent(moveEv.get(), ec); 2640 defaultPrevented |= moveEv->defaultPrevented(); 2641 } 2609 2642 2610 2643 if (event.type() == TouchEnd) 2611 2644 m_touchEventTarget = 0; 2612 2645 2613 m_previousTouchEvent = ev; 2614 2615 return ev->defaultPrevented(); 2616 } 2617 #endif 2618 2619 } 2646 return defaultPrevented; 2647 } 2648 #endif 2649 2650 } -
trunk/WebCore/page/EventHandler.h
r52008 r52922 410 410 IntPoint m_firstTouchScreenPos; 411 411 IntPoint m_firstTouchPagePos; 412 RefPtr<TouchEvent> m_previousTouchEvent;413 412 #endif 414 413 }; -
trunk/WebKitTools/ChangeLog
r52917 r52922 1 2010-01-07 Kim Grönholm <kim.gronholm@nomovok.com> 2 3 Reviewed by Antti Koivisto. 4 5 Wrong state and TouchLists in TouchEvents 6 https://bugs.webkit.org/show_bug.cgi?id=32878 7 8 * DumpRenderTree/qt/EventSenderQt.cpp: 9 (EventSender::touchStart): 10 (EventSender::touchEnd): 11 (EventSender::clearTouchPoints): 12 * DumpRenderTree/qt/EventSenderQt.h: 13 1 14 2010-01-07 Andras Becsi <abecsi@inf.u-szeged.hu> 2 15 -
trunk/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
r52902 r52922 331 331 { 332 332 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) 333 sendTouchEvent(QEvent::TouchBegin); 333 if (!m_touchActive) { 334 sendTouchEvent(QEvent::TouchBegin); 335 m_touchActive = true; 336 } else 337 sendTouchEvent(QEvent::TouchUpdate); 334 338 #endif 335 339 } … … 346 350 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) 347 351 for (int i = 0; i < m_touchPoints.count(); ++i) 348 m_touchPoints[i].setState(Qt::TouchPointReleased); 352 if (m_touchPoints[i].state() != Qt::TouchPointReleased) { 353 sendTouchEvent(QEvent::TouchUpdate); 354 return; 355 } 349 356 sendTouchEvent(QEvent::TouchEnd); 357 m_touchActive = false; 350 358 #endif 351 359 } … … 356 364 m_touchPoints.clear(); 357 365 m_touchModifiers = Qt::KeyboardModifiers(); 366 m_touchActive = false; 358 367 #endif 359 368 } -
trunk/WebKitTools/DumpRenderTree/qt/EventSenderQt.h
r52902 r52922 87 87 QList<QTouchEvent::TouchPoint> m_touchPoints; 88 88 Qt::KeyboardModifiers m_touchModifiers; 89 bool m_touchActive; 89 90 #endif 90 91 };
Note: See TracChangeset
for help on using the changeset viewer.