Dragging over an element with scrollbars should scroll the element when dragging near edges
https://bugs.webkit.org/show_bug.cgi?id=39725

Reviewed by Hajime Morita.

Source/WebCore:

This patch introduces auto scrolling functionality during drag-and-drop
when drop source is near edge of scrollable element.

When drop source is inside 20px of scrollable element more than 200ms,
scrollable element is automatically scrolled every 50ms toward drop
source position, e.g. vertically scroll up when drop source is in top
edge.

Test: fast/events/drag-and-drop-autoscroll.html

* page/AutoscrollController.cpp:
(WebCore::AutoscrollController::AutoscrollController): Changed to initialize m_dragAndDropAutoscrollStartTime.
(WebCore::AutoscrollController::updateDragAndDrop): Added for start/stop autoscroll during drag-and-drop.
(WebCore::AutoscrollController::autoscrollTimerFired): Changed to add autoscroll for drag-and-drop, and to pass last know position to RenderBox::autoscroll().
* page/AutoscrollController.h:
(AutoscrollController): Changed to add updateDragAndDrop() and m_dragAndDropAutoscrollReferencePosition and m_dragAndDropAutoscrollStartTime.
* page/ChromeClient.h:
(WebCore::ChromeClient): Changed to add new function shouldAutoscrollForDragAndDrop().
* page/EventHandler.cpp:
(WebCore::EventHandler::updateDragAndDrop): Changed to call AutoscrollController::updateDragAndDrop().
(WebCore::EventHandler::clearDragState): Changed to call stopAutoscrollTimer().
* rendering/RenderBox.cpp:
(WebCore::RenderBox::autoscroll): Changed for new parameter position.
(WebCore::RenderBox::calculateAutoscrollDirection): Added for autoscroll.
* rendering/RenderBox.h:
(RenderBox):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::autoscroll):  Changed for new parameter position and move updateSelectionForMouseDrag() to AutoscrollController.
* rendering/RenderLayer.h:
(RenderLayer):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::autoscroll):  Changed for new parameter position.
* rendering/RenderListBox.h:
(RenderListBox):
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::autoscroll):  Changed for new parameter position.
* rendering/RenderTextControlSingleLine.h:
(RenderTextControlSingleLine):

Source/WebKit/chromium:

This patch removes DragScrollTimer used for automatic scrolling of main
frame drag-and-drop which is now implemented in EventHandler.

Another patch will remove DragScrollTimer.{cpp,h} and update GYP files to
make patch size small.

No tests. Existing test covers this change.

* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::shouldAutoscrollForDragAndDrop): Added.
* src/ChromeClientImpl.h:
(ChromeClientImpl): Changed to add shouldAutoscrollForDragAndDrop().
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::WebViewImpl): Changed to remove m_dragScrollTimer.
(WebKit::WebViewImpl::dragSourceEndedAt): ditto
(WebKit::WebViewImpl::dragSourceMovedTo): ditto
(WebKit::WebViewImpl::dragTargetDrop): ditto
(WebKit::WebViewImpl::dragTargetDragEnterOrOver): ditto
* src/WebViewImpl.h:
(WebKit): Chagned to remove DragScrollTimer.

Tools:

This patch introduces canceling drag-and-drop by escape key for testing
behavior after cancellation drag-and-drop.

* DumpRenderTree/chromium/TestRunner/src/EventSender.cpp:
(WebTestRunner):
(WebTestRunner::EventSender::doMouseUp):
(WebTestRunner::EventSender::finishDragAndDrop):
(WebTestRunner::EventSender::keyDown):
* DumpRenderTree/chromium/TestRunner/src/EventSender.h:
(EventSender):
* DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.h: Added VKEY_ESCAPE.

LayoutTests:

This patch adds new test for autoscroll during drag-and-drop.
This test is skipped other than Chromium ports.

* fast/events/drag-and-drop-autoscroll-expected.txt: Added.
* fast/events/drag-and-drop-autoscroll.html: Added.
* platform/efl/TestExpectations: Changed to skip fast/events/drag-and-drop-autoscroll.html
* platform/wincairo/TestExpectations: ditto.
* platform/mac/TestExpectations: ditto.
* platform/mac/TestExpectations: ditto.
* platform/qt/TestExpectations: ditto.
* platform/gtk/TestExpectations: ditto.
* platform/win/TestExpectations: ditto.
* platform/wk2/TestExpectations: ditto.


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