Bug 225942 - Sampled Page Top Color: support sampling non-RGB values like P3
Summary: Sampled Page Top Color: support sampling non-RGB values like P3
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on: 224987
Blocks:
  Show dependency treegraph
 
Reported: 2021-05-18 16:45 PDT by Devin Rousso
Modified: 2021-06-07 08:36 PDT (History)
6 users (show)

See Also:


Attachments
Patch (33.18 KB, patch)
2021-05-25 14:01 PDT, Devin Rousso
drousso: review?
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.