Changeset 239511 in webkit
- Timestamp:
- Dec 21, 2018 11:40:41 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r239504 r239511 1 2018-12-21 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Setting the file wrapper and content type of an attachment to a PDF should update its image 4 https://bugs.webkit.org/show_bug.cgi?id=192984 5 <rdar://problem/46798028> 6 7 Reviewed by Tim Horton. 8 9 Allow PDF data to be used to update enclosing image elements when setting the file wrapper for an attachment. 10 Covered by a new API test: WKAttachmentTests.SetFileWrapperForPDFImageAttachment. 11 12 * html/HTMLAttachmentElement.cpp: 13 (WebCore::mimeTypeIsSuitableForInlineImageAttachment): 14 (WebCore::HTMLAttachmentElement::updateEnclosingImageWithData): 15 1 16 2018-12-21 Justin Michaud <justin_michaud@apple.com> 2 17 -
trunk/Source/WebCore/html/HTMLAttachmentElement.cpp
r239427 r239511 227 227 } 228 228 229 static bool mimeTypeIsSuitableForInlineImageAttachment(const String& mimeType) 230 { 231 return MIMETypeRegistry::isSupportedImageMIMEType(mimeType) || MIMETypeRegistry::isPDFMIMEType(mimeType); 232 } 233 229 234 void HTMLAttachmentElement::updateEnclosingImageWithData(const String& contentType, Ref<SharedBuffer>&& data) 230 235 { … … 239 244 #endif 240 245 241 if (! MIMETypeRegistry::isSupportedImageMIMEType(mimeType))246 if (!mimeTypeIsSuitableForInlineImageAttachment(mimeType)) 242 247 return; 243 248 -
trunk/Tools/ChangeLog
r239507 r239511 1 2018-12-21 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Setting the file wrapper and content type of an attachment to a PDF should update its image 4 https://bugs.webkit.org/show_bug.cgi?id=192984 5 <rdar://problem/46798028> 6 7 Reviewed by Tim Horton. 8 9 Add an API test to verify that setting the file wrapper for a _WKAttachment with an enclosing image element with 10 PDF data correctly updates the image element. 11 12 * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm: 13 1 14 2018-12-21 Michael Catanzaro <mcatanzaro@igalia.com> 2 15 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm
r239184 r239511 1506 1506 } 1507 1507 1508 TEST(WKAttachmentTests, SetFileWrapperForPDFImageAttachment) 1509 { 1510 auto webView = webViewForTestingAttachments(); 1511 [webView evaluateJavaScript:@"document.body.appendChild()" completionHandler:nil]; 1512 NSString *identifier = [webView stringByEvaluatingJavaScript:@"const i = document.createElement('img'); document.body.appendChild(i); HTMLAttachmentElement.getAttachmentIdentifier(i)"]; 1513 _WKAttachment *attachment = [webView _attachmentForIdentifier:identifier]; 1514 1515 auto pdfFile = adoptNS([[NSFileWrapper alloc] initRegularFileWithContents:testPDFData()]); 1516 [attachment setFileWrapper:pdfFile.get() contentType:(__bridge NSString *)kUTTypePDF completion:nil]; 1517 [webView waitForImageElementSizeToBecome:CGSizeMake(130, 29)]; 1518 } 1519 1508 1520 #pragma mark - Platform-specific tests 1509 1521
Note: See TracChangeset
for help on using the changeset viewer.