Bug 238069

Summary: [Cocoa] Teach WebKit how to serialize CGColors
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: New BugsAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cmarcelo, dino, ews-watchlist, glenn, jbedard, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=238279
Attachments:
Description Flags
Patch
none
Patch
none
Patch dino: review+

Description Myles C. Maxfield 2022-03-18 02:09:25 PDT
[IPC] Teach WebKit how to serialize CGColors
Comment 1 Myles C. Maxfield 2022-03-18 02:15:53 PDT
Created attachment 455080 [details]
Patch
Comment 2 Myles C. Maxfield 2022-03-18 02:15:57 PDT
<rdar://problem/90124325>
Comment 3 Myles C. Maxfield 2022-03-18 02:18:45 PDT
Created attachment 455081 [details]
Patch
Comment 4 Myles C. Maxfield 2022-03-18 14:36:31 PDT
Created attachment 455137 [details]
Patch
Comment 5 Tim Horton 2022-03-18 15:50:01 PDT
Comment on attachment 455137 [details]
Patch

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

> Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm:60
> +- (instancetype _Nullable)initWithCGColor:(CGColorRef)wrappedColor;

no infectious nullable in implementation files, please! (in many places)

> Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm:74
> +    if (CFGetTypeID(object) == CGColorGetTypeID())

should this check the type hierarchy instead of a specific type? what if you have a CGColor subtype? (is that even a thing?)

> Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm:250
> +    // Non-toll-free-bridged CF types do not conform to NSSecureCoding.

Wouldn't non-bridged CF types also be exploding about messaging them with -isKindOfClass? (maybe not)
Comment 6 Myles C. Maxfield 2022-03-18 17:14:51 PDT
Comment on attachment 455137 [details]
Patch

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

>> Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm:250
>> +    // Non-toll-free-bridged CF types do not conform to NSSecureCoding.
> 
> Wouldn't non-bridged CF types also be exploding about messaging them with -isKindOfClass? (maybe not)

They behave as NSObject (rather than NSColor or whatever).
Comment 7 Myles C. Maxfield 2022-03-18 18:54:54 PDT
Comment on attachment 455137 [details]
Patch

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

>> Source/WebKit/Shared/Cocoa/ArgumentCodersCocoa.mm:74
>> +    if (CFGetTypeID(object) == CGColorGetTypeID())
> 
> should this check the type hierarchy instead of a specific type? what if you have a CGColor subtype? (is that even a thing?)

(Followed up offline about this)
Comment 8 Myles C. Maxfield 2022-03-18 19:00:47 PDT
Committed r291518 (248624@trunk): <https://commits.webkit.org/248624@trunk>