diff options
author | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-11-27 00:56:30 +0000 |
---|---|---|
committer | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-11-27 00:56:30 +0000 |
commit | 9032e73157be5e6cd1e27d745b864e20db231fe2 (patch) | |
tree | f556691a81c4c8fa72a907d9f8a20346e6a050e6 /third_party/WebKit/LayoutTests/touchadjustment | |
parent | f3a55e62aa7ba975fa39f7b544ffe95af7b3d4a6 (diff) | |
download | chromium_src-9032e73157be5e6cd1e27d745b864e20db231fe2.zip chromium_src-9032e73157be5e6cd1e27d745b864e20db231fe2.tar.gz chromium_src-9032e73157be5e6cd1e27d745b864e20db231fe2.tar.bz2 |
LongPress and LongTap gestures should start drag/drop and open context menu respectively.
https://bugs.webkit.org/show_bug.cgi?id=101545
Patch by Varun Jain <varunjain@chromium.org> on 2012-11-26
Reviewed by Antonio Gomes.
For LongPress, we simulate drag by sending a mouse down and mouse drag
events. If a drag is not started (because maybe there is no draggable
element), then we show context menu instead (which is the current
behavior for LongPress). For LongTap, we use the existing functions that
LongPress uses to summon the context menu. LongPress initiated drag and
drop can be enabled/disabled by the platform using the Setting
touchDragDropEnabled which is disabled by default.
Source/WebCore:
Tests: fast/events/touch/gesture/context-menu-on-long-tap.html
fast/events/touch/gesture/long-press-on-draggable-element-triggers-drag.html
* page/EventHandler.cpp:
(WebCore::EventHandler::EventHandler):
(WebCore::EventHandler::clear):
(WebCore::EventHandler::handleMouseDraggedEvent):
(WebCore::EventHandler::handleGestureEvent):
(WebCore::EventHandler::handleGestureLongPress):
(WebCore::EventHandler::handleGestureLongTap):
(WebCore):
(WebCore::EventHandler::handleGestureForTextSelectionOrContextMenu):
(WebCore::EventHandler::adjustGesturePosition):
(WebCore::EventHandler::handleDrag):
* page/EventHandler.h:
(EventHandler):
* page/Settings.in:
Source/WebKit/chromium:
* public/WebSettings.h:
* src/WebSettingsImpl.cpp:
(WebKit::WebSettingsImpl::setTouchDragDropEnabled):
(WebKit):
* src/WebSettingsImpl.h:
(WebSettingsImpl):
Tools:
* DumpRenderTree/chromium/TestRunner/src/EventSender.cpp:
(WebTestRunner):
(WebTestRunner::EventSender::EventSender):
(WebTestRunner::EventSender::gestureLongTap):
(WebTestRunner::EventSender::gestureEvent):
* DumpRenderTree/chromium/TestRunner/src/EventSender.h:
(EventSender):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
(WebTestRunner::TestRunner::TestRunner):
(WebTestRunner::TestRunner::setTouchDragDropEnabled):
(WebTestRunner):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
(TestRunner):
LayoutTests:
* fast/events/touch/gesture/context-menu-on-long-tap.html: Added.
* fast/events/touch/gesture/long-press-on-draggable-element-triggers-drag.html: Added.
* platform/chromium/fast/events/touch/gesture/context-menu-on-long-tap-expected.txt: Added.
* platform/chromium/fast/events/touch/gesture/long-press-on-draggable-element-triggers-drag-expected.txt: Added.
* touchadjustment/touch-links-longpress-expected.txt:
* touchadjustment/touch-links-longpress.html:
git-svn-id: svn://svn.chromium.org/blink/trunk@135789 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/touchadjustment')
-rw-r--r-- | third_party/WebKit/LayoutTests/touchadjustment/touch-links-longpress-expected.txt | 2 | ||||
-rw-r--r-- | third_party/WebKit/LayoutTests/touchadjustment/touch-links-longpress.html | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/third_party/WebKit/LayoutTests/touchadjustment/touch-links-longpress-expected.txt b/third_party/WebKit/LayoutTests/touchadjustment/touch-links-longpress-expected.txt index 1951f97..c22036c 100644 --- a/third_party/WebKit/LayoutTests/touchadjustment/touch-links-longpress-expected.txt +++ b/third_party/WebKit/LayoutTests/touchadjustment/touch-links-longpress-expected.txt @@ -1,4 +1,4 @@ -Tests if a long press gesture on links will trigger a context menu when touch adjustment is used. +Tests if a long press gesture on links will trigger a drag/drop when touch adjustment is used. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". diff --git a/third_party/WebKit/LayoutTests/touchadjustment/touch-links-longpress.html b/third_party/WebKit/LayoutTests/touchadjustment/touch-links-longpress.html index dca907b..fda9c66 100644 --- a/third_party/WebKit/LayoutTests/touchadjustment/touch-links-longpress.html +++ b/third_party/WebKit/LayoutTests/touchadjustment/touch-links-longpress.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <html> <head> - <title>Touch Adjustment : Testing that a context menu will appear on a long press - bug 92914</title> + <title>Touch Adjustment : Testing that a drag/drop will start on a long press - bug 92914</title> <script src="../fast/js/resources/js-test-pre.js"></script> <script src="resources/touchadjustment.js"></script> <style> @@ -31,7 +31,7 @@ e[a] = document.getElementById(a); }); - document.oncontextmenu = function() { debug("PASS"); } + document.ondragstart = function(e) { debug("PASS"); e.preventDefault();} function testLongPress(touchpoint) { @@ -89,7 +89,8 @@ function runTests() { if (window.testRunner && window.internals && internals.touchNodeAdjustedToBestClickableNode) { - description('Tests if a long press gesture on links will trigger a context menu when touch adjustment is used.'); + testRunner.setTouchDragDropEnabled(true); + description('Tests if a long press gesture on links will trigger a drag/drop when touch adjustment is used.'); testDirectTouches(); testIndirectTouches(); e.sandbox.style.display = 'none'; |