Data interaction on an image enclosed by an anchor should vend the anchor's URL
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Apr 2017 17:07:44 +0000 (17:07 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Apr 2017 17:07:44 +0000 (17:07 +0000)
commitf77ff5effc71b37974d64b0e4a034ce5544a681a
tree41717de82fb9e9ec6d286c03388e6b0c6de2d08e
parent79f683781cda57662bfbeddd8f11dcc9ac43a414
Data interaction on an image enclosed by an anchor should vend the anchor's URL
https://bugs.webkit.org/show_bug.cgi?id=170660
<rdar://problem/31043220>

Reviewed by Tim Horton.

Source/WebCore:

When writing an image embedded inside an anchor to the pasteboard, actually use the enclosing anchor's href if
it exists. Previously, we were simply dropping this argument on the floor.

Covered by 2 new DataInteractionTests: ImageInLinkToInput and ImageInLinkWithoutHREFToInput.

* editing/ios/EditorIOS.mm:
(WebCore::Editor::writeImageToPasteboard):

Tools:

Adds two new unit tests covering cases where data interaction is triggered from an image nested underneath an
anchor. In one of the tests, the link has an href, and in the other, its href is missing, in which case we
should fall back to the image URL instead. Also fixes a related unit test that was trying to check selection
rects, but should not be.

See WebCore ChangeLog for more details.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/image-in-link-and-input.html: Added.
* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215184 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/editing/ios/EditorIOS.mm
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/image-in-link-and-input.html [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm