[webkit-changes] [WebKit/WebKit] 3d9751: <input type=color alpha> swatch does not have a ba...

Anne van Kesteren noreply at github.com
Thu Jan 23 13:20:50 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3d975165870fdedf358571e31742bfa93eab1fd3
      https://github.com/WebKit/WebKit/commit/3d975165870fdedf358571e31742bfa93eab1fd3
  Author: Anne van Kesteren <annevk at annevk.nl>
  Date:   2025-01-23 (Thu, 23 Jan 2025)

  Changed paths:
    A LayoutTests/fast/forms/color/color-input-swatch-expected.txt
    A LayoutTests/fast/forms/color/color-input-swatch.html
    A LayoutTests/platform/mac/fast/forms/color/color-input-swatch-expected.txt
    M Source/WebCore/html/ColorInputType.cpp
    M Source/WebCore/rendering/RenderTheme.cpp
    M Source/WebCore/rendering/RenderTheme.h
    M Source/WebCore/rendering/mac/RenderThemeMac.h
    M Source/WebCore/rendering/mac/RenderThemeMac.mm

  Log Message:
  -----------
  <input type=color alpha> swatch does not have a background that reflects the transparency
https://bugs.webkit.org/show_bug.cgi?id=286212
rdar://143188497

Reviewed by Aditya Keerthi.

When a color with alpha channel was selected this would result in the
background of the parent element becoming visible. To prevent this we
perform a source-over color blending operation with opaque white. This
matches how the control behaves on iOS and seems like a reasonable
platform-neutral default.

For macOS we want to render a diagonally divided rectangle with one of
the triangles using opaque black as input for the blending operation
and the other opaque white to match the platform color well.

* LayoutTests/fast/forms/color/color-input-swatch-expected.txt: Added.
* LayoutTests/fast/forms/color/color-input-swatch.html: Added.
* LayoutTests/platform/mac/fast/forms/color/color-input-swatch-expected.txt: Added.
* Source/WebCore/html/ColorInputType.cpp:
(WebCore::ColorInputType::updateColorSwatch):
* Source/WebCore/rendering/RenderTheme.cpp:
(WebCore::RenderTheme::setColorWellSwatchBackground):
* Source/WebCore/rendering/RenderTheme.h:
* Source/WebCore/rendering/mac/RenderThemeMac.h:
* Source/WebCore/rendering/mac/RenderThemeMac.mm:
(WebCore::RenderThemeMac::setColorWellSwatchBackground):

Canonical link: https://commits.webkit.org/289314@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list