"Download Linked File" context menu action should use 'download' attribute as suggest...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Oct 2016 01:15:54 +0000 (01:15 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Oct 2016 01:15:54 +0000 (01:15 +0000)
commitb7dabd2259d1f5373a59211e418f2e4142a02d9c
tree02993f567f312b25d0fd536488e5207798d9b5ff
parentf4117b66e2fedf7350f252e85f414e80a98a92c8
"Download Linked File" context menu action should use 'download' attribute as suggested filename
https://bugs.webkit.org/show_bug.cgi?id=163742
<rdar://problem/28840734>

Reviewed by Darin Adler.

Source/WebCore:

Add convenience method to HitTestResult to return the URL element's
download attribute.

* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::URLElementDownloadAttribute):
* rendering/HitTestResult.h:

Source/WebKit2:

Update "Download Linked File" context menu action to use the anchor
element's 'download' attribute as suggested filename for the download.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::downloadRequest):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* Shared/WebHitTestResultData.cpp:
(WebKit::WebHitTestResultData::WebHitTestResultData):
(WebKit::WebHitTestResultData::encode):
(WebKit::WebHitTestResultData::decode):
* Shared/WebHitTestResultData.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::contextMenuItemSelected):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::download):
* UIProcess/WebProcessPool.h:
* WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp:
(WebKit::InjectedBundleHitTestResult::linkSuggestedFilename):

Tools:

Add API test coverage.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/link-with-download-attribute.html: Added.
* TestWebKitAPI/Tests/WebKit2/mac/ContextMenuDownload.mm: Added.
(TestWebKitAPI::didFinishLoadForFrame):
(TestWebKitAPI::getContextMenuFromProposedMenu):
(TestWebKitAPI::decideDestinationWithSuggestedFilename):
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207648 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/rendering/HitTestResult.cpp
Source/WebCore/rendering/HitTestResult.h
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/NetworkProcess.cpp
Source/WebKit2/NetworkProcess/NetworkProcess.h
Source/WebKit2/NetworkProcess/NetworkProcess.messages.in
Source/WebKit2/Shared/WebHitTestResultData.cpp
Source/WebKit2/Shared/WebHitTestResultData.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebProcessPool.cpp
Source/WebKit2/UIProcess/WebProcessPool.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2/link-with-download-attribute.html [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2/mac/ContextMenuDownload.mm [new file with mode: 0644]