Changeset 53994 in webkit
- Timestamp:
- Jan 28, 2010 3:00:35 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r53992 r53994 1 2010-01-28 Ben Murdoch <benm@google.com> 2 3 Reviewed by Simon Hausmann. 4 5 [Android] [Qt] Touch event page co-ordinates are incorrect when touch is received in an iframe. 6 https://bugs.webkit.org/show_bug.cgi?id=34162 7 8 Update the existing iframe touch event test to also examine the page co-ordinates of the touch that is received. 9 10 * fast/events/touch/resources/touch-inside-iframe2.html: 11 * fast/events/touch/touch-inside-iframe-expected.txt: 12 * fast/events/touch/touch-inside-iframe.html: 13 1 14 2010-01-28 Xan Lopez <xlopez@igalia.com> 2 15 -
trunk/LayoutTests/fast/events/touch/resources/touch-inside-iframe2.html
r53597 r53994 1 1 <html> 2 <body >3 <div id='mydiv' style='width:100px;height:100px; '></div>2 <body onload="parent.runTest()"> 3 <div id='mydiv' style='width:100px;height:100px;position:absolute;top:0px; left:0px; background-color:blue;'></div> 4 4 <script type='text/javascript'> 5 document.getElementById('mydiv').addEventListener('touchstart', function() { parent.testComplete( ); }, false);5 document.getElementById('mydiv').addEventListener('touchstart', function() { parent.testComplete(event); }, false); 6 6 </script> 7 7 </body> -
trunk/LayoutTests/fast/events/touch/touch-inside-iframe-expected.txt
r53597 r53994 1 Test that touch events are sent to iframes that listen for them even if the parent frame does not listen for them.2 1 3 PASS 2 Test iframes receive touches correctly. 4 3 4 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 5 6 7 PASS touch.pageX is 50 8 PASS touch.pageY is 50 9 PASS successfullyParsed is true 10 11 TEST COMPLETE 12 -
trunk/LayoutTests/fast/events/touch/touch-inside-iframe.html
r53597 r53994 1 1 <html> 2 <link rel="stylesheet" href="../../js/resources/js-test-style.css"> 3 <script src="../../js/resources/js-test-pre.js"></script> 4 <script src="../../js/resources/js-test-post-function.js"></script> 5 <body> 6 <iframe style="position:absolute; top:100px; left:100px;" src="./resources/touch-inside-iframe2.html"></iframe> 7 <p id="description"></p> 8 <div id="console"></div> 2 9 <script type="text/javascript"> 3 if (window.layoutTestController) 10 description('Test iframes receive touches correctly.'); 11 12 var touch = null; 13 14 function testComplete(event) 4 15 { 5 layoutTestController.dumpAsText(); 16 touch = event.touches[0]; 17 shouldBe("touch.pageX", "50"); 18 shouldBe("touch.pageY", "50"); 19 isSuccessfullyParsed(); 20 layoutTestController.notifyDone(); 21 } 22 23 function runTest() { 24 if (window.eventSender) { 25 // Touch the center of the div in the iframe. 26 // 100px is offset to iframe in main frame, 27 // 2px for the iframe border, 50px to get to centre of the div. 28 eventSender.addTouchPoint(152, 152); 29 eventSender.touchStart(); 30 } else { 31 debug('This test requires DRT.'); 32 } 33 } 34 35 if (window.layoutTestController) { 6 36 layoutTestController.waitUntilDone(); 7 37 } 8 38 9 function runTest() 10 { 11 if (window.eventSender) 12 { 13 eventSender.addTouchPoint(50, 150); 14 eventSender.touchStart(); 15 } 16 } 17 18 function testComplete() 19 { 20 document.getElementById('console').innerText = 'PASS'; 21 layoutTestController.notifyDone(); 22 } 39 var successfullyParsed = true; 23 40 </script> 24 <body onload="runTest();">25 <p>Test that touch events are sent to iframes that listen for them even if the parent frame does not listen for them.</p>26 <div id="console">27 <p>FAIL - no touchstart received!</p>28 </div>29 <iframe src="./resources/touch-inside-iframe2.html" />30 41 </body> 31 42 </html> -
trunk/WebCore/ChangeLog
r53993 r53994 1 2010-01-28 Ben Murdoch <benm@google.com> 2 3 Reviewed by Simon Hausmann. 4 5 [Android] [Qt] Touch event page co-ordinates are incorrect when touch is received in an iframe. 6 https://bugs.webkit.org/show_bug.cgi?id=34162 7 8 The pageX/pageY co-ordinates of a touch event should be relative to the containing frame, not the main frame. This change implements that and also updates the existing touch-inside-iframe test to also examine the page co-ordinates. 9 10 * dom/Touch.cpp: 11 (WebCore::Touch::Touch): Remove dead code. 12 * dom/Touch.h: Remove dead code. 13 * page/EventHandler.cpp: 14 (WebCore::EventHandler::handleTouchEvent): Rename framePoint to pagePoint, as it seems a clearer name. Also adjust the pagePoint to be relative to the touch target element's containing frame rather than the main frame. 15 * platform/PlatformTouchEvent.h: Rename Android specific constructor parameter to better reflect it's contents. 16 * platform/PlatformTouchPoint.h: Ditto. 17 * platform/android/PlatformTouchEventAndroid.cpp: Ditto. 18 * platform/android/PlatformTouchPointAndroid.cpp: Ditto. 19 1 20 2010-01-28 Yury Semikhatsky <yurys@chromium.org> 2 21 -
trunk/WebCore/dom/Touch.cpp
r53069 r53994 56 56 Touch::Touch(Frame* frame, EventTarget* target, unsigned identifier, 57 57 int screenX, int screenY, int pageX, int pageY) 58 : m_frame(frame) 59 , m_target(target) 58 : m_target(target) 60 59 , m_identifier(identifier) 61 , m_clientX(pageX - contentsX( m_frame.get()))62 , m_clientY(pageY - contentsY( m_frame.get()))60 , m_clientX(pageX - contentsX(frame)) 61 , m_clientY(pageY - contentsY(frame)) 63 62 , m_screenX(screenX) 64 63 , m_screenY(screenY) … … 68 67 } 69 68 70 void Touch::updateLocation(int screenX, int screenY, int pageX, int pageY)71 {72 m_clientX = pageX - contentsX(m_frame.get());73 m_clientY = pageY - contentsY(m_frame.get());74 m_screenX = screenX;75 m_screenY = screenY;76 m_pageX = pageX;77 m_pageY = pageY;78 }79 80 69 } // namespace WebCore 81 70 -
trunk/WebCore/dom/Touch.h
r51981 r53994 46 46 } 47 47 48 void updateLocation(int screenX, int screenY, int pageX, int pageY);49 50 Frame* frame() const { return m_frame.get(); }51 48 EventTarget* target() const { return m_target.get(); } 52 49 unsigned identifier() const { return m_identifier; } … … 62 59 int screenX, int screenY, int pageX, int pageY); 63 60 64 RefPtr<Frame> m_frame;65 61 RefPtr<EventTarget> m_target; 66 62 unsigned m_identifier; -
trunk/WebCore/page/EventHandler.cpp
r53597 r53994 2550 2550 for (int i = 0; i < points.size(); ++i) { 2551 2551 const PlatformTouchPoint& point = points[i]; 2552 IntPoint framePoint = documentPointForWindowPoint(m_frame, point.pos());2553 HitTestResult result = hitTestResultAtPoint( framePoint, /*allowShadowContent*/ false);2552 IntPoint pagePoint = documentPointForWindowPoint(m_frame, point.pos()); 2553 HitTestResult result = hitTestResultAtPoint(pagePoint, /*allowShadowContent*/ false); 2554 2554 Node* target = result.innerNode(); 2555 2555 … … 2564 2564 continue; 2565 2565 2566 int adjustedPageX = lroundf(framePoint.x() / m_frame->pageZoomFactor()); 2567 int adjustedPageY = lroundf(framePoint.y() / m_frame->pageZoomFactor()); 2568 2569 RefPtr<Touch> touch = Touch::create(m_frame, target, point.id(), 2566 if (m_frame != doc->frame()) { 2567 // pagePoint should always be relative to the target elements containing frame. 2568 pagePoint = documentPointForWindowPoint(doc->frame(), point.pos()); 2569 } 2570 2571 int adjustedPageX = lroundf(pagePoint.x() / m_frame->pageZoomFactor()); 2572 int adjustedPageY = lroundf(pagePoint.y() / m_frame->pageZoomFactor()); 2573 2574 RefPtr<Touch> touch = Touch::create(doc->frame(), target, point.id(), 2570 2575 point.screenPos().x(), point.screenPos().y(), 2571 2576 adjustedPageX, adjustedPageY); … … 2574 2579 m_touchEventTarget = target; 2575 2580 m_firstTouchScreenPos = point.screenPos(); 2576 m_firstTouchPagePos = framePoint;2581 m_firstTouchPagePos = pagePoint; 2577 2582 } 2578 2583 -
trunk/WebCore/platform/PlatformTouchEvent.h
r53695 r53994 57 57 PlatformTouchEvent(QTouchEvent*); 58 58 #elif PLATFORM(ANDROID) 59 PlatformTouchEvent(const IntPoint& absolutePagePos, TouchEventType, PlatformTouchPoint::State);59 PlatformTouchEvent(const IntPoint& windowPos, TouchEventType, PlatformTouchPoint::State); 60 60 #endif 61 61 -
trunk/WebCore/platform/PlatformTouchPoint.h
r53695 r53994 48 48 PlatformTouchPoint(const QTouchEvent::TouchPoint&); 49 49 #elif PLATFORM(ANDROID) 50 PlatformTouchPoint(const IntPoint& absolutePagePos, State);50 PlatformTouchPoint(const IntPoint& windowPos, State); 51 51 #endif 52 52 -
trunk/WebCore/platform/android/PlatformTouchEventAndroid.cpp
r53695 r53994 31 31 namespace WebCore { 32 32 33 PlatformTouchEvent::PlatformTouchEvent(const IntPoint& absolutePagePos, TouchEventType type, PlatformTouchPoint::State state)33 PlatformTouchEvent::PlatformTouchEvent(const IntPoint& windowPos, TouchEventType type, PlatformTouchPoint::State state) 34 34 : m_type(type) 35 35 , m_ctrlKey(false) … … 38 38 , m_metaKey(false) 39 39 { 40 m_touchPoints.append(PlatformTouchPoint( absolutePagePos, state));40 m_touchPoints.append(PlatformTouchPoint(windowPos, state)); 41 41 } 42 42 -
trunk/WebCore/platform/android/PlatformTouchPointAndroid.cpp
r53695 r53994 31 31 namespace WebCore { 32 32 33 PlatformTouchPoint::PlatformTouchPoint(const IntPoint& absolutePagePos, State state)33 PlatformTouchPoint::PlatformTouchPoint(const IntPoint& windowPos, State state) 34 34 : m_id(0) 35 35 , m_state(state) 36 , m_screenPos( absolutePagePos)37 , m_pos( absolutePagePos) { }36 , m_screenPos(windowPos) 37 , m_pos(windowPos) { } 38 38 39 39 }
Note: See TracChangeset
for help on using the changeset viewer.