Inline anchor elements cannot be dragged when starting the drag from a block descendant
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Apr 2017 22:06:24 +0000 (22:06 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Apr 2017 22:06:24 +0000 (22:06 +0000)
commita66959119df954cca3dedba934ae08840f06910f
tree0c832d7d92dbaa02cf1e4bf87a0474a9d2323dbb
parent1199f70cd14a78a8770272c9ebc714327e6f7e1f
Inline anchor elements cannot be dragged when starting the drag from a block descendant
https://bugs.webkit.org/show_bug.cgi?id=171062
<rdar://problem/31697835>

Reviewed by Tim Horton.

Source/WebCore:

Tweaks DragController::draggableElement to traverse the DOM instead of the render tree when finding a draggable
element. This prevents us from skipping elements that are in the DOM ancestor chain, but appear as siblings to
the hit-tested node's renderer in the render tree.

There was also previously a check to ensure that we skip anonymous RenderObjects while traversing up the chain,
but this is no longer necessary fter this change, since all the elements we traverse in the DOM should have
renderers that are not anonymous.

Test: fast/events/drag-and-drop-link-containing-block.html

* page/DragController.cpp:
(WebCore::DragController::draggableElement):

LayoutTests:

Adds a new test on WK1 Mac to verify that link dragging succeeds when the link's anchor element is inline and
the drag is started from a block element under the link.

* fast/events/drag-and-drop-link-containing-block-expected.txt: Added.
* fast/events/drag-and-drop-link-containing-block.html: Added.
* platform/ios/TestExpectations:
* platform/mac-wk2/TestExpectations:

Skip the test on iOS and Mac WK2.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@215581 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/events/drag-and-drop-link-containing-block-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/drag-and-drop-link-containing-block.html [new file with mode: 0644]
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/page/DragController.cpp