[Webkit-unassigned] [Bug 201003] background: none will affect the input font color

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 22 14:47:32 PDT 2019


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

--- Comment #3 from Zhifei Fang <zhifei_fang at apple.com> ---
Root cause is here:

Color RenderTheme::disabledTextColor(const Color& textColor, const Color& backgroundColor) const
{
    // The explicit check for black is an optimization for the 99% case (black on white).
    // This also means that black on black will turn into grey on black when disabled.
    Color disabledColor;
    if (Color::isBlackColor(textColor) || backgroundColor.alphaAsFloat() < minDisabledColorAlphaValue || differenceSquared(textColor, Color::white) > differenceSquared(backgroundColor, Color::white))
        disabledColor = textColor.light();
    else
        disabledColor = textColor.dark();

    // If there's not very much contrast between the disabled color and the background color,
    // just leave the text color alone. We don't want to change a good contrast color scheme so that it has really bad contrast.
    // If the contrast was already poor, then it doesn't do any good to change it to a different poor contrast color scheme.
    if (differenceSquared(disabledColor, backgroundColor) < minColorContrastValue)
        return textColor;

    return disabledColor;
}

background:none will create pass in a background color as rgba(0,0,0,0) which means it is totally invisible here, and differenceSquared method will only take care about the rgb color value, so it will treat the background color as black, therefore it will return a very light color.


The easy fix here is if we have a user defined color, we shouldn't use this method to compute an override disabled color.

However, I think the real fix here is we shouldn't relay on the text block's background, if the alpha has been set, we need somehow find the real mixed background color, and calculate the contrast.

-- 
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/20190822/86105294/attachment.html>


More information about the webkit-unassigned mailing list