Changeset 55230 in webkit
- Timestamp:
- Feb 25, 2010 5:24:12 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r55229 r55230 1 2010-02-25 Ben Murdoch <benm@google.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 The target element of a Touch should be the target where that touch originated, not where it is now. 6 https://bugs.webkit.org/show_bug.cgi?id=34585 7 8 * fast/events/touch/basic-single-touch-events-expected.txt: Update expected target element. 9 * fast/events/touch/script-tests/basic-single-touch-events.js: ditto. 10 * fast/events/touch/script-tests/touch-target.js: Added. 11 * fast/events/touch/touch-target-expected.txt: Added. 12 * fast/events/touch/touch-target.html: Added. 13 1 14 2010-02-25 Xan Lopez <xlopez@igalia.com> 2 15 -
trunk/LayoutTests/fast/events/touch/basic-single-touch-events-expected.txt
r55146 r55230 68 68 PASS lastEvent.pageX is 0 69 69 PASS lastEvent.pageY is 0 70 PASS lastEvent.touches[0].target.tagName is " HTML"70 PASS lastEvent.touches[0].target.tagName is "DIV" 71 71 PASS successfullyParsed is true 72 72 -
trunk/LayoutTests/fast/events/touch/script-tests/basic-single-touch-events.js
r55146 r55230 81 81 case 4: 82 82 verifyTouchEvent("touchmove", 1, 1, 0); 83 shouldBeEqualToString("lastEvent.touches[0].target.tagName", " HTML");83 shouldBeEqualToString("lastEvent.touches[0].target.tagName", "DIV"); 84 84 break; 85 85 -
trunk/WebCore/ChangeLog
r55228 r55230 1 2010-02-25 Ben Murdoch <benm@google.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 The target element of a Touch should be the target where that touch originated, not where it is now. 6 https://bugs.webkit.org/show_bug.cgi?id=34585 7 8 Currently the target of a touch is set to the resulting node of the hit test where the touch currently 9 is. This does not match the behavior of iPhone or Android. This patch uses a hashmap on the EventHandler 10 to keep track of the target element when a touch is first started. This target is then used as the target 11 for subsequent touches with the same id. This matches observed behavior on iPhone and Android. 12 13 Tests: 14 fast/events/touch/touch-target.html: Added. 15 fast/events/touch/basic-single-touch-events.html: Updated. 16 17 * page/EventHandler.cpp: 18 (WebCore::EventHandler::handleTouchEvent): Store the originating target element of a touch in a hashmap 19 so that we can reuse that target for future events caused by that touch. This matches observed behavior 20 on iPhone and Android. 21 * page/EventHandler.h: Add hashmap as a member. 22 * platform/PlatformTouchPoint.h: 23 (WebCore::PlatformTouchPoint::id): Store the touch point id as unsigned. 24 * platform/qt/PlatformTouchPointQt.cpp: 25 (WebCore::PlatformTouchPoint::PlatformTouchPoint): Cast platform touch id from signed to unsigned. Qt API 26 docs state that it will always be >= 0. 27 1 28 2010-02-24 Antonio Gomes <tonikitoo@webkit.org> 2 29 -
trunk/WebCore/page/EventHandler.cpp
r55146 r55230 2584 2584 int adjustedPageY = lroundf(pagePoint.y() / m_frame->pageZoomFactor()); 2585 2585 2586 RefPtr<Touch> touch = Touch::create(doc->frame(), target, point.id(), 2586 // Increment the platform touch id by 1 to avoid storing a key of 0 in the hashmap. 2587 unsigned touchPointTargetKey = point.id() + 1; 2588 EventTarget* touchTarget = 0; 2589 if (point.state() == PlatformTouchPoint::TouchPressed) { 2590 m_originatingTouchPointTargets.set(touchPointTargetKey, target); 2591 touchTarget = target; 2592 } else if (point.state() == PlatformTouchPoint::TouchReleased || point.state() == PlatformTouchPoint::TouchCancelled) { 2593 // The target should be the original target for this touch, so get it from the hashmap. As it's a release or cancel 2594 // we also remove it from the map. 2595 touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKey).get(); 2596 } else 2597 touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey).get(); 2598 2599 if (!touchTarget) 2600 continue; 2601 2602 RefPtr<Touch> touch = Touch::create(doc->frame(), touchTarget, point.id(), 2587 2603 point.screenPos().x(), point.screenPos().y(), 2588 2604 adjustedPageX, adjustedPageY); -
trunk/WebCore/page/EventHandler.h
r55146 r55230 38 38 #endif 39 39 40 #if ENABLE(TOUCH_EVENTS) 41 #include <wtf/HashMap.h> 42 #endif 43 40 44 namespace WebCore { 41 45 … … 44 48 class Cursor; 45 49 class Event; 50 class EventTarget; 46 51 class FloatPoint; 47 52 class Frame; … … 409 414 #endif 410 415 #if ENABLE(TOUCH_EVENTS) 416 typedef HashMap<int, RefPtr<EventTarget> > TouchTargetMap; 417 TouchTargetMap m_originatingTouchPointTargets; 411 418 RefPtr<Node> m_touchEventTarget; 412 419 #endif -
trunk/WebCore/platform/PlatformTouchPoint.h
r53994 r55230 51 51 #endif 52 52 53 intid() const { return m_id; }53 unsigned id() const { return m_id; } 54 54 State state() const { return m_state; } 55 55 IntPoint screenPos() const { return m_screenPos; } … … 57 57 58 58 private: 59 intm_id;59 unsigned m_id; 60 60 State m_state; 61 61 IntPoint m_screenPos; -
trunk/WebCore/platform/qt/PlatformTouchPointQt.cpp
r51981 r55230 30 30 PlatformTouchPoint::PlatformTouchPoint(const QTouchEvent::TouchPoint& point) 31 31 { 32 m_id = point.id(); 32 // The QTouchEvent::TouchPoint API states that ids will be >= 0. 33 m_id = static_cast<unsigned>(point.id()); 33 34 switch (point.state()) { 34 35 case Qt::TouchPointReleased: m_state = TouchReleased; break; -
trunk/WebKitTools/ChangeLog
r55218 r55230 1 2010-02-25 Ben Murdoch <benm@google.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 The target element of a Touch should be the target where that touch originated, not where it is now. 6 https://bugs.webkit.org/show_bug.cgi?id=34585 7 8 * DumpRenderTree/qt/EventSenderQt.cpp: 9 (EventSender::addTouchPoint): Fix a bug where touch points were not being given unique ids. 10 1 11 2010-02-24 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> 2 12 -
trunk/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
r55019 r55230 290 290 { 291 291 #if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0) 292 int id = m_touchPoints.count(); 292 // Use index to refer to the position in the vector that this touch 293 // is stored. We then create a unique id for the touch that will be 294 // passed into WebCore. 295 int index = m_touchPoints.count(); 296 int id = m_touchPoints.isEmpty() ? 0 : m_touchPoints.last().id() + 1; 293 297 QTouchEvent::TouchPoint point(id); 294 298 m_touchPoints.append(point); 295 updateTouchPoint(i d, x, y);296 m_touchPoints[i d].setState(Qt::TouchPointPressed);299 updateTouchPoint(index, x, y); 300 m_touchPoints[index].setState(Qt::TouchPointPressed); 297 301 #endif 298 302 }
Note: See TracChangeset
for help on using the changeset viewer.