From 2f2aefce29449ec2eb34759befd97533b6acebd9 Mon Sep 17 00:00:00 2001 From: "apavlov@chromium.org" Date: Mon, 21 Jan 2013 12:06:57 +0000 Subject: [PATCH] Web Inspector: Do not dispatch mousemove when emulating touch event and no touch is active https://bugs.webkit.org/show_bug.cgi?id=107419 Reviewed by Pavel Feldman. Source/WebCore: mousemove event should not be dispatched when emulating touch events and mouse button is not pressed * page/EventHandler.cpp: (WebCore::EventHandler::dispatchSyntheticTouchEventIfEnabled): LayoutTests: * fast/events/touch/emulate-touch-events.html: Test that mousemove is dispatched not more than once and reset the touch event emulation flag in window.internals.settings upon test completion. * fast/events/touch/emulated-touch-iframe.html: Reset the touch event emulation flag in window.internals.settings upon test completion. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140321 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 12 ++++++++++++ LayoutTests/fast/events/touch/emulate-touch-events.html | 10 +++++++++- LayoutTests/fast/events/touch/emulated-touch-iframe.html | 1 + Source/WebCore/ChangeLog | 12 ++++++++++++ Source/WebCore/page/EventHandler.cpp | 2 +- 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index fa0a2e3..c73566b 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,15 @@ +2013-01-21 Alexander Pavlov + + Web Inspector: Do not dispatch mousemove when emulating touch event and no touch is active + https://bugs.webkit.org/show_bug.cgi?id=107419 + + Reviewed by Pavel Feldman. + + * fast/events/touch/emulate-touch-events.html: Test that mousemove is dispatched not more than once + and reset the touch event emulation flag in window.internals.settings upon test completion. + * fast/events/touch/emulated-touch-iframe.html: + Reset the touch event emulation flag in window.internals.settings upon test completion. + 2013-01-21 Andrey Lushnikov Web Inspector: fix highlight bug in DTE. diff --git a/LayoutTests/fast/events/touch/emulate-touch-events.html b/LayoutTests/fast/events/touch/emulate-touch-events.html index 97971dc2..90255f2 100644 --- a/LayoutTests/fast/events/touch/emulate-touch-events.html +++ b/LayoutTests/fast/events/touch/emulate-touch-events.html @@ -18,13 +18,21 @@ function touchEventCallback() { } else debug(event.type); - if (window.testRunner && touchEventsReceived == EXPECTED_TOUCH_EVENTS_TOTAL) + if (window.testRunner && touchEventsReceived == EXPECTED_TOUCH_EVENTS_TOTAL) { + window.internals.settings.setTouchEventEmulationEnabled(false); finishJSTest(); + } +} + +function mouseMoveCallback(e) { + if (!lastEvent) + debug("Unexpected mousemove event received before touchstart"); } div.addEventListener("touchstart", touchEventCallback, false); div.addEventListener("touchmove", touchEventCallback, false); div.addEventListener("touchend", touchEventCallback, false); +div.addEventListener("mousemove", mouseMoveCallback, false); function verifyTouchEvent(type, totalTouchCount, changedTouchCount, targetTouchCount) { diff --git a/LayoutTests/fast/events/touch/emulated-touch-iframe.html b/LayoutTests/fast/events/touch/emulated-touch-iframe.html index 8871cd6..f6ebc23 100644 --- a/LayoutTests/fast/events/touch/emulated-touch-iframe.html +++ b/LayoutTests/fast/events/touch/emulated-touch-iframe.html @@ -21,6 +21,7 @@ function testComplete() } debug("touchend (test will time out if broken)"); + window.internals.settings.setTouchEventEmulationEnabled(false); window.testRunner.notifyDone(); } diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index c191cb0..c09f935 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,15 @@ +2013-01-21 Alexander Pavlov + + Web Inspector: Do not dispatch mousemove when emulating touch event and no touch is active + https://bugs.webkit.org/show_bug.cgi?id=107419 + + Reviewed by Pavel Feldman. + + mousemove event should not be dispatched when emulating touch events and mouse button is not pressed + + * page/EventHandler.cpp: + (WebCore::EventHandler::dispatchSyntheticTouchEventIfEnabled): + 2013-01-21 Andrey Lushnikov Web Inspector: fix highlight bug in DTE. diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp index 2157ea2..0e4a4a3 100644 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp @@ -3981,7 +3981,7 @@ bool EventHandler::dispatchSyntheticTouchEventIfEnabled(const PlatformMouseEvent return false; if (eventType == PlatformEvent::MouseMoved && !m_touchPressed) - return false; + return true; HitTestRequest request(HitTestRequest::Active); MouseEventWithHitTestResults mev = prepareMouseEvent(request, event); -- 1.8.3.1