Changeset 140286 in webkit


Ignore:
Timestamp:
Jan 20, 2013 5:29:07 PM (11 years ago)
Author:
yosin@chromium.org
Message:

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.
Location:
trunk
Files:
2 added
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140276 r140286  
     12013-01-20  Yoshifumi Inoue  <yosin@chromium.org>
     2
     3        Dragging over an element with scrollbars should scroll the element when dragging near edges
     4        https://bugs.webkit.org/show_bug.cgi?id=39725
     5
     6        Reviewed by Hajime Morita.
     7
     8        This patch adds new test for autoscroll during drag-and-drop.
     9        This test is skipped other than Chromium ports.
     10
     11        * fast/events/drag-and-drop-autoscroll-expected.txt: Added.
     12        * fast/events/drag-and-drop-autoscroll.html: Added.
     13        * platform/efl/TestExpectations: Changed to skip fast/events/drag-and-drop-autoscroll.html
     14        * platform/wincairo/TestExpectations: ditto.
     15        * platform/mac/TestExpectations: ditto.
     16        * platform/mac/TestExpectations: ditto.
     17        * platform/qt/TestExpectations: ditto.
     18        * platform/gtk/TestExpectations: ditto.
     19        * platform/win/TestExpectations: ditto.
     20        * platform/wk2/TestExpectations: ditto.
     21
    1222013-01-20  Filip Pizlo  <fpizlo@apple.com>
    223
  • trunk/LayoutTests/platform/efl/TestExpectations

    r140257 r140286  
    17811781webkit.org/b/105535 inspector-protocol/nmi-webaudio-leak-test.html [ Failure ]
    17821782
     1783# Enable when support drag-and-drop autoscrolling
     1784webkit.org/b/39725 fast/events/drag-and-drop-autoscroll.html [ Skip ]
     1785
    17831786# Leaking state into the next test.
    17841787webkit.org/b/85522 http/tests/security/sandboxed-iframe-form-top.html [ Skip ]
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r140255 r140286  
    13411341webkit.org/b/98146 accessibility/svg-bounds.html [ Failure ]
    13421342
     1343# Enable when support drag-and-drop autoscrolling
     1344webkit.org/b/39725 fast/events/drag-and-drop-autoscroll.html [ Skip ]
     1345
    13431346# Leaking state into the next test.
    13441347webkit.org/b/85522 http/tests/security/sandboxed-iframe-form-top.html [ Skip ]
  • trunk/LayoutTests/platform/mac/TestExpectations

    r140202 r140286  
    12741274webkit.org/b/106415 fast/workers/worker-lifecycle.html [ Pass Failure ]
    12751275
     1276# Enable when support drag-and-drop autoscrolling
     1277webkit.org/b/39725 fast/events/drag-and-drop-autoscroll.html [ Skip ]
     1278
    12761279# Transient. Needs rebaseline.
    12771280webkit.org/b/103955 fast/repaint/4774354.html [ ImageOnlyFailure ]
  • trunk/LayoutTests/platform/qt/TestExpectations

    r139866 r140286  
    25162516webkit.org/b/106459 [ Debug ] fast/js/dfg-create-inlined-arguments-in-closure-inline.html
    25172517
     2518# Enable when support drag-and-drop autoscrolling
     2519webkit.org/b/39725 fast/events/drag-and-drop-autoscroll.html [ Skip ]
     2520
    25182521# New inspector/editor/text-editor-formatter.html introduced in r139617 fails on EFL, Mac, QT
    25192522# https://bugs.webkit.org/show_bug.cgi?id=106883
  • trunk/LayoutTests/platform/win/TestExpectations

    r139866 r140286  
    25072507media/video-controls-visible-exiting-fullscreen.html
    25082508
     2509# Enable when support drag-and-drop autoscrolling
     2510webkit.org/b/39725 fast/events/drag-and-drop-autoscroll.html [ Skip ]
     2511
    25092512# Device Proximity is not enabled/implemented
    25102513proximity/add-listener-from-callback.html
  • trunk/LayoutTests/platform/wincairo/TestExpectations

    r139866 r140286  
    29602960fast/xmlhttprequest/xmlhttprequest-recursive-sync-event.html
    29612961
     2962# Enable when support drag-and-drop autoscrolling
     2963webkit.org/b/39725 fast/events/drag-and-drop-autoscroll.html [ Skip ]
     2964
    29622965# CSS3_TEXT is disabled on Windows
    29632966fast/css3-text/css3-text-align-last/getComputedStyle/getComputedStyle-text-align-last-inherited.html
  • trunk/Source/WebCore/ChangeLog

    r140283 r140286  
     12013-01-20  Yoshifumi Inoue  <yosin@chromium.org>
     2
     3        Dragging over an element with scrollbars should scroll the element when dragging near edges
     4        https://bugs.webkit.org/show_bug.cgi?id=39725
     5
     6        Reviewed by Hajime Morita.
     7
     8        This patch introduces auto scrolling functionality during drag-and-drop
     9        when drop source is near edge of scrollable element.
     10
     11        When drop source is inside 20px of scrollable element more than 200ms,
     12        scrollable element is automatically scrolled every 50ms toward drop
     13        source position, e.g. vertically scroll up when drop source is in top
     14        edge.
     15
     16        Test: fast/events/drag-and-drop-autoscroll.html
     17
     18        * page/AutoscrollController.cpp:
     19        (WebCore::AutoscrollController::AutoscrollController): Changed to initialize m_dragAndDropAutoscrollStartTime.
     20        (WebCore::AutoscrollController::updateDragAndDrop): Added for start/stop autoscroll during drag-and-drop.
     21        (WebCore::AutoscrollController::autoscrollTimerFired): Changed to add autoscroll for drag-and-drop, and to pass last know position to RenderBox::autoscroll().
     22        * page/AutoscrollController.h:
     23        (AutoscrollController): Changed to add updateDragAndDrop() and m_dragAndDropAutoscrollReferencePosition and m_dragAndDropAutoscrollStartTime.
     24        * page/ChromeClient.h:
     25        (WebCore::ChromeClient): Changed to add new function shouldAutoscrollForDragAndDrop().
     26        * page/EventHandler.cpp:
     27        (WebCore::EventHandler::updateDragAndDrop): Changed to call AutoscrollController::updateDragAndDrop().
     28        (WebCore::EventHandler::clearDragState): Changed to call stopAutoscrollTimer().
     29        * rendering/RenderBox.cpp:
     30        (WebCore::RenderBox::autoscroll): Changed for new parameter position.
     31        (WebCore::RenderBox::calculateAutoscrollDirection): Added for autoscroll.
     32        * rendering/RenderBox.h:
     33        (RenderBox):
     34        * rendering/RenderLayer.cpp:
     35        (WebCore::RenderLayer::autoscroll):  Changed for new parameter position and move updateSelectionForMouseDrag() to AutoscrollController.
     36        * rendering/RenderLayer.h:
     37        (RenderLayer):
     38        * rendering/RenderListBox.cpp:
     39        (WebCore::RenderListBox::autoscroll):  Changed for new parameter position.
     40        * rendering/RenderListBox.h:
     41        (RenderListBox):
     42        * rendering/RenderTextControlSingleLine.cpp:
     43        (WebCore::RenderTextControlSingleLine::autoscroll):  Changed for new parameter position.
     44        * rendering/RenderTextControlSingleLine.h:
     45        (RenderTextControlSingleLine):
     46
    1472013-01-20  Laszlo Gombos  <l.gombos@samsung.com>
    248
  • trunk/Source/WebCore/page/AutoscrollController.cpp

    r140104 r140286  
    2929#include "AutoscrollController.h"
    3030
     31#include "Chrome.h"
     32#include "ChromeClient.h"
    3133#include "EventHandler.h"
    3234#include "Frame.h"
     
    3638#include "RenderBox.h"
    3739#include "ScrollView.h"
     40#include <wtf/CurrentTime.h>
    3841
    3942namespace WebCore {
     43
     44// Delay time in second for start autoscroll if pointer is in border edge of scrollable element.
     45static double autoscrollDelay = 0.2;
    4046
    4147// When the autoscroll or the panScroll is triggered when do the scroll every 0.05s to make it smooth
     
    5460    , m_autoscrollRenderer(0)
    5561    , m_autoscrollType(NoAutoscroll)
     62    , m_dragAndDropAutoscrollStartTime(0)
    5663{
    5764}
     
    137144}
    138145
     146void AutoscrollController::updateDragAndDrop(Node* dropTargetNode, const IntPoint& eventPosition, double eventTime)
     147{
     148    if (!dropTargetNode) {
     149        stopAutoscrollTimer();
     150        return;
     151    }
     152
     153    RenderBox* scrollable = RenderBox::findAutoscrollable(dropTargetNode->renderer());
     154    if (!scrollable) {
     155        stopAutoscrollTimer();
     156        return;
     157    }
     158
     159    Frame* frame = scrollable->frame();
     160    if (!frame) {
     161        stopAutoscrollTimer();
     162        return;
     163    }
     164
     165    Page* page = frame->page();
     166    if (!page || !page->chrome()->client()->shouldAutoscrollForDragAndDrop(scrollable)) {
     167        stopAutoscrollTimer();
     168        return;
     169    }
     170
     171    IntSize offset = scrollable->calculateAutoscrollDirection(eventPosition);
     172    if (offset.isZero()) {
     173        stopAutoscrollTimer();
     174        return;
     175    }
     176
     177    m_dragAndDropAutoscrollReferencePosition = eventPosition + offset;
     178
     179    if (m_autoscrollType == NoAutoscroll) {
     180        m_autoscrollType = AutoscrollForDragAndDrop;
     181        m_autoscrollRenderer = scrollable;
     182        m_dragAndDropAutoscrollStartTime = eventTime;
     183        startAutoscrollTimer();
     184    } else if (m_autoscrollRenderer != scrollable) {
     185        m_dragAndDropAutoscrollStartTime = eventTime;
     186        m_autoscrollRenderer = scrollable;
     187    }
     188}
     189
    139190#if ENABLE(PAN_SCROLLING)
    140191void AutoscrollController::didPanScrollStart()
     
    197248    Frame* frame = m_autoscrollRenderer->frame();
    198249    switch (m_autoscrollType) {
    199     case AutoscrollForSelection:
    200         if (!frame->eventHandler()->mousePressed()) {
     250    case AutoscrollForDragAndDrop:
     251        if (WTF::currentTime() - m_dragAndDropAutoscrollStartTime > autoscrollDelay)
     252            m_autoscrollRenderer->autoscroll(m_dragAndDropAutoscrollReferencePosition);
     253        break;
     254    case AutoscrollForSelection: {
     255        EventHandler* eventHandler = frame->eventHandler();
     256        if (!eventHandler->mousePressed()) {
    201257            stopAutoscrollTimer();
    202258            return;
    203259        }
    204         m_autoscrollRenderer->autoscroll();
    205         break;
     260        eventHandler->updateSelectionForMouseDrag();
     261        m_autoscrollRenderer->autoscroll(eventHandler->lastKnownMousePosition());
     262        break;
     263    }
    206264    case NoAutoscroll:
    207265        break;
  • trunk/Source/WebCore/page/AutoscrollController.h

    r140104 r140286  
    3535class Frame;
    3636class FrameView;
     37class Node;
    3738class PlatformMouseEvent;
    3839class RenderBox;
     
    4142enum AutoscrollType {
    4243    NoAutoscroll,
     44    AutoscrollForDragAndDrop,
    4345    AutoscrollForSelection,
    4446#if ENABLE(PAN_SCROLLING)
     
    5860    void stopAutoscrollTimer(bool rendererIsBeingDestroyed = false);
    5961    void updateAutoscrollRenderer();
     62    void updateDragAndDrop(Node* targetNode, const IntPoint& eventPosition, double eventTime);
    6063#if ENABLE(PAN_SCROLLING)
    6164    void didPanScrollStart();
     
    7679    RenderBox* m_autoscrollRenderer;
    7780    AutoscrollType m_autoscrollType;
     81    IntPoint m_dragAndDropAutoscrollReferencePosition;
     82    double m_dragAndDropAutoscrollStartTime;
    7883#if ENABLE(PAN_SCROLLING)
    7984    IntPoint m_panScrollStartPos;
  • trunk/Source/WebCore/page/ChromeClient.h

    r139078 r140286  
    376376    virtual PassRefPtr<Image> plugInStartLabelImage(RenderSnapshottedPlugIn::LabelSize) const { return 0; }
    377377
     378    // FIXME: Port should return true using heuristic based on scrollable(RenderBox).
     379    virtual bool shouldAutoscrollForDragAndDrop(RenderBox*) const { return false; }
     380
    378381protected:
    379382    virtual ~ChromeClient() { }
  • trunk/Source/WebCore/page/EventHandler.cpp

    r140177 r140286  
    19661966        newTarget = newTarget->parentNode();
    19671967
     1968    m_autoscrollController->updateDragAndDrop(newTarget.get(), event.position(), event.timestamp());
     1969
    19681970    if (m_dragTarget != newTarget) {
    19691971        // FIXME: this ordering was explicitly chosen to match WinIE. However,
     
    20492051void EventHandler::clearDragState()
    20502052{
     2053    stopAutoscrollTimer();
    20512054    m_dragTarget = 0;
    20522055    m_capturingMouseEventsNode = 0;
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r140225 r140286  
    8686static OverrideSizeMap* gOverrideContainingBlockLogicalWidthMap = 0;
    8787
     88
     89// Size of border belt for autoscroll. When mouse pointer in border belt,
     90// autoscroll is started.
     91static const int autoscrollBeltSize = 20;
     92
    8893bool RenderBox::s_hadOverflowClip = false;
    8994
     
    709714}
    710715
    711 void RenderBox::autoscroll()
     716void RenderBox::autoscroll(const IntPoint& position)
    712717{
    713718    if (layer())
    714         layer()->autoscroll();
     719        layer()->autoscroll(position);
    715720}
    716721
     
    734739    Page* page = frame->page();
    735740    return page && page->mainFrame() == frame;
     741}
     742
     743// If specified point is in border belt, returned offset denotes direction of
     744// scrolling.
     745IntSize RenderBox::calculateAutoscrollDirection(const IntPoint& windowPoint) const
     746{
     747    if (!frame())
     748        return IntSize();
     749
     750    FrameView* frameView = frame()->view();
     751    if (!frameView)
     752        return IntSize();
     753
     754    IntSize offset;
     755    IntPoint point = frameView->windowToContents(windowPoint);
     756    IntRect box(absoluteBoundingBoxRect());
     757
     758    if (point.x() < box.x() + autoscrollBeltSize)
     759        point.move(-autoscrollBeltSize, 0);
     760    else if (point.x() > box.maxX() - autoscrollBeltSize)
     761        point.move(autoscrollBeltSize, 0);
     762
     763    if (point.y() < box.y() + autoscrollBeltSize)
     764        point.move(0, -autoscrollBeltSize);
     765    else if (point.y() > box.maxY() - autoscrollBeltSize)
     766        point.move(0, autoscrollBeltSize);
     767    return frameView->contentsToWindow(point) - windowPoint;
    736768}
    737769
  • trunk/Source/WebCore/rendering/RenderBox.h

    r139920 r140286  
    448448    bool canBeScrolledAndHasScrollableArea() const;
    449449    virtual bool canBeProgramaticallyScrolled() const;
    450     virtual void autoscroll();
     450    virtual void autoscroll(const IntPoint&);
    451451    bool canAutoscroll() const;
     452    IntSize calculateAutoscrollDirection(const IntPoint& windowPoint) const;
    452453    static RenderBox* findAutoscrollable(RenderObject*);
    453454    virtual void stopAutoscroll() { }
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r140244 r140286  
    23022302}
    23032303
    2304 void RenderLayer::autoscroll()
     2304void RenderLayer::autoscroll(const IntPoint& position)
    23052305{
    23062306    Frame* frame = renderer()->frame();
     
    23122312        return;
    23132313
    2314 #if ENABLE(DRAG_SUPPORT)
    2315     frame->eventHandler()->updateSelectionForMouseDrag();
    2316 #endif
    2317 
    2318     IntPoint currentDocumentPosition = frameView->windowToContents(frame->eventHandler()->lastKnownMousePosition());
     2314    IntPoint currentDocumentPosition = frameView->windowToContents(position);
    23192315    scrollRectToVisible(LayoutRect(currentDocumentPosition, LayoutSize(1, 1)), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
    23202316}
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r140177 r140286  
    374374
    375375    bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1);
    376     void autoscroll();
     376    void autoscroll(const IntPoint&);
    377377
    378378    void resize(const PlatformMouseEvent&, const LayoutSize&);
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r139536 r140286  
    558558}
    559559
    560 void RenderListBox::autoscroll()
     560void RenderListBox::autoscroll(const IntPoint&)
    561561{
    562562    IntPoint pos = frame()->view()->windowToContents(frame()->eventHandler()->lastKnownMousePosition());
  • trunk/Source/WebCore/rendering/RenderListBox.h

    r139536 r140286  
    8686
    8787    virtual bool canBeProgramaticallyScrolled() const { return true; }
    88     virtual void autoscroll();
     88    virtual void autoscroll(const IntPoint&);
    8989    virtual void stopAutoscroll();
    9090
  • trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp

    r140244 r140286  
    382382}
    383383
    384 void RenderTextControlSingleLine::autoscroll()
     384void RenderTextControlSingleLine::autoscroll(const IntPoint& position)
    385385{
    386386    RenderLayer* layer = innerTextElement()->renderBox()->layer();
    387387    if (layer)
    388         layer->autoscroll();
     388        layer->autoscroll(position);
    389389}
    390390
  • trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h

    r140244 r140286  
    5959    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
    6060
    61     virtual void autoscroll();
     61    virtual void autoscroll(const IntPoint&);
    6262
    6363    // Subclassed to forward to our inner div.
  • trunk/Source/WebKit/chromium/ChangeLog

    r140219 r140286  
     12013-01-20  Yoshifumi Inoue  <yosin@chromium.org>
     2
     3        Dragging over an element with scrollbars should scroll the element when dragging near edges
     4        https://bugs.webkit.org/show_bug.cgi?id=39725
     5
     6        Reviewed by Hajime Morita.
     7
     8        This patch removes DragScrollTimer used for automatic scrolling of main
     9        frame drag-and-drop which is now implemented in EventHandler.
     10
     11        Another patch will remove DragScrollTimer.{cpp,h} and update GYP files to
     12        make patch size small.
     13
     14        No tests. Existing test covers this change.
     15
     16        * src/ChromeClientImpl.cpp:
     17        (WebKit::ChromeClientImpl::shouldAutoscrollForDragAndDrop): Added.
     18        * src/ChromeClientImpl.h:
     19        (ChromeClientImpl): Changed to add shouldAutoscrollForDragAndDrop().
     20        * src/WebViewImpl.cpp:
     21        (WebKit::WebViewImpl::WebViewImpl): Changed to remove m_dragScrollTimer.
     22        (WebKit::WebViewImpl::dragSourceEndedAt): ditto
     23        (WebKit::WebViewImpl::dragSourceMovedTo): ditto
     24        (WebKit::WebViewImpl::dragTargetDrop): ditto
     25        (WebKit::WebViewImpl::dragTargetDragEnterOrOver): ditto
     26        * src/WebViewImpl.h:
     27        (WebKit): Chagned to remove DragScrollTimer.
     28
    1292013-01-18  Alec Flett  <alecflett@chromium.org>
    230
  • trunk/Source/WebKit/chromium/src/ChromeClientImpl.cpp

    r140025 r140286  
    11321132}
    11331133
     1134bool ChromeClientImpl::shouldAutoscrollForDragAndDrop(WebCore::RenderBox*) const
     1135{
     1136    return true;
     1137}
     1138
     1139
    11341140#if ENABLE(TOUCH_EVENTS)
    11351141void ChromeClientImpl::needTouchEvents(bool needsTouchEvents)
  • trunk/Source/WebKit/chromium/src/ChromeClientImpl.h

    r139829 r140286  
    226226    virtual void numWheelEventHandlersChanged(unsigned);
    227227
     228    virtual bool shouldAutoscrollForDragAndDrop(WebCore::RenderBox* scrollable) const OVERRIDE;
     229
    228230#if ENABLE(POINTER_LOCK)
    229231    virtual bool requestPointerLock();
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r140183 r140286  
    5454#include "DragController.h"
    5555#include "DragData.h"
    56 #include "DragScrollTimer.h"
    5756#include "DragSession.h"
    5857#include "Editor.h"
     
    416415    , m_isTransparent(false)
    417416    , m_tabsToLinks(false)
    418     , m_dragScrollTimer(adoptPtr(new DragScrollTimer))
    419417    , m_isCancelingFullScreen(false)
    420418    , m_benchmarkSupport(this)
     
    32913289    m_page->mainFrame()->eventHandler()->dragSourceEndedAt(pme,
    32923290        static_cast<DragOperation>(operation));
    3293     m_dragScrollTimer->stop();
    32943291}
    32953292
     
    32993296    WebDragOperation operation)
    33003297{
    3301     m_dragScrollTimer->triggerScroll(mainFrameImpl()->frameView(), clientPoint);
    33023298}
    33033299
     
    33853381    m_dragOperation = WebDragOperationNone;
    33863382    m_currentDragData = 0;
    3387 
    3388     m_dragScrollTimer->stop();
    33893383}
    33903384
     
    34133407
    34143408     m_dragOperation = static_cast<WebDragOperation>(dropEffect);
    3415 
    3416     if (dragAction == DragOver)
    3417         m_dragScrollTimer->triggerScroll(mainFrameImpl()->frameView(), clientPoint);
    3418     else
    3419         m_dragScrollTimer->stop();
    34203409
    34213410    return m_dragOperation;
  • trunk/Source/WebKit/chromium/src/WebViewImpl.h

    r140183 r140286  
    9393class ContextMenuClientImpl;
    9494class DeviceOrientationClientProxy;
    95 class DragScrollTimer;
    9695class GeolocationClientProxy;
    9796class LinkHighlight;
     
    822821    typedef HashMap<WTF::String, WTF::String> SettingsMap;
    823822    OwnPtr<SettingsMap> m_inspectorSettingsMap;
    824     OwnPtr<DragScrollTimer> m_dragScrollTimer;
    825823
    826824#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
  • trunk/Tools/ChangeLog

    r140281 r140286  
     12013-01-20  Yoshifumi Inoue  <yosin@chromium.org>
     2
     3        Dragging over an element with scrollbars should scroll the element when dragging near edges
     4        https://bugs.webkit.org/show_bug.cgi?id=39725
     5
     6        Reviewed by Hajime Morita.
     7
     8        This patch introduces canceling drag-and-drop by escape key for testing
     9        behavior after cancellation drag-and-drop.
     10
     11        * DumpRenderTree/chromium/TestRunner/src/EventSender.cpp:
     12        (WebTestRunner):
     13        (WebTestRunner::EventSender::doMouseUp):
     14        (WebTestRunner::EventSender::finishDragAndDrop):
     15        (WebTestRunner::EventSender::keyDown):
     16        * DumpRenderTree/chromium/TestRunner/src/EventSender.h:
     17        (EventSender):
     18        * DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.h: Added VKEY_ESCAPE.
     19
    1202013-01-20  Jochen Eisinger  <jochen@chromium.org>
    221
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp

    r135789 r140286  
    469469    if (currentDragData.isNull())
    470470        return;
     471
    471472    WebPoint clientPoint(e.x, e.y);
    472473    WebPoint screenPoint(e.globalX, e.globalY);
    473 
    474     currentDragEffect = webview()->dragTargetDragOver(clientPoint, screenPoint, currentDragEffectsAllowed, 0);
     474    finishDragAndDrop(e, webview()->dragTargetDragOver(clientPoint, screenPoint, currentDragEffectsAllowed, 0));
     475}
     476
     477void EventSender::finishDragAndDrop(const WebMouseEvent& e, WebKit::WebDragOperation dragEffect)
     478{
     479    WebPoint clientPoint(e.x, e.y);
     480    WebPoint screenPoint(e.globalX, e.globalY);
     481    currentDragEffect = dragEffect;
    475482    if (currentDragEffect)
    476483        webview()->dragTargetDrop(clientPoint, screenPoint, 0);
     
    649656    webview()->handleInputEvent(eventDown);
    650657
     658    if (code == VKEY_ESCAPE && !currentDragData.isNull()) {
     659        WebMouseEvent event;
     660        initMouseEvent(WebInputEvent::MouseDown, pressedButton, lastMousePos, &event, getCurrentEventTimeSec(m_delegate));
     661        finishDragAndDrop(event, WebKit::WebDragOperationNone);
     662    }
     663
    651664    m_delegate->clearEditCommand();
    652665
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h

    r135789 r140286  
    159159    bool needsShiftModifier(int);
    160160
     161    void finishDragAndDrop(const WebKit::WebMouseEvent&, WebKit::WebDragOperation);
    161162    void updateClickCountForButton(WebKit::WebMouseEvent::Button);
    162163
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.h

    r132781 r140286  
    3737enum {
    3838    VKEY_RETURN   = 0x0D,
     39    VKEY_ESCAPE   = 0x1B,
    3940    VKEY_PRIOR    = 0x21,
    4041    VKEY_NEXT     = 0x22,
Note: See TracChangeset for help on using the changeset viewer.