Bug 225942

Summary: Sampled Page Top Color: support sampling non-RGB values like P3
Product: WebKit Reporter: Devin Rousso <hi>
Component: New BugsAssignee: Devin Rousso <hi>
Status: NEW ---    
Severity: Normal CC: ews-watchlist, hi, joepeck, sam, 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=225167
https://bugs.webkit.org/show_bug.cgi?id=226730
Bug Depends on: 224987    
Bug Blocks:    
Attachments:
Description Flags
Patch hi: review?, ews-feeder: commit-queue-

Description Devin Rousso 2021-05-18 16:45:32 PDT
.
Comment 1 Radar WebKit Bug Importer 2021-05-18 16:46:16 PDT
<rdar://problem/78179713>
Comment 2 Devin Rousso 2021-05-25 14:01:26 PDT
Created attachment 429691 [details]
Patch
Comment 3 Tim Horton 2021-05-25 14:53:10 PDT
Comment on attachment 429691 [details]
Patch

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

> Source/WebCore/page/PageColorSampler.cpp:111
> +#if ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3)
> +    auto colorSpace = DestinationColorSpace::DisplayP3();
> +    using PixelBufferColorType = DisplayP3<uint8_t>;
> +    using SampleColorType = DisplayP3<float>;
> +#else
> +    auto colorSpace = DestinationColorSpace::SRGB();
> +    using PixelBufferColorType = SRGBA<uint8_t>;
> +    using SampleColorType = SRGBA<float>;
> +#endif

This seems a bit surprising to be hardcoded (and by a compile time flag no less!), shouldn't it follow the actual destination colorspace?
Comment 4 Devin Rousso 2021-05-25 15:02:28 PDT
Comment on attachment 429691 [details]
Patch

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

>> Source/WebCore/page/PageColorSampler.cpp:111
>> +#endif
> 
> This seems a bit surprising to be hardcoded (and by a compile time flag no less!), shouldn't it follow the actual destination colorspace?

Are you suggesting like some sort of `colorTypeFromColorSpace`?  AFAIK that isn't a thing we have right now.  Can you elaborate more a bit on what you mean?
Comment 5 Tim Horton 2021-05-25 15:10:50 PDT
Comment on attachment 429691 [details]
Patch

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

>>> Source/WebCore/page/PageColorSampler.cpp:111
>>> +#endif
>> 
>> This seems a bit surprising to be hardcoded (and by a compile time flag no less!), shouldn't it follow the actual destination colorspace?
> 
> Are you suggesting like some sort of `colorTypeFromColorSpace`?  AFAIK that isn't a thing we have right now.  Can you elaborate more a bit on what you mean?

No, I meant picking a color space compile-time is weird, when you should really be using the one that the owning view will render with! What if it's wider than P3? Let's see what Sam says.
Comment 6 Devin Rousso 2021-05-25 15:13:19 PDT
Comment on attachment 429691 [details]
Patch

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

>>>> Source/WebCore/page/PageColorSampler.cpp:111
>>>> +#endif
>>> 
>>> This seems a bit surprising to be hardcoded (and by a compile time flag no less!), shouldn't it follow the actual destination colorspace?
>> 
>> Are you suggesting like some sort of `colorTypeFromColorSpace`?  AFAIK that isn't a thing we have right now.  Can you elaborate more a bit on what you mean?
> 
> No, I meant picking a color space compile-time is weird, when you should really be using the one that the owning view will render with! What if it's wider than P3? Let's see what Sam says.

FYI right now `DestinationColorSpace` only supports sRGB, Linear sRGB, and P3.
Comment 7 Tim Horton 2021-05-25 15:17:27 PDT
(In reply to Devin Rousso from comment #6)
> Comment on attachment 429691 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=429691&action=review
> 
> >>>> Source/WebCore/page/PageColorSampler.cpp:111
> >>>> +#endif
> >>> 
> >>> This seems a bit surprising to be hardcoded (and by a compile time flag no less!), shouldn't it follow the actual destination colorspace?
> >> 
> >> Are you suggesting like some sort of `colorTypeFromColorSpace`?  AFAIK that isn't a thing we have right now.  Can you elaborate more a bit on what you mean?
> > 
> > No, I meant picking a color space compile-time is weird, when you should really be using the one that the owning view will render with! What if it's wider than P3? Let's see what Sam says.
> 
> FYI right now `DestinationColorSpace` only supports sRGB, Linear sRGB, and
> P3.

1) Is it chosen at compile time?
2) Do you think if someone adds one, they'll fix your code?
Comment 8 Sam Weinig 2021-05-25 16:16:16 PDT
Comment on attachment 429691 [details]
Patch

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

>>>>>> Source/WebCore/page/PageColorSampler.cpp:111
>>>>>> +#endif
>>>>> 
>>>>> This seems a bit surprising to be hardcoded (and by a compile time flag no less!), shouldn't it follow the actual destination colorspace?
>>>> 
>>>> Are you suggesting like some sort of `colorTypeFromColorSpace`?  AFAIK that isn't a thing we have right now.  Can you elaborate more a bit on what you mean?
>>> 
>>> No, I meant picking a color space compile-time is weird, when you should really be using the one that the owning view will render with! What if it's wider than P3? Let's see what Sam says.
>> 
>> FYI right now `DestinationColorSpace` only supports sRGB, Linear sRGB, and P3.
> 
> 1) Is it chosen at compile time?
> 2) Do you think if someone adds one, they'll fix your code?

DestinationColorSpace can support all color spaces. Like Tim said, this should use the color space the hosting view is using.