Changeset 276219 in webkit
- Timestamp:
- Apr 17, 2021, 8:49:07 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/editing/Editor.cpp (modified) (1 diff)
-
Source/WebCore/platform/PromisedAttachmentInfo.h (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Shared/WebCoreArgumentCoders.cpp (modified) (2 diffs)
-
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (modified) (5 diffs)
-
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r276216 r276219 1 2021-04-17 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Remove PromisedAttachmentInfo::blobURL and adjacent code 4 https://bugs.webkit.org/show_bug.cgi?id=224720 5 6 Reviewed by Ryosuke Niwa. 7 8 Remove this member of `PromisedAttachmentInfo`. See WebKit ChangeLog for more details. 9 10 * editing/Editor.cpp: 11 (WebCore::Editor::promisedAttachmentInfo): 12 * platform/PromisedAttachmentInfo.h: 13 (WebCore::PromisedAttachmentInfo::operator bool const): 14 1 15 2021-04-17 Tim Nguyen <ntim@apple.com> 2 16 -
trunk/Source/WebCore/editing/Editor.cpp
r276191 r276219 4121 4121 #endif 4122 4122 4123 if (auto file = makeRefPtr(attachment->file())) 4124 return { file->url(), platformContentTypeForBlobType(file->type()), file->name(), { }, WTFMove(additionalTypes), WTFMove(additionalData) }; 4125 4126 return { { }, { }, { }, attachment->uniqueIdentifier(), WTFMove(additionalTypes), WTFMove(additionalData) }; 4123 return { attachment->uniqueIdentifier(), WTFMove(additionalTypes), WTFMove(additionalData) }; 4127 4124 } 4128 4125 -
trunk/Source/WebCore/platform/PromisedAttachmentInfo.h
r238771 r276219 34 34 35 35 struct PromisedAttachmentInfo { 36 URL blobURL;37 String contentType;38 String fileName;39 40 36 #if ENABLE(ATTACHMENT_ELEMENT) 41 37 String attachmentIdentifier; … … 51 47 return true; 52 48 #endif 53 54 return !contentType.isEmpty() && !blobURL.isEmpty(); 49 return false; 55 50 } 56 51 }; -
trunk/Source/WebKit/ChangeLog
r276218 r276219 1 2021-04-17 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Remove PromisedAttachmentInfo::blobURL and adjacent code 4 https://bugs.webkit.org/show_bug.cgi?id=224720 5 6 Reviewed by Ryosuke Niwa. 7 8 The `blobURL` member of `PromisedAttachmentInfo` was originally introduced to facilitate drag and drop support 9 for attachment elements in WebKit2, by writing blob URL data to temporary file paths on behalf of 10 `NSFilePromiseProvider` when starting a drag on attachment elements backed by blobs. However, this was 11 superceded by use of `NSFileWrapper` and the `_WKAttachment` SPI instead, such that we only support dragging 12 attachment elements if they correspond to API `Attachment` objects in the UI process. This means we can remove 13 this `blobURL`, along with the file name and content type members of the struct (which were only added to 14 support the ability to drag blob-backed attachments). 15 16 Code that utilized this member was originally introduced in <https://trac.webkit.org/r235202>, and was 17 subsequently removed in <https://trac.webkit.org/r240687>. 18 19 * Shared/WebCoreArgumentCoders.cpp: 20 (IPC::ArgumentCoder<PromisedAttachmentInfo>::encode): 21 (IPC::ArgumentCoder<PromisedAttachmentInfo>::decode): 22 * UIProcess/Cocoa/WebViewImpl.mm: 23 (-[WKPromisedAttachmentContext initWithIdentifier:fileName:]): 24 (WebKit::WebViewImpl::writeToURLForFilePromiseProvider): 25 (WebKit::WebViewImpl::startDrag): 26 (-[WKPromisedAttachmentContext initWithIdentifier:blobURL:fileName:]): Deleted. 27 (-[WKPromisedAttachmentContext blobURL]): Deleted. 28 * UIProcess/ios/WKContentViewInteraction.mm: 29 (-[WKContentView _prepareToDragPromisedAttachment:]): 30 1 31 2021-04-17 Chris Dumez <cdumez@apple.com> 2 32 -
trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp
r276177 r276219 2883 2883 void ArgumentCoder<PromisedAttachmentInfo>::encode(Encoder& encoder, const PromisedAttachmentInfo& info) 2884 2884 { 2885 encoder << info.blobURL;2886 encoder << info.contentType;2887 encoder << info.fileName;2888 2885 #if ENABLE(ATTACHMENT_ELEMENT) 2889 2886 encoder << info.attachmentIdentifier; … … 2894 2891 bool ArgumentCoder<PromisedAttachmentInfo>::decode(Decoder& decoder, PromisedAttachmentInfo& info) 2895 2892 { 2896 if (!decoder.decode(info.blobURL))2897 return false;2898 2899 if (!decoder.decode(info.contentType))2900 return false;2901 2902 if (!decoder.decode(info.fileName))2903 return false;2904 2905 2893 #if ENABLE(ATTACHMENT_ELEMENT) 2906 2894 if (!decoder.decode(info.attachmentIdentifier)) -
trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
r275913 r276219 886 886 @interface WKPromisedAttachmentContext : NSObject { 887 887 @private 888 RetainPtr<NSURL> _blobURL;889 888 RetainPtr<NSString> _fileName; 890 889 RetainPtr<NSString> _attachmentIdentifier; 891 890 } 892 891 893 - (instancetype)initWithIdentifier:(NSString *)identifier blobURL:(NSURL *)url fileName:(NSString *)fileName; 894 895 @property (nonatomic, readonly) NSURL *blobURL; 892 - (instancetype)initWithIdentifier:(NSString *)identifier fileName:(NSString *)fileName; 893 896 894 @property (nonatomic, readonly) NSString *fileName; 897 895 @property (nonatomic, readonly) NSString *attachmentIdentifier; … … 901 899 @implementation WKPromisedAttachmentContext 902 900 903 - (instancetype)initWithIdentifier:(NSString *)identifier blobURL:(NSURL *)blobURLfileName:(NSString *)fileName901 - (instancetype)initWithIdentifier:(NSString *)identifier fileName:(NSString *)fileName 904 902 { 905 903 if (!(self = [super init])) 906 904 return nil; 907 905 908 _blobURL = blobURL;909 906 _fileName = fileName; 910 907 _attachmentIdentifier = identifier; 911 908 return self; 912 }913 914 - (NSURL *)blobURL915 {916 return _blobURL.get();917 909 } 918 910 … … 4235 4227 } 4236 4228 4237 URL blobURL { info.blobURL };4238 if (blobURL.isEmpty()) {4239 completionHandler(webKitUnknownError());4240 return;4241 }4242 4243 4229 completionHandler(webKitUnknownError()); 4244 4230 } … … 4286 4272 4287 4273 if (auto& info = item.promisedAttachmentInfo) { 4288 NSString *utiType = info.contentType; 4289 NSString *fileName = info.fileName; 4290 if (auto attachment = m_page->attachmentForIdentifier(info.attachmentIdentifier)) { 4291 utiType = attachment->utiType(); 4292 fileName = attachment->fileName(); 4274 auto attachment = m_page->attachmentForIdentifier(info.attachmentIdentifier); 4275 if (!attachment) { 4276 m_page->dragCancelled(); 4277 return; 4293 4278 } 4294 4279 4280 NSString *utiType = attachment->utiType(); 4295 4281 if (!utiType.length) { 4296 4282 m_page->dragCancelled(); … … 4298 4284 } 4299 4285 4286 NSString *fileName = attachment->fileName(); 4300 4287 auto provider = adoptNS([[NSFilePromiseProvider alloc] initWithFileType:utiType delegate:(id <NSFilePromiseProviderDelegate>)m_view.getAutoreleased()]); 4301 auto context = adoptNS([[WKPromisedAttachmentContext alloc] initWithIdentifier:info.attachmentIdentifier blobURL:info.blobURLfileName:fileName]);4288 auto context = adoptNS([[WKPromisedAttachmentContext alloc] initWithIdentifier:info.attachmentIdentifier fileName:fileName]); 4302 4289 [provider setUserInfo:context.get()]; 4303 4290 auto draggingItem = adoptNS([[NSDraggingItem alloc] initWithPasteboardWriter:provider.get()]); -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r275980 r276219 8150 8150 ASSERT(numberOfAdditionalTypes == info.additionalData.size()); 8151 8151 8152 RELEASE_LOG(DragAndDrop, "Drag session: %p preparing to drag blob: %s with attachment identifier: %s", session.get(), info.blobURL.string().utf8().data(), info.attachmentIdentifier.utf8().data());8153 8154 NSString *utiType = info.contentType;8155 NSString *fileName = info.fileName;8152 RELEASE_LOG(DragAndDrop, "Drag session: %p preparing to drag with attachment identifier: %s", session.get(), info.attachmentIdentifier.utf8().data()); 8153 8154 NSString *utiType = nil; 8155 NSString *fileName = nil; 8156 8156 if (auto attachment = _page->attachmentForIdentifier(info.attachmentIdentifier)) { 8157 8157 utiType = attachment->utiType(); -
trunk/Tools/ChangeLog
r276199 r276219 1 2021-04-17 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Remove PromisedAttachmentInfo::blobURL and adjacent code 4 https://bugs.webkit.org/show_bug.cgi?id=224720 5 6 Reviewed by Ryosuke Niwa. 7 8 Rebaseline a couple of iOS WKAttachment tests that are failing on recent versions of the iOS SDK. The content 9 type of text files that are inserted as attachments is now a MIME type rather than a UTI, which is still valid 10 since it is valid for the content type of an attachment to be either a MIME type or UTI. 11 12 * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm: 13 (TestWebKitAPI::TEST): 14 1 15 2021-04-17 Aakash Jain <aakash_jain@apple.com> 2 16 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm
r273194 r276219 1897 1897 EXPECT_WK_STREQ((__bridge NSString *)kUTTypeFlatRTFD, [webView stringByEvaluatingJavaScript:@"document.querySelectorAll('attachment')[0].getAttribute('type')"]); 1898 1898 EXPECT_WK_STREQ("world.txt", [webView stringByEvaluatingJavaScript:@"document.querySelectorAll('attachment')[1].getAttribute('title')"]); 1899 EXPECT_WK_STREQ((__bridge NSString *)kUTTypeUTF8PlainText, [webView stringByEvaluatingJavaScript:@"document.querySelectorAll('attachment')[1].getAttribute('type')"]); 1899 auto contentType = [webView stringByEvaluatingJavaScript:@"document.querySelectorAll('attachment')[1].getAttribute('type')"]; 1900 EXPECT_TRUE([contentType isEqualToString:(__bridge NSString *)kUTTypeUTF8PlainText] || [contentType containsString:@"text/plain"]); 1900 1901 } 1901 1902 … … 1954 1955 1955 1956 EXPECT_WK_STREQ("first.txt", [webView stringByEvaluatingJavaScript:@"document.querySelectorAll('attachment')[0].getAttribute('title')"]); 1956 EXPECT_WK_STREQ((__bridge NSString *)kUTTypeUTF8PlainText, [webView stringByEvaluatingJavaScript:@"document.querySelectorAll('attachment')[0].getAttribute('type')"]); 1957 auto contentType = [webView stringByEvaluatingJavaScript:@"document.querySelectorAll('attachment')[0].getAttribute('type')"]; 1958 EXPECT_TRUE([contentType isEqualToString:(__bridge NSString *)kUTTypeUTF8PlainText] || [contentType containsString:@"text/plain"]); 1957 1959 EXPECT_WK_STREQ([appleURL absoluteString], [webView valueOfAttribute:@"href" forQuerySelector:@"a"]); 1958 1960 EXPECT_WK_STREQ("second.pdf", [webView stringByEvaluatingJavaScript:@"document.querySelectorAll('attachment')[1].getAttribute('title')"]);
Note:
See TracChangeset
for help on using the changeset viewer.