Web Inspector: Touch event emulation fails for iframes
authorapavlov@chromium.org <apavlov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2012 11:13:03 +0000 (11:13 +0000)
committerapavlov@chromium.org <apavlov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2012 11:13:03 +0000 (11:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77987

Reviewed by Pavel Feldman.

Source/WebCore:

Test: fast/events/touch/emulated-touch-iframe.html

* page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseReleaseEvent):

LayoutTests:

* fast/events/touch/emulated-touch-iframe-expected.txt: Added.
* fast/events/touch/emulated-touch-iframe.html: Added.
* fast/events/touch/resources/emulated-touch-iframe2.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107062 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/events/touch/emulated-touch-iframe-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/touch/emulated-touch-iframe.html [new file with mode: 0644]
LayoutTests/fast/events/touch/resources/emulated-touch-iframe2.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/EventHandler.cpp

index 413265a..562335d 100644 (file)
@@ -1,3 +1,14 @@
+2012-02-08  Alexander Pavlov  <apavlov@chromium.org>
+
+        Web Inspector: Touch event emulation fails for iframes
+        https://bugs.webkit.org/show_bug.cgi?id=77987
+
+        Reviewed by Pavel Feldman.
+
+        * fast/events/touch/emulated-touch-iframe-expected.txt: Added.
+        * fast/events/touch/emulated-touch-iframe.html: Added.
+        * fast/events/touch/resources/emulated-touch-iframe2.html: Added.
+
 2012-02-08  Nikolas Zimmermann  <nzimmermann@rim.com>
 
         [Qt] REGRESSION(r106918): It made svg/zoom/page/zoom-foreignObject.svg crash with Qt5-WK1
diff --git a/LayoutTests/fast/events/touch/emulated-touch-iframe-expected.txt b/LayoutTests/fast/events/touch/emulated-touch-iframe-expected.txt
new file mode 100644 (file)
index 0000000..d2f4a03
--- /dev/null
@@ -0,0 +1,5 @@
+
+Test touchend events are emulated in iframes correctly.
+
+Final touchend (test will time out if broken)
+
diff --git a/LayoutTests/fast/events/touch/emulated-touch-iframe.html b/LayoutTests/fast/events/touch/emulated-touch-iframe.html
new file mode 100644 (file)
index 0000000..8cb82f1
--- /dev/null
@@ -0,0 +1,38 @@
+<html>
+<script src="../../js/resources/js-test-pre.js"></script>
+<body>
+<iframe style="position:absolute; top:100px; left:100px;" src="./resources/emulated-touch-iframe2.html"></iframe>
+<p>Test touchend events are emulated in iframes correctly.</p>
+<div id="console"></div>
+<script type="text/javascript">
+
+var eventCount = 0;
+var EXPECTED_EVENT_COUNT = 2;
+
+function testComplete()
+{
+    if (++eventCount === EXPECTED_EVENT_COUNT) {
+        debug("Final touchend (test will time out if broken)");
+        window.layoutTestController.notifyDone();
+    }
+}
+
+function runTest() {
+    if (window.eventSender && window.internals && window.internals.settings) {
+        window.eventSender.dragMode = false;
+        window.internals.settings.setTouchEventEmulationEnabled(true);
+
+        eventSender.mouseMoveTo(110, 110);
+        eventSender.mouseDown(0);
+        eventSender.mouseMoveTo(120, 130);
+        eventSender.mouseUp(0);
+    } else
+       debug('This test requires DRT.');
+}
+
+if (window.layoutTestController)
+    window.layoutTestController.waitUntilDone();
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/fast/events/touch/resources/emulated-touch-iframe2.html b/LayoutTests/fast/events/touch/resources/emulated-touch-iframe2.html
new file mode 100644 (file)
index 0000000..a4027e3
--- /dev/null
@@ -0,0 +1,9 @@
+<html>
+<body onload="parent.runTest()">
+<div id='mydiv' style='width:100px;height:100px;position:absolute;top:0px; left:0px; background-color:blue;'></div>
+<script type='text/javascript'>
+var myDiv = document.getElementById('mydiv');
+myDiv.addEventListener('touchend', function() { parent.testComplete(); }, false);
+</script>
+</body>
+</html>
index 34c7716..38cd2c2 100644 (file)
@@ -1,3 +1,15 @@
+2012-02-08  Alexander Pavlov  <apavlov@chromium.org>
+
+        Web Inspector: Touch event emulation fails for iframes
+        https://bugs.webkit.org/show_bug.cgi?id=77987
+
+        Reviewed by Pavel Feldman.
+
+        Test: fast/events/touch/emulated-touch-iframe.html
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleMouseReleaseEvent):
+
 2012-02-08  Andreas Kling  <awesomekling@apple.com>
 
         StyledElement: Manully setNeedsStyleRecalc() after adding CSSProperties directly.
index e30b42d..9acfc54 100644 (file)
@@ -807,12 +807,6 @@ bool EventHandler::handleMouseUp(const MouseEventWithHitTestResults& event)
 
 bool EventHandler::handleMouseReleaseEvent(const MouseEventWithHitTestResults& event)
 {
-#if ENABLE(TOUCH_EVENTS)
-    bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(event.event());
-    if (defaultPrevented)
-        return true;
-#endif
-
     if (m_autoscrollInProgress)
         stopAutoscrollTimer();
 
@@ -1787,7 +1781,13 @@ void EventHandler::invalidateClick()
 bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
 {
     RefPtr<FrameView> protector(m_frame->view());
-    
+
+#if ENABLE(TOUCH_EVENTS)
+    bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(mouseEvent);
+    if (defaultPrevented)
+        return true;
+#endif
+
     UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
 
 #if ENABLE(PAN_SCROLLING)