RESOLVED FIXED 239748
Adjust some image transcoding behaviors related to "Copy Cropped Image"
https://bugs.webkit.org/show_bug.cgi?id=239748
Summary Adjust some image transcoding behaviors related to "Copy Cropped Image"
Wenson Hsieh
Reported 2022-04-25 16:42:54 PDT
Attachments
Patch (20.90 KB, patch)
2022-04-25 21:52 PDT, Wenson Hsieh
katherine_cheney: review+
Patch for landing (21.33 KB, patch)
2022-04-26 08:55 PDT, Wenson Hsieh
no flags
Wenson Hsieh
Comment 1 2022-04-25 21:52:29 PDT
Kate Cheney
Comment 2 2022-04-26 08:25:30 PDT
Comment on attachment 458327 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=458327&action=review looks good! A couple Qs > Source/WebKit/Platform/cocoa/CocoaImage.mm:-56 > - if (CFStringGetLength(preferredMIMEType)) { should we keep this check or add an assert that the CFStringRef isn't empty for future callers? > Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:11034 > + auto [data, type] = WebKit::imageDataForCroppedImageResult(result, (__bridge CFStringRef)sourceMIMEType.get()); Do we no longer need to worry about if the result is nil in this case?
Wenson Hsieh
Comment 3 2022-04-26 08:43:51 PDT
Comment on attachment 458327 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=458327&action=review Thanks for the review! >> Source/WebKit/Platform/cocoa/CocoaImage.mm:-56 >> - if (CFStringGetLength(preferredMIMEType)) { > > should we keep this check or add an assert that the CFStringRef isn't empty for future callers? Good call! Will add a `ASSERT(CFStringGetLength(preferredMIMEType));` here. >> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:11034 >> + auto [data, type] = WebKit::imageDataForCroppedImageResult(result, (__bridge CFStringRef)sourceMIMEType.get()); > > Do we no longer need to worry about if the result is nil in this case? Good catch! I originally fell back to the original image in the case where the "markup image conversion" failed, but this is no longer desired behavior. That said, in the case where `result` is null, we should be bailing from this codepath altogether — I'll add an early return for the `!result` case above.
Wenson Hsieh
Comment 4 2022-04-26 08:55:39 PDT
Created attachment 458373 [details] Patch for landing
EWS
Comment 5 2022-04-26 11:29:14 PDT
Committed r293436 (249994@main): <https://commits.webkit.org/249994@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 458373 [details].
Note You need to log in before you can comment on or make changes to this bug.