WebKit Bugzilla
Attachment 357957 Details for
Bug 192984
: Setting the file wrapper and content type of an attachment to a PDF should update its image
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192984-20181221103600.patch (text/plain), 4.54 KB, created by
Wenson Hsieh
on 2018-12-21 10:36:01 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2018-12-21 10:36:01 PST
Size:
4.54 KB
patch
obsolete
>Subversion Revision: 239502 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 236fedcf96cb88f483ddab3a758518ff35996418..e75ec129aa4651aa58844166597e77c22c8b626f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2018-12-21 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Setting the file wrapper and content type of an attachment to a PDF should update its image >+ https://bugs.webkit.org/show_bug.cgi?id=192984 >+ <rdar://problem/46798028> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Allow PDF data to be used to update enclosing image elements when setting the file wrapper for an attachment. >+ Covered by a new API test: WKAttachmentTests.SetFileWrapperForPDFImageAttachment. >+ >+ * html/HTMLAttachmentElement.cpp: >+ (WebCore::mimeTypeIsSuitableForInlineImageAttachment): >+ (WebCore::HTMLAttachmentElement::updateEnclosingImageWithData): >+ > 2018-12-21 Manuel Rego Casasnovas <rego@igalia.com> > > [css-grid] Fix percentages in relative offsets for grid items >diff --git a/Source/WebCore/html/HTMLAttachmentElement.cpp b/Source/WebCore/html/HTMLAttachmentElement.cpp >index 7111cf6d8d93788e705b8d636be125dcd2f36fca..c040c198d9d1b70d70ec50ef2a49814ebfd3b110 100644 >--- a/Source/WebCore/html/HTMLAttachmentElement.cpp >+++ b/Source/WebCore/html/HTMLAttachmentElement.cpp >@@ -226,6 +226,11 @@ void HTMLAttachmentElement::updateAttributes(Optional<uint64_t>&& newFileSize, c > renderer->invalidate(); > } > >+static bool mimeTypeIsSuitableForInlineImageAttachment(const String& mimeType) >+{ >+ return MIMETypeRegistry::isSupportedImageMIMEType(mimeType) || MIMETypeRegistry::isPDFMIMEType(mimeType); >+} >+ > void HTMLAttachmentElement::updateEnclosingImageWithData(const String& contentType, Ref<SharedBuffer>&& data) > { > auto* hostElement = shadowHost(); >@@ -238,7 +243,7 @@ void HTMLAttachmentElement::updateEnclosingImageWithData(const String& contentTy > mimeType = MIMETypeFromUTI(contentType); > #endif > >- if (!MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) >+ if (!mimeTypeIsSuitableForInlineImageAttachment(mimeType)) > return; > > hostElement->setAttributeWithoutSynchronization(HTMLNames::srcAttr, DOMURL::createObjectURL(document(), Blob::create(WTFMove(data), mimeType))); >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index ac5c9a2844888516b6278271092cb638c931431e..06c76e39d9921e96bada84b25e53951dda6e76cf 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,16 @@ >+2018-12-21 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ Setting the file wrapper and content type of an attachment to a PDF should update its image >+ https://bugs.webkit.org/show_bug.cgi?id=192984 >+ <rdar://problem/46798028> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add an API test to verify that setting the file wrapper for a _WKAttachment with an enclosing image element with >+ PDF data correctly updates the image element. >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm: >+ > 2018-12-21 Benjamin Poulain <benjamin@webkit.org> > > <rdar://problem/46194315> macOS: WebKit1 does not handle occlusion changes >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >index 83b0660536faede1e2cc353031e99646c5e8ec52..722b68cd7a1926397b74500042536ce43658a12c 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm >@@ -1505,6 +1505,18 @@ TEST(WKAttachmentTests, AttachmentIdentifierOfClonedAttachment) > EXPECT_WK_STREQ([attachment uniqueIdentifier], [webView stringByEvaluatingJavaScript:@"document.body.cloneNode(true).querySelector('attachment').uniqueIdentifier"]); > } > >+TEST(WKAttachmentTests, SetFileWrapperForPDFImageAttachment) >+{ >+ auto webView = webViewForTestingAttachments(); >+ [webView evaluateJavaScript:@"document.body.appendChild()" completionHandler:nil]; >+ NSString *identifier = [webView stringByEvaluatingJavaScript:@"const i = document.createElement('img'); document.body.appendChild(i); HTMLAttachmentElement.getAttachmentIdentifier(i)"]; >+ _WKAttachment *attachment = [webView _attachmentForIdentifier:identifier]; >+ >+ auto pdfFile = adoptNS([[NSFileWrapper alloc] initRegularFileWithContents:testPDFData()]); >+ [attachment setFileWrapper:pdfFile.get() contentType:(__bridge NSString *)kUTTypePDF completion:nil]; >+ [webView waitForImageElementSizeToBecome:CGSizeMake(130, 29)]; >+} >+ > #pragma mark - Platform-specific tests > > #if PLATFORM(MAC)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192984
: 357957