[Webkit-unassigned] [Bug 234798] Add resolved/unresolved color type accessors to require users to be explicit about whether they will handle missing/none color components

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 3 09:11:57 PST 2022


https://bugs.webkit.org/show_bug.cgi?id=234798

Antti Koivisto <koivisto at iki.fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |koivisto at iki.fi
 Attachment #448202|review?                     |review+
              Flags|                            |

--- Comment #10 from Antti Koivisto <koivisto at iki.fi> ---
Comment on attachment 448202
  --> https://bugs.webkit.org/attachment.cgi?id=448202
Patch

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

> Source/WebCore/ChangeLog:33
> +        opertunity to replace all its uses with the generic toColorTypeLossy<SRGBA<>>.

spelling "opertunity"

> Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp:95
> +        auto [r, g, b, a] = bgColor.toColorTypeLossy<SRGBA<uint8_t>>().resolved();

There is a lot of this. Could we have a template-free shortcut for this apparently common case with a sensible name that hints the proper use?

One should be able to write WebKit code without becoming a color space expert or mindlessly copy-pasting.

> Source/WebCore/accessibility/atspi/AccessibilityObjectTextAtspi.cpp:827
> -                auto [r, g, b, a] = bgColor.toSRGBALossy<uint8_t>();
> +                auto [r, g, b, a] = bgColor..toColorTypeLossy<SRGBA<uint8_t>>().resolved();

what's up with those double ..?

> Source/WebCore/accessibility/atspi/AccessibilityObjectTextAtspi.cpp:833
> +                auto [r, g, b, a] = fgColor..toColorTypeLossy<SRGBA<uint8_t>>().resolved();

here too

> Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:1534
> +    auto originColorAsSRGB = originColor.toColorTypeLossy<SRGBA<float>>().resolved();

Similarly maybe this could have a shortcut?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220103/86e16bfc/attachment.htm>


More information about the webkit-unassigned mailing list