[webkit-changes] [WebKit/WebKit] 5381f4: <input type=checkbox switch> paints outside its bo...

Anne van Kesteren noreply at github.com
Thu Mar 7 14:41:24 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5381f48e7a048d58bf8b46f15a4318f38457acc8
      https://github.com/WebKit/WebKit/commit/5381f48e7a048d58bf8b46f15a4318f38457acc8
  Author: Anne van Kesteren <annevk at annevk.nl>
  Date:   2024-03-07 (Thu, 07 Mar 2024)

  Changed paths:
    M LayoutTests/fast/forms/switch/no-pixels-outside-the-box-vertical-lr-rtl.html
    M LayoutTests/fast/forms/switch/no-pixels-outside-the-box.html
    M Source/WebCore/platform/graphics/mac/controls/SwitchMacUtilities.h
    M Source/WebCore/platform/graphics/mac/controls/SwitchMacUtilities.mm
    M Source/WebCore/platform/graphics/mac/controls/SwitchThumbMac.mm
    M Source/WebCore/platform/graphics/mac/controls/SwitchTrackMac.mm

  Log Message:
  -----------
  <input type=checkbox switch> paints outside its box and the thumb is slightly misaligned on macOS
https://bugs.webkit.org/show_bug.cgi?id=267679
rdar://121579531

Reviewed by Aditya Keerthi.

This fixes two problems:

1. The thumb was misplaced by half a pixel. The error here was not
   calculating the inflated box for the thumb independently and instead
   assuming it would be the inflated track's height squared. The new
   code calculates the thumb boxes (mostly) independently from the
   track boxes.

2. Drawing the thumb was not masked in any way. This resulted in some
   pixel bleeding at the top of the control. This was noticed, but
   initially not deemed a problem. It's now deemed a problem and
   corrected by using the same masking code we use for the track. There
   remains some slight bleeding, though noticeably less.

* LayoutTests/fast/forms/switch/no-pixels-outside-the-box-vertical-lr-rtl.html:
* LayoutTests/fast/forms/switch/no-pixels-outside-the-box.html:
* Source/WebCore/platform/graphics/mac/controls/SwitchMacUtilities.h:
* Source/WebCore/platform/graphics/mac/controls/SwitchMacUtilities.mm:
(WebCore::SwitchMacUtilities::visualCellSize):
(WebCore::SwitchMacUtilities::trackMaskImage):
* Source/WebCore/platform/graphics/mac/controls/SwitchThumbMac.mm:
(WebCore::SwitchThumbMac::cellSize const):
(WebCore::SwitchThumbMac::draw):
* Source/WebCore/platform/graphics/mac/controls/SwitchTrackMac.mm:
(WebCore::SwitchTrackMac::draw):
(WebCore::trackMaskImage): Deleted.

Canonical link: https://commits.webkit.org/275808@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