Changeset 198163 in webkit


Ignore:
Timestamp:
Mar 14, 2016 3:08:32 PM (8 years ago)
Author:
tonikitoo@webkit.org
Message:

Selecting with shift+drag results in unexpected drag-n-drop
https://bugs.webkit.org/show_bug.cgi?id=155314

Reviewed by Darin Adler.

Source/WebCore:

Test: editing/selection/shift-drag-selection-no-drag-n-drop.html

Whenever user tries to extend an existing text selection by dragging the mouse
(left button hold) with shift key pressed, WebKit enters drag-n-drop mode.
This behavior does not match common editing behavior out there, including other
browsers' (Firefox, Opera/Presto and IE).

Patch changes WebKit so that whenever one extends a selection with mouse
and shift key pressed off of a #text node, it does not enter drag-n-drop mode.

Additionally, patch also adds some further tests to ensure that when
selection is extended off of either a link or an image, drag-n-drop does
get triggered, no matter if shift key is pressed.

  • page/EventHandler.cpp:

(WebCore::EventHandler::handleMousePressEvent):

LayoutTests:

Tests that ensure that WebKit:

1) does not enter drag-n-drop mode and extending selection by dragging with mouse with shift key is pressed,

off of a #text node.

2) does enter drag-n-drop mode and extending selection by dragging with mouse with shift key is pressed,

off of a link.

3) does enter drag-n-drop mode and extending selection by dragging with mouse with shift key is pressed,

off of an image.

Note that (1) is a behavior changed by this patch, whereas (2) and (3) represent existing
behavior that is kept.
Tests are also skip for iOS similarly to other drag-n-drop related tests.

  • fast/events/shift-drag-selection-no-drag-n-drop-expected.txt: Added.
  • fast/events/shift-drag-selection-no-drag-n-drop.html: Added.
  • fast/events/shift-drag-selection-on-link-triggers-drag-n-drop-expected.txt: Added.
  • fast/events/shift-drag-selection-on-link-triggers-drag-n-drop.html: Added.
  • fast/events/shift-drag-selection-on-image-triggers-drag-n-drop-expected.txt: Added.
  • fast/events/shift-drag-selection-on-image-triggers-drag-n-drop.html: Added.
Location:
trunk
Files:
6 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r198162 r198163  
     12016-03-10  Antonio Gomes  <tonikitoo@webkit.org>
     2
     3        Selecting with shift+drag results in unexpected drag-n-drop
     4        https://bugs.webkit.org/show_bug.cgi?id=155314
     5
     6        Reviewed by Darin Adler.
     7
     8        Tests that ensure that WebKit:
     9
     10        1) does not enter drag-n-drop mode and extending selection by dragging with mouse with shift key is pressed,
     11           off of a #text node.
     12        2) does enter drag-n-drop mode and extending selection by dragging with mouse with shift key is pressed,
     13           off of a link.
     14        3) does enter drag-n-drop mode and extending selection by dragging with mouse with shift key is pressed,
     15           off of an image.
     16
     17        Note that (1) is a behavior changed by this patch, whereas (2) and (3) represent existing
     18        behavior that is kept.
     19        Tests are also skip for iOS similarly to other drag-n-drop related tests.
     20
     21        * fast/events/shift-drag-selection-no-drag-n-drop-expected.txt: Added.
     22        * fast/events/shift-drag-selection-no-drag-n-drop.html: Added.
     23        * fast/events/shift-drag-selection-on-link-triggers-drag-n-drop-expected.txt: Added.
     24        * fast/events/shift-drag-selection-on-link-triggers-drag-n-drop.html: Added.
     25        * fast/events/shift-drag-selection-on-image-triggers-drag-n-drop-expected.txt: Added.
     26        * fast/events/shift-drag-selection-on-image-triggers-drag-n-drop.html: Added.
     27
    1282016-03-14  Ryan Haddad  <ryanhaddad@apple.com>
    229
  • trunk/LayoutTests/platform/ios-simulator/TestExpectations

    r198069 r198163  
    16551655fast/events/selectstart-by-drag.html [ Failure ]
    16561656fast/events/selectstart-by-single-click-with-shift.html [ Failure ]
     1657fast/events/shift-drag-selection-no-drag-n-drop.html [ Failure ]
     1658fast/events/shift-drag-selection-on-link-triggers-drag-n-drop.html [ Failure ]
     1659fast/events/shift-drag-selection-on-image-triggers-drag-n-drop.html [ Failure ]
    16571660fast/events/selectstart-prevent-selection-on-right-click.html [ Failure ]
    16581661fast/events/shadow-event-path.html [ Failure ]
  • trunk/Source/WebCore/ChangeLog

    r198160 r198163  
     12016-03-10  Antonio Gomes  <tonikitoo@webkit.org>
     2
     3        Selecting with shift+drag results in unexpected drag-n-drop
     4        https://bugs.webkit.org/show_bug.cgi?id=155314
     5
     6        Reviewed by Darin Adler.
     7
     8        Test: editing/selection/shift-drag-selection-no-drag-n-drop.html
     9
     10        Whenever user tries to extend an existing text selection by dragging the mouse
     11        (left button hold) with shift key pressed, WebKit enters drag-n-drop mode.
     12        This behavior does not match common editing behavior out there, including other
     13        browsers' (Firefox, Opera/Presto and IE).
     14
     15        Patch changes WebKit so that whenever one extends a selection with mouse
     16        and shift key pressed off of a #text node, it does not enter drag-n-drop mode.
     17
     18        Additionally, patch also adds some further tests to ensure that when
     19        selection is extended off of either a link or an image, drag-n-drop does
     20        get triggered, no matter if shift key is pressed.
     21
     22        * page/EventHandler.cpp:
     23        (WebCore::EventHandler::handleMousePressEvent):
     24
    1252016-03-14  Brent Fulgham  <bfulgham@apple.com>
    226
  • trunk/Source/WebCore/page/EventHandler.cpp

    r198152 r198163  
    761761#if ENABLE(DRAG_SUPPORT)
    762762    // Careful that the drag starting logic stays in sync with eventMayStartDrag()
    763     m_mouseDownMayStartDrag = singleClick;
     763    // FIXME: eventMayStartDrag() does not check for shift key press, link or image event targets.
     764    // Bug: https://bugs.webkit.org/show_bug.cgi?id=155390
     765
     766    // Single mouse down on links or images can always trigger drag-n-drop.
     767    bool isMouseDownOnLinkOrImage = event.isOverLink() || event.hitTestResult().image();
     768    m_mouseDownMayStartDrag = singleClick && (!event.event().shiftKey() || isMouseDownOnLinkOrImage);
    764769#endif
    765770
Note: See TracChangeset for help on using the changeset viewer.