Title: [144608] trunk
Revision
144608
Author
apav...@chromium.org
Date
2013-03-04 01:36:45 -0800 (Mon, 04 Mar 2013)

Log Message

Web Inspector: touchmove not emulated inside iframe
https://bugs.webkit.org/show_bug.cgi?id=111292

Reviewed by Vsevolod Vlasov.

Source/WebCore:

Move fake touch event dispatching from mouseMoved() into handleMouseMoveEvent()
and bail out earlier from dispatchSyntheticTouchEventIfEnabled() when the event
should be dispatched on a subframe.

* page/EventHandler.cpp:
(WebCore::EventHandler::mouseMoved):
(WebCore::EventHandler::handleMouseMoveEvent):
(WebCore::EventHandler::dispatchSyntheticTouchEventIfEnabled):

LayoutTests:

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

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (144607 => 144608)


--- trunk/LayoutTests/ChangeLog	2013-03-04 09:33:46 UTC (rev 144607)
+++ trunk/LayoutTests/ChangeLog	2013-03-04 09:36:45 UTC (rev 144608)
@@ -1,3 +1,13 @@
+2013-03-04  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: touchmove not emulated inside iframe
+        https://bugs.webkit.org/show_bug.cgi?id=111292
+
+        Reviewed by Vsevolod Vlasov.
+
+        * fast/events/touch/emulated-touch-iframe.html:
+        * fast/events/touch/resources/emulated-touch-iframe2.html:
+
 2013-03-04  Ádám Kallai  <ka...@inf.u-szeged.hu>
 
         [Qt] Unreviewed gardening.

Modified: trunk/LayoutTests/fast/events/touch/emulated-touch-iframe.html (144607 => 144608)


--- trunk/LayoutTests/fast/events/touch/emulated-touch-iframe.html	2013-03-04 09:33:46 UTC (rev 144607)
+++ trunk/LayoutTests/fast/events/touch/emulated-touch-iframe.html	2013-03-04 09:36:45 UTC (rev 144608)
@@ -7,7 +7,9 @@
 <script type="text/_javascript_">
 
 var touchstartCount = 0;
+var touchmoveCount = 0;
 var EXPECTED_TOUCHSTART_COUNT = 1;
+var EXPECTED_TOUCHMOVE_COUNT = 1;
 var shouldBail;
 
 function testComplete()
@@ -20,11 +22,21 @@
         shouldBail = true;
     }
 
+    if (!touchmoveCount)
+        debug("touchmove not fired for the iframe!");
+    else if (touchmoveCount > EXPECTED_TOUCHMOVE_COUNT)
+        debug("touchmove fired too many times!");
+
     debug("touchend (test will time out if broken)");
     window.internals.settings.setTouchEventEmulationEnabled(false);
     window.testRunner.notifyDone();
 }
 
+function handleTouchmove()
+{
+    ++touchmoveCount;
+}
+
 function handleTouchstart()
 {
     ++touchstartCount;

Modified: trunk/LayoutTests/fast/events/touch/resources/emulated-touch-iframe2.html (144607 => 144608)


--- trunk/LayoutTests/fast/events/touch/resources/emulated-touch-iframe2.html	2013-03-04 09:33:46 UTC (rev 144607)
+++ trunk/LayoutTests/fast/events/touch/resources/emulated-touch-iframe2.html	2013-03-04 09:36:45 UTC (rev 144608)
@@ -4,6 +4,7 @@
 <script type='text/_javascript_'>
 var myDiv = document.getElementById('mydiv');
 myDiv.addEventListener('touchstart', function() { parent.handleTouchstart(); }, false);
+myDiv.addEventListener('touchmove', function() { parent.handleTouchmove(); }, false);
 myDiv.addEventListener('touchend', function() { parent.testComplete(); }, false);
 </script>
 </body>

Modified: trunk/Source/WebCore/ChangeLog (144607 => 144608)


--- trunk/Source/WebCore/ChangeLog	2013-03-04 09:33:46 UTC (rev 144607)
+++ trunk/Source/WebCore/ChangeLog	2013-03-04 09:36:45 UTC (rev 144608)
@@ -1,3 +1,19 @@
+2013-03-04  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: touchmove not emulated inside iframe
+        https://bugs.webkit.org/show_bug.cgi?id=111292
+
+        Reviewed by Vsevolod Vlasov.
+
+        Move fake touch event dispatching from mouseMoved() into handleMouseMoveEvent()
+        and bail out earlier from dispatchSyntheticTouchEventIfEnabled() when the event
+        should be dispatched on a subframe.
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::mouseMoved):
+        (WebCore::EventHandler::handleMouseMoveEvent):
+        (WebCore::EventHandler::dispatchSyntheticTouchEventIfEnabled):
+
 2013-03-04  Mike West  <mk...@chromium.org>
 
         Long URLs in error messages should be shortened

Modified: trunk/Source/WebCore/page/EventHandler.cpp (144607 => 144608)


--- trunk/Source/WebCore/page/EventHandler.cpp	2013-03-04 09:33:46 UTC (rev 144607)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2013-03-04 09:36:45 UTC (rev 144608)
@@ -1588,14 +1588,6 @@
     RefPtr<FrameView> protector(m_frame->view());
     MaximumDurationTracker maxDurationTracker(&m_maxMouseMovedDuration);
 
-
-#if ENABLE(TOUCH_EVENTS)
-    // FIXME: this should be moved elsewhere to also be able to dispatch touchcancel events.
-    bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(event);
-    if (defaultPrevented)
-        return true;
-#endif
-
     HitTestResult hoveredNode = HitTestResult(LayoutPoint());
     bool result = handleMouseMoveEvent(event, &hoveredNode);
 
@@ -1635,6 +1627,12 @@
     if (!m_frame)
         return false;
 
+#if ENABLE(TOUCH_EVENTS)
+    bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(mouseEvent);
+    if (defaultPrevented)
+        return true;
+#endif
+
     RefPtr<FrameView> protector(m_frame->view());
     
     setLastKnownMousePosition(mouseEvent);
@@ -4005,15 +4003,15 @@
     if (eventType != PlatformEvent::MouseMoved && eventType != PlatformEvent::MousePressed && eventType != PlatformEvent::MouseReleased)
         return false;
 
-    if (eventType == PlatformEvent::MouseMoved && !m_touchPressed)
-        return true;
-
     HitTestRequest request(HitTestRequest::Active);
     MouseEventWithHitTestResults mev = prepareMouseEvent(request, event);
-
     if (mev.scrollbar() || subframeForHitTestResult(mev))
         return false;
 
+    // The order is important. This check should follow the subframe test: http://webkit.org/b/111292.
+    if (eventType == PlatformEvent::MouseMoved && !m_touchPressed)
+        return true;
+
     SyntheticSingleTouchEvent touchEvent(event);
     return handleTouchEvent(touchEvent);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to