Title: [140292] trunk
Revision
140292
Author
[email protected]
Date
2013-01-20 21:12:37 -0800 (Sun, 20 Jan 2013)

Log Message

Dispatch LongPress to inner frames
https://bugs.webkit.org/show_bug.cgi?id=106874

Patch by Yongsheng Zhu <[email protected]> on 2013-01-20
Reviewed by Antonio Gomes.

Source/WebCore:

Do check whether a LongPress gesture event should be passed
to inner frames. If needed, dispatch it.

Tests: fast/events/touch/gesture/long-press-on-draggable-element-in-iframe-triggers-drag.html
       fast/events/touch/gesture/long-press-on-draggable-element-in-nested-iframes-triggers-drag.html

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

LayoutTests:

* fast/events/touch/gesture/long-press-on-draggable-element-in-iframe-triggers-drag.html: Added.
* fast/events/touch/gesture/long-press-on-draggable-element-in-nested-iframes-triggers-drag.html: Added.
* fast/events/touch/gesture/resources/drag-inside-iframe2.html: Added.
* fast/events/touch/gesture/resources/drag-inside-nested-iframes2.html: Added.
* fast/events/touch/gesture/resources/drag-inside-nested-iframes3.html: Added.
* platform/chromium/fast/events/touch/gesture/long-press-on-draggable-element-in-iframe-triggers-drag-expected.txt: Added.
* platform/chromium/fast/events/touch/gesture/long-press-on-draggable-element-in-nested-iframes-triggers-drag-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (140291 => 140292)


--- trunk/LayoutTests/ChangeLog	2013-01-21 03:52:02 UTC (rev 140291)
+++ trunk/LayoutTests/ChangeLog	2013-01-21 05:12:37 UTC (rev 140292)
@@ -1,3 +1,18 @@
+2013-01-20  Yongsheng Zhu  <[email protected]>
+
+        Dispatch LongPress to inner frames
+        https://bugs.webkit.org/show_bug.cgi?id=106874
+
+        Reviewed by Antonio Gomes.
+
+        * fast/events/touch/gesture/long-press-on-draggable-element-in-iframe-triggers-drag.html: Added.
+        * fast/events/touch/gesture/long-press-on-draggable-element-in-nested-iframes-triggers-drag.html: Added.
+        * fast/events/touch/gesture/resources/drag-inside-iframe2.html: Added.
+        * fast/events/touch/gesture/resources/drag-inside-nested-iframes2.html: Added.
+        * fast/events/touch/gesture/resources/drag-inside-nested-iframes3.html: Added.
+        * platform/chromium/fast/events/touch/gesture/long-press-on-draggable-element-in-iframe-triggers-drag-expected.txt: Added.
+        * platform/chromium/fast/events/touch/gesture/long-press-on-draggable-element-in-nested-iframes-triggers-drag-expected.txt: Added.
+
 2013-01-20  Kent Tamura  <[email protected]>
 
         Re-layout child blocks when border/padding of the box-sizing:border-box parent is updated

Added: trunk/LayoutTests/fast/events/touch/gesture/long-press-on-draggable-element-in-iframe-triggers-drag.html (0 => 140292)


--- trunk/LayoutTests/fast/events/touch/gesture/long-press-on-draggable-element-in-iframe-triggers-drag.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/long-press-on-draggable-element-in-iframe-triggers-drag.html	2013-01-21 05:12:37 UTC (rev 140292)
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<iframe src=""
+<p>This test checks that a long press gesture on a draggable element in an iframe starts a drag/drop session.</p>
+<div id="text">Testing</div>
+<div id="result">FAIL</div>
+<script>
+function onDragStart() {
+    document.getElementById("result").innerHTML = "PASS";
+    if (window.testRunner) {
+        testRunner.notifyDone();
+    }
+}
+function runTest()
+{
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    if (testRunner.setTouchDragDropEnabled)
+        testRunner.setTouchDragDropEnabled(true);
+
+    if (!window.eventSender)
+        return;
+    if (eventSender.gestureLongPress) {
+        eventSender.gestureLongPress(50, 50);
+        eventSender.mouseUp();
+    } else {
+        debug("gestureLongPress not implemented by this platform");
+        return;
+    }
+}
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+}
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/events/touch/gesture/long-press-on-draggable-element-in-nested-iframes-triggers-drag.html (0 => 140292)


--- trunk/LayoutTests/fast/events/touch/gesture/long-press-on-draggable-element-in-nested-iframes-triggers-drag.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/long-press-on-draggable-element-in-nested-iframes-triggers-drag.html	2013-01-21 05:12:37 UTC (rev 140292)
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<iframe src=""
+<p>This test checks that a long press gesture on a draggable element in an iframe starts a drag/drop session.</p>
+<div id="text">Testing</div>
+<div id="result">FAIL</div>
+<script>
+function onDragStart() {
+    document.getElementById("result").innerHTML = "PASS";
+    if (window.testRunner) {
+        testRunner.notifyDone();
+    }
+}
+function runTest()
+{
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    if (testRunner.setTouchDragDropEnabled)
+        testRunner.setTouchDragDropEnabled(true);
+
+    if (!window.eventSender)
+        return;
+    if (eventSender.gestureLongPress) {
+        eventSender.gestureLongPress(20, 20);
+        eventSender.mouseUp();
+    } else {
+        debug("gestureLongPress not implemented by this platform");
+        return;
+    }
+}
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+}
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/events/touch/gesture/resources/drag-inside-iframe2.html (0 => 140292)


--- trunk/LayoutTests/fast/events/touch/gesture/resources/drag-inside-iframe2.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/resources/drag-inside-iframe2.html	2013-01-21 05:12:37 UTC (rev 140292)
@@ -0,0 +1,11 @@
+<html>
+<body _onload_="top.runTest()">
+<div id='mydiv' draggable='true' _ondragstart_='drag(event)' style='width:100px;height:100px;position:absolute;top:0px; left:0px; background-color:blue;'>
+Drag me</div>
+<script type='text/_javascript_'>
+    function drag(event) {
+        top.onDragStart();
+    }
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/events/touch/gesture/resources/drag-inside-nested-iframes2.html (0 => 140292)


--- trunk/LayoutTests/fast/events/touch/gesture/resources/drag-inside-nested-iframes2.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/resources/drag-inside-nested-iframes2.html	2013-01-21 05:12:37 UTC (rev 140292)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<iframe src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/events/touch/gesture/resources/drag-inside-nested-iframes3.html (0 => 140292)


--- trunk/LayoutTests/fast/events/touch/gesture/resources/drag-inside-nested-iframes3.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/resources/drag-inside-nested-iframes3.html	2013-01-21 05:12:37 UTC (rev 140292)
@@ -0,0 +1,11 @@
+<html>
+<body _onload_="top.runTest()">
+<div id='mydiv' draggable='true' _ondragstart_='drag(event)' style='width:100px;height:100px;position:absolute;top:0px; left:0px; background-color:blue;'>
+Drag me</div>
+<script type='text/_javascript_'>
+    function drag(event) {
+        top.onDragStart();
+    }
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/long-press-on-draggable-element-in-iframe-triggers-drag-expected.txt (0 => 140292)


--- trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/long-press-on-draggable-element-in-iframe-triggers-drag-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/long-press-on-draggable-element-in-iframe-triggers-drag-expected.txt	2013-01-21 05:12:37 UTC (rev 140292)
@@ -0,0 +1,5 @@
+
+This test checks that a long press gesture on a draggable element in an iframe starts a drag/drop session.
+
+Testing
+PASS

Added: trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/long-press-on-draggable-element-in-nested-iframes-triggers-drag-expected.txt (0 => 140292)


--- trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/long-press-on-draggable-element-in-nested-iframes-triggers-drag-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/long-press-on-draggable-element-in-nested-iframes-triggers-drag-expected.txt	2013-01-21 05:12:37 UTC (rev 140292)
@@ -0,0 +1,5 @@
+
+This test checks that a long press gesture on a draggable element in an iframe starts a drag/drop session.
+
+Testing
+PASS

Modified: trunk/Source/WebCore/ChangeLog (140291 => 140292)


--- trunk/Source/WebCore/ChangeLog	2013-01-21 03:52:02 UTC (rev 140291)
+++ trunk/Source/WebCore/ChangeLog	2013-01-21 05:12:37 UTC (rev 140292)
@@ -1,3 +1,19 @@
+2013-01-20  Yongsheng Zhu  <[email protected]>
+
+        Dispatch LongPress to inner frames
+        https://bugs.webkit.org/show_bug.cgi?id=106874
+
+        Reviewed by Antonio Gomes.
+
+        Do check whether a LongPress gesture event should be passed
+        to inner frames. If needed, dispatch it.
+
+        Tests: fast/events/touch/gesture/long-press-on-draggable-element-in-iframe-triggers-drag.html
+               fast/events/touch/gesture/long-press-on-draggable-element-in-nested-iframes-triggers-drag.html
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleGestureLongPress):
+
 2013-01-20  Gyuyoung Kim  <[email protected]>
 
         Clean up missing *explicit* keyword in ctors of WebCore/rendering.

Modified: trunk/Source/WebCore/page/EventHandler.cpp (140291 => 140292)


--- trunk/Source/WebCore/page/EventHandler.cpp	2013-01-21 03:52:02 UTC (rev 140291)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2013-01-21 05:12:37 UTC (rev 140292)
@@ -2546,6 +2546,11 @@
         HitTestRequest request(HitTestRequest::ReadOnly);
         MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseDragEvent);
         m_didStartDrag = false;
+        RefPtr<Frame> subframe = subframeForHitTestResult(mev);
+        if (subframe && !m_mouseDownMayStartDrag) {
+            if (subframe->eventHandler()->handleGestureLongPress(gestureEvent))
+                return true;
+        }
         handleDrag(mev, DontCheckDragHysteresis);
         if (m_didStartDrag)
             return true;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to