Bug 236405 - Mail attachment switched to TIFF and balloons in size after markup.
Summary: Mail attachment switched to TIFF and balloons in size after markup.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Megan Gardner
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-09 13:46 PST by Megan Gardner
Modified: 2022-02-10 09:06 PST (History)
3 users (show)

See Also:


Attachments
Patch (6.71 KB, patch)
2022-02-09 14:46 PST, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (7.38 KB, patch)
2022-02-09 15:34 PST, Megan Gardner
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (7.38 KB, patch)
2022-02-09 19:47 PST, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (6.81 KB, patch)
2022-02-09 20:23 PST, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch for landing (6.81 KB, patch)
2022-02-10 08:31 PST, Megan Gardner
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Megan Gardner 2022-02-09 13:46:33 PST
Mail attachment switched to TIFF and baloons in size after markup.
Comment 1 Megan Gardner 2022-02-09 14:46:00 PST
Created attachment 451446 [details]
Patch
Comment 2 Tim Horton 2022-02-09 15:08:54 PST
Comment on attachment 451446 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=451446&action=review

> Source/WebKit/ChangeLog:3
> +        Mail attachment switched to TIFF and baloons in size after markup.

"balloons"

> Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm:157
> +NSData* Attachment::enclosingImageNSData() const

all your nsdata stars are on the wrong side

> Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm:160
> +        return NULL;

nil in a variety of places

> Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm:216
> +        auto attachment = page()->attachmentForIdentifier(m_context.controlledImageAttachmentID());
> +        auto itemProvider = adoptNS([[NSItemProvider alloc] initWithItem:attachment->enclosingImageNSData() typeIdentifier:attachment->utiType()]);

I think there might be cases where we don't have an API attachment backing a controlled image? but I'm not sure. Maybe fall back to the old thing if you fail to get the attachment? Or maybe Wenson will tell you I'm wrong.
Comment 3 Wenson Hsieh 2022-02-09 15:20:21 PST
Comment on attachment 451446 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=451446&action=review

> Source/WebKit/UIProcess/API/Cocoa/APIAttachmentCocoa.mm:171
> +    NSData *data = [fileWrapper regularFileContents];
> +    if (!data)
> +        return NULL;
> +
> +    return data;

Nit - I would just write this `return fileWrapper.regularFileContents;`

>> Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm:216
>> +        auto itemProvider = adoptNS([[NSItemProvider alloc] initWithItem:attachment->enclosingImageNSData() typeIdentifier:attachment->utiType()]);
> 
> I think there might be cases where we don't have an API attachment backing a controlled image? but I'm not sure. Maybe fall back to the old thing if you fail to get the attachment? Or maybe Wenson will tell you I'm wrong.

My understanding was that we would only allow mark up on images that are attachment-backed (i.e., backed by <object> in legacy WK1 compose).

I did verify that in legacy Mail compose, remote images cannot be marked up (by replying to an email with remote images).

But at any rate, using the image bitmap data as a fallback seems sensible!
Comment 4 Megan Gardner 2022-02-09 15:34:37 PST
Created attachment 451455 [details]
Patch
Comment 5 Wenson Hsieh 2022-02-09 16:22:29 PST
Comment on attachment 451455 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=451455&action=review

> Source/WebKit/UIProcess/API/APIAttachment.cpp:106
> +NSData* Attachment::enclosingImageNSData() const

Nit - * is still on the wrong side here.

> Source/WebKit/UIProcess/API/APIAttachment.cpp:108
> +    return nullptr;

Nit - `return nil;`
Comment 6 Megan Gardner 2022-02-09 19:47:01 PST
Created attachment 451487 [details]
Patch for landing
Comment 7 Wenson Hsieh 2022-02-09 20:00:12 PST
The Windows build failures in https://ews-build.webkit.org/#/builders/12/builds/72990 seem legit.
Comment 8 Megan Gardner 2022-02-09 20:23:32 PST
Created attachment 451490 [details]
Patch
Comment 9 Megan Gardner 2022-02-10 08:31:42 PST
Created attachment 451540 [details]
Patch for landing
Comment 10 EWS 2022-02-10 09:05:34 PST
Committed r289541 (247072@main): <https://commits.webkit.org/247072@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 451540 [details].
Comment 11 Radar WebKit Bug Importer 2022-02-10 09:06:28 PST
<rdar://problem/88758362>