Changeset 207648 in webkit
- Timestamp:
- Oct 20, 2016 6:15:54 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r207647 r207648 1 2016-10-20 Chris Dumez <cdumez@apple.com> 2 3 "Download Linked File" context menu action should use 'download' attribute as suggested filename 4 https://bugs.webkit.org/show_bug.cgi?id=163742 5 <rdar://problem/28840734> 6 7 Reviewed by Darin Adler. 8 9 Add convenience method to HitTestResult to return the URL element's 10 download attribute. 11 12 * rendering/HitTestResult.cpp: 13 (WebCore::HitTestResult::URLElementDownloadAttribute): 14 * rendering/HitTestResult.h: 15 1 16 2016-10-20 Nan Wang <n_wang@apple.com> 2 17 -
trunk/Source/WebCore/rendering/HitTestResult.cpp
r204543 r207648 787 787 } 788 788 789 const AtomicString& HitTestResult::URLElementDownloadAttribute() const 790 { 791 auto* urlElement = URLElement(); 792 if (!is<HTMLAnchorElement>(urlElement)) 793 return nullAtom; 794 return urlElement->attributeWithoutSynchronization(HTMLNames::downloadAttr); 795 } 796 789 797 bool HitTestResult::mediaSupportsEnhancedFullscreen() const 790 798 { -
trunk/Source/WebCore/rendering/HitTestResult.h
r204717 r207648 66 66 Scrollbar* scrollbar() const { return m_scrollbar.get(); } 67 67 bool isOverWidget() const { return m_isOverWidget; } 68 69 WEBCORE_EXPORT const AtomicString& URLElementDownloadAttribute() const; 68 70 69 71 // Forwarded from HitTestLocation -
trunk/Source/WebKit2/ChangeLog
r207642 r207648 1 2016-10-20 Chris Dumez <cdumez@apple.com> 2 3 "Download Linked File" context menu action should use 'download' attribute as suggested filename 4 https://bugs.webkit.org/show_bug.cgi?id=163742 5 <rdar://problem/28840734> 6 7 Reviewed by Darin Adler. 8 9 Update "Download Linked File" context menu action to use the anchor 10 element's 'download' attribute as suggested filename for the download. 11 12 * NetworkProcess/NetworkProcess.cpp: 13 (WebKit::NetworkProcess::downloadRequest): 14 * NetworkProcess/NetworkProcess.h: 15 * NetworkProcess/NetworkProcess.messages.in: 16 * Shared/WebHitTestResultData.cpp: 17 (WebKit::WebHitTestResultData::WebHitTestResultData): 18 (WebKit::WebHitTestResultData::encode): 19 (WebKit::WebHitTestResultData::decode): 20 * Shared/WebHitTestResultData.h: 21 * UIProcess/WebPageProxy.cpp: 22 (WebKit::WebPageProxy::contextMenuItemSelected): 23 * UIProcess/WebProcessPool.cpp: 24 (WebKit::WebProcessPool::download): 25 * UIProcess/WebProcessPool.h: 26 * WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp: 27 (WebKit::InjectedBundleHitTestResult::linkSuggestedFilename): 28 1 29 2016-10-19 Myles C. Maxfield <mmaxfield@apple.com> 2 30 -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp
r207586 r207648 460 460 } 461 461 462 void NetworkProcess::downloadRequest(SessionID sessionID, DownloadID downloadID, const ResourceRequest& request )463 { 464 downloadManager().startDownload(sessionID, downloadID, request );462 void NetworkProcess::downloadRequest(SessionID sessionID, DownloadID downloadID, const ResourceRequest& request, const String& suggestedFilename) 463 { 464 downloadManager().startDownload(sessionID, downloadID, request, suggestedFilename); 465 465 } 466 466 -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h
r207530 r207648 171 171 void clearDiskCache(std::chrono::system_clock::time_point modifiedSince, std::function<void ()> completionHandler); 172 172 173 void downloadRequest(WebCore::SessionID, DownloadID, const WebCore::ResourceRequest& );173 void downloadRequest(WebCore::SessionID, DownloadID, const WebCore::ResourceRequest&, const String& suggestedFilename); 174 174 void resumeDownload(WebCore::SessionID, DownloadID, const IPC::DataReference& resumeData, const String& path, const SandboxExtension::Handle&); 175 175 void cancelDownload(DownloadID); -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in
r206583 r207648 42 42 DeleteWebsiteDataForOrigins(WebCore::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> websiteDataTypes, Vector<WebCore::SecurityOriginData> origins, Vector<String> cookieHostNames, uint64_t callbackID) 43 43 44 DownloadRequest(WebCore::SessionID sessionID, WebKit::DownloadID downloadID, WebCore::ResourceRequest request )44 DownloadRequest(WebCore::SessionID sessionID, WebKit::DownloadID downloadID, WebCore::ResourceRequest request, String suggestedFilename) 45 45 ResumeDownload(WebCore::SessionID sessionID, WebKit::DownloadID downloadID, IPC::DataReference resumeData, String path, WebKit::SandboxExtension::Handle sandboxExtensionHandle) 46 46 CancelDownload(WebKit::DownloadID downloadID) -
trunk/Source/WebKit2/Shared/WebHitTestResultData.cpp
r204668 r207648 47 47 , linkLabel(hitTestResult.textContent()) 48 48 , linkTitle(hitTestResult.titleDisplayString()) 49 , linkSuggestedFilename(hitTestResult.URLElementDownloadAttribute()) 49 50 , isContentEditable(hitTestResult.isContentEditable()) 50 51 , elementBoundingBox(elementBoundingBoxInWindowCoordinates(hitTestResult)) … … 66 67 , linkLabel(hitTestResult.textContent()) 67 68 , linkTitle(hitTestResult.titleDisplayString()) 69 , linkSuggestedFilename(hitTestResult.URLElementDownloadAttribute()) 68 70 , isContentEditable(hitTestResult.isContentEditable()) 69 71 , elementBoundingBox(elementBoundingBoxInWindowCoordinates(hitTestResult)) … … 101 103 encoder << linkLabel; 102 104 encoder << linkTitle; 105 encoder << linkSuggestedFilename; 103 106 encoder << isContentEditable; 104 107 encoder << elementBoundingBox; … … 134 137 || !decoder.decode(hitTestResultData.linkLabel) 135 138 || !decoder.decode(hitTestResultData.linkTitle) 139 || !decoder.decode(hitTestResultData.linkSuggestedFilename) 136 140 || !decoder.decode(hitTestResultData.isContentEditable) 137 141 || !decoder.decode(hitTestResultData.elementBoundingBox) -
trunk/Source/WebKit2/Shared/WebHitTestResultData.h
r204668 r207648 51 51 String linkLabel; 52 52 String linkTitle; 53 String linkSuggestedFilename; 53 54 bool isContentEditable; 54 55 WebCore::IntRect elementBoundingBox; -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r207463 r207648 4588 4588 } 4589 4589 if (item.action() == ContextMenuItemTagDownloadLinkToDisk) { 4590 m_process->processPool().download(this, URL(URL(), m_activeContextMenuContextData.webHitTestResultData().absoluteLinkURL)); 4590 auto& hitTestResult = m_activeContextMenuContextData.webHitTestResultData(); 4591 m_process->processPool().download(this, URL(URL(), hitTestResult.absoluteLinkURL), hitTestResult.linkSuggestedFilename); 4591 4592 return; 4592 4593 } -
trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp
r207346 r207648 815 815 } 816 816 817 DownloadProxy* WebProcessPool::download(WebPageProxy* initiatingPage, const ResourceRequest& request )817 DownloadProxy* WebProcessPool::download(WebPageProxy* initiatingPage, const ResourceRequest& request, const String& suggestedFilename) 818 818 { 819 819 DownloadProxy* downloadProxy = createDownloadProxy(request); … … 828 828 else 829 829 updatedRequest.setFirstPartyForCookies(URL()); 830 networkProcess()->send(Messages::NetworkProcess::DownloadRequest(sessionID, downloadProxy->downloadID(), updatedRequest ), 0);830 networkProcess()->send(Messages::NetworkProcess::DownloadRequest(sessionID, downloadProxy->downloadID(), updatedRequest, suggestedFilename), 0); 831 831 return downloadProxy; 832 832 } -
trunk/Source/WebKit2/UIProcess/WebProcessPool.h
r207346 r207648 167 167 const String& injectedBundlePath() const { return m_configuration->injectedBundlePath(); } 168 168 169 DownloadProxy* download(WebPageProxy* initiatingPage, const WebCore::ResourceRequest& );169 DownloadProxy* download(WebPageProxy* initiatingPage, const WebCore::ResourceRequest&, const String& suggestedFilename = { }); 170 170 DownloadProxy* resumeDownload(const API::Data* resumeData, const String& path); 171 171 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleHitTestResult.cpp
r207579 r207648 35 35 #include <WebCore/FrameLoader.h> 36 36 #include <WebCore/FrameView.h> 37 #include <WebCore/HTMLAnchorElement.h>38 #include <WebCore/HTMLNames.h>39 37 #include <WebCore/URL.h> 40 38 #include <wtf/text/WTFString.h> … … 144 142 String InjectedBundleHitTestResult::linkSuggestedFilename() const 145 143 { 146 auto* urlElement = m_hitTestResult.URLElement(); 147 if (!is<HTMLAnchorElement>(urlElement)) 148 return String(); 149 return urlElement->attributeWithoutSynchronization(HTMLNames::downloadAttr); 144 return m_hitTestResult.URLElementDownloadAttribute(); 150 145 } 151 146 -
trunk/Tools/ChangeLog
r207643 r207648 1 2016-10-20 Chris Dumez <cdumez@apple.com> 2 3 "Download Linked File" context menu action should use 'download' attribute as suggested filename 4 https://bugs.webkit.org/show_bug.cgi?id=163742 5 <rdar://problem/28840734> 6 7 Reviewed by Darin Adler. 8 9 Add API test coverage. 10 11 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 12 * TestWebKitAPI/Tests/WebKit2/link-with-download-attribute.html: Added. 13 * TestWebKitAPI/Tests/WebKit2/mac/ContextMenuDownload.mm: Added. 14 (TestWebKitAPI::didFinishLoadForFrame): 15 (TestWebKitAPI::getContextMenuFromProposedMenu): 16 (TestWebKitAPI::decideDestinationWithSuggestedFilename): 17 (TestWebKitAPI::TEST): 18 1 19 2016-10-20 Commit Queue <commit-queue@webkit.org> 2 20 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r207563 r207648 404 404 7CEFA9661AC0B9E200B910FD /* _WKUserContentExtensionStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CEFA9641AC0B9E200B910FD /* _WKUserContentExtensionStore.mm */; }; 405 405 7CFBCAE51743238F00B2BFCF /* WillLoad_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CFBCAE31743238E00B2BFCF /* WillLoad_Bundle.cpp */; }; 406 8349D3C21DB96DDE004A9F65 /* ContextMenuDownload.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8349D3C11DB96DDA004A9F65 /* ContextMenuDownload.mm */; }; 407 8349D3C41DB9728E004A9F65 /* link-with-download-attribute.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 8349D3C31DB9724F004A9F65 /* link-with-download-attribute.html */; }; 406 408 835CF9671D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 835CF9661D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp */; }; 407 409 837A35F11D9A1E7D00663C57 /* DownloadRequestBlobURL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 837A35F01D9A1E6400663C57 /* DownloadRequestBlobURL.html */; }; … … 563 565 dstSubfolderSpec = 7; 564 566 files = ( 567 8349D3C41DB9728E004A9F65 /* link-with-download-attribute.html in Copy Resources */, 565 568 AD57AC221DA7466E00FF1BDE /* many-iframes.html in Copy Resources */, 566 569 F415086D1DA040C50044BE9B /* play-audio-on-click.html in Copy Resources */, … … 1006 1009 7CFBCAE31743238E00B2BFCF /* WillLoad_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillLoad_Bundle.cpp; sourceTree = "<group>"; }; 1007 1010 81B50192140F232300D9EB58 /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringBuilder.cpp; sourceTree = "<group>"; }; 1011 8349D3C11DB96DDA004A9F65 /* ContextMenuDownload.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextMenuDownload.mm; sourceTree = "<group>"; }; 1012 8349D3C31DB9724F004A9F65 /* link-with-download-attribute.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "link-with-download-attribute.html"; sourceTree = "<group>"; }; 1008 1013 835CF9661D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RestoreSessionStateWithoutNavigation.cpp; sourceTree = "<group>"; }; 1009 1014 837A35F01D9A1E6400663C57 /* DownloadRequestBlobURL.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = DownloadRequestBlobURL.html; sourceTree = "<group>"; }; … … 1843 1848 BCBD372E125ABBE600D2C29F /* icon.png */, 1844 1849 CE3524F51B142BBB0028A7C5 /* input-focus-blur.html */, 1850 8349D3C31DB9724F004A9F65 /* link-with-download-attribute.html */, 1845 1851 378E647816326FDF00B6C676 /* link-with-title.html */, 1846 1852 9361002814DC957B0061379D /* lots-of-iframes.html */, … … 2032 2038 isa = PBXGroup; 2033 2039 children = ( 2040 8349D3C11DB96DDA004A9F65 /* ContextMenuDownload.mm */, 2034 2041 BCAA485714A044D40088FAC4 /* EditorCommands.mm */, 2035 2042 C0C5D3BC14598B6F00A802A6 /* GetBackingScaleFactor.mm */, … … 2416 2423 7C83E0BF1D0A652200FEBCF3 /* IndexedDBPersistence.mm in Sources */, 2417 2424 7CCE7EFB1A411AE600447C4C /* InjectedBundleBasic.cpp in Sources */, 2425 8349D3C21DB96DDE004A9F65 /* ContextMenuDownload.mm in Sources */, 2418 2426 7CCE7EFC1A411AE600447C4C /* InjectedBundleFrameHitTest.cpp in Sources */, 2419 2427 7CCE7EFD1A411AE600447C4C /* InjectedBundleInitializationUserDataCallbackWins.cpp in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.