Bug 230209

Summary: display-p3 canvas toDataURL / toBlob returns sRGB data for JPEGs
Product: WebKit Reporter: Cameron McCormack (:heycam) <heycam>
Component: CanvasAssignee: Cameron McCormack (:heycam) <heycam>
Status: RESOLVED FIXED    
Severity: Normal CC: alecflett, beidson, benjamin, cdumez, changseok, clopez, cmarcelo, dino, esprehn+autocc, ews-watchlist, gyuyoung.kim, jsbell, kondapallykalyan, sam, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://github.com/web-platform-tests/wpt/pull/30838
Bug Depends on:    
Bug Blocks: 225140    
Attachments:
Description Flags
Patch with squashed dependencies for EWS
none
Patch with squashed dependencies for EWS
none
Patch
none
Patch none

Description Cameron McCormack (:heycam) 2021-09-12 22:59:15 PDT
toDataURL() on a display-p3 canvas seems to work for an image/png destination but not image/jpeg.
Comment 1 Cameron McCormack (:heycam) 2021-09-12 22:59:34 PDT
<rdar://82948457>
Comment 2 Radar WebKit Bug Importer 2021-09-12 22:59:51 PDT
<rdar://problem/83041091>
Comment 3 Cameron McCormack (:heycam) 2021-09-12 23:01:05 PDT
<rdar://82948457>
Comment 4 Cameron McCormack (:heycam) 2021-09-12 23:29:44 PDT
Created attachment 438017 [details]
Patch with squashed dependencies for EWS
Comment 5 EWS Watchlist 2021-09-12 23:30:45 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 6 Cameron McCormack (:heycam) 2021-09-13 00:24:48 PDT
Created attachment 438018 [details]
Patch with squashed dependencies for EWS
Comment 7 Sam Weinig 2021-09-15 09:34:30 PDT
Comment on attachment 438018 [details]
Patch with squashed dependencies for EWS

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

> Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp:99
> +    if (CGColorSpaceGetModel(imageBufferColorSpace.platformColorSpace()) != kCGColorSpaceModelRGB)
> +        return sRGBColorSpaceRef();

This is another spot where CGBitmapContextCreateForFlatteningImage might make sense.
Comment 8 Cameron McCormack (:heycam) 2021-09-16 21:14:07 PDT
Created attachment 438441 [details]
Patch
Comment 9 Cameron McCormack (:heycam) 2021-09-16 21:14:41 PDT
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/30838
Comment 10 EWS 2021-09-16 21:24:20 PDT
ChangeLog entry in LayoutTests/imported/w3c/ChangeLog contains OOPS!.
Comment 11 Cameron McCormack (:heycam) 2021-09-16 21:33:23 PDT
Created attachment 438443 [details]
Patch
Comment 12 EWS 2021-09-16 22:32:46 PDT
Committed r282634 (241791@main): <https://commits.webkit.org/241791@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 438443 [details].