[webkit-changes] [WebKit/WebKit] 24ebb0: Add <input type=checkbox switch> macOS vertical re...

Anne van Kesteren noreply at github.com
Thu Dec 21 01:27:34 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 24ebb01cef269ea5bfd77c2abc82d56474206a77
      https://github.com/WebKit/WebKit/commit/24ebb01cef269ea5bfd77c2abc82d56474206a77
  Author: Anne van Kesteren <annevk at annevk.nl>
  Date:   2023-12-21 (Thu, 21 Dec 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/forms/checkbox-switch-input-computed-style.tentative-expected.txt
    M Source/WebCore/html/CheckboxInputType.cpp
    M Source/WebCore/html/CheckboxInputType.h
    M Source/WebCore/platform/Theme.h
    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
    M Source/WebCore/platform/mac/ThemeMac.h
    M Source/WebCore/platform/mac/ThemeMac.mm
    M Source/WebCore/rendering/RenderTheme.cpp
    M Source/WebCore/rendering/RenderTheme.h
    M Source/WebCore/rendering/RenderThemeIOS.mm
    M Source/WebCore/rendering/RenderThemeMac.mm

  Log Message:
  -----------
  Add <input type=checkbox switch> macOS vertical rendering
https://bugs.webkit.org/show_bug.cgi?id=266347

Reviewed by Aditya Keerthi.

This adjusts the logic in CheckboxInputType so pointer tracking is
based on the vertical position when the control is rendered
vertically.

It similarly adjusts the macOS drawing logic, with some additional
special casing for the on label which shows when
"Differentiate without color" is enabled.

Rather than continuing to reuse
adjustButtonOrCheckboxOrColorWellOrInnerSpinButtonOrRadioOrSwitchStyle()
we make switch break from that pattern by selectively copying over the
parts that apply to switch. (Spoiler: setting the logical width and
height.)

And finally, but not least, adjust the repaint size calculation.
https://bugs.webkit.org/show_bug.cgi?id=266532 is filed as a follow-up
for this due to an issue with writing-mode:vertical-rl.

* LayoutTests/imported/w3c/web-platform-tests/css/css-writing-modes/forms/checkbox-switch-input-computed-style.tentative-expected.txt:
* Source/WebCore/html/CheckboxInputType.cpp:
(WebCore::switchPointerTrackingLogicalLeftPosition):
(WebCore::CheckboxInputType::startSwitchPointerTracking):
(WebCore::CheckboxInputType::stopSwitchPointerTracking):
(WebCore::CheckboxInputType::isSwitchPointerTracking const):
(WebCore::CheckboxInputType::updateIsSwitchVisuallyOnFromAbsoluteLocation):
* Source/WebCore/html/CheckboxInputType.h:
* Source/WebCore/platform/Theme.h:
(WebCore::Theme::inflateControlPaintRect const): Deleted.
* Source/WebCore/platform/graphics/mac/controls/SwitchMacUtilities.h:
* Source/WebCore/platform/graphics/mac/controls/SwitchMacUtilities.mm:
(WebCore::SwitchMacUtilities::visualCellSize):
(WebCore::SwitchMacUtilities::visualCellOutsets):
(WebCore::SwitchMacUtilities::rectWithTransposedSize):
(WebCore::SwitchMacUtilities::trackRectForBounds):
(WebCore::SwitchMacUtilities::rotateContextForVerticalWritingMode):
* Source/WebCore/platform/graphics/mac/controls/SwitchThumbMac.mm:
(WebCore::SwitchThumbMac::draw):
* Source/WebCore/platform/graphics/mac/controls/SwitchTrackMac.mm:
(WebCore::trackMaskImage):
(WebCore::trackImage):
(WebCore::SwitchTrackMac::draw):
* Source/WebCore/platform/mac/ThemeMac.h:
* Source/WebCore/platform/mac/ThemeMac.mm:
(WebCore::visualSwitchMargins):
(WebCore::ThemeMac::inflateControlPaintRect const):
* Source/WebCore/rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustButtonOrCheckboxOrColorWellOrInnerSpinButtonOrRadioStyle const):
(WebCore::RenderTheme::adjustCheckboxStyle const):
(WebCore::RenderTheme::adjustRadioStyle const):
(WebCore::RenderTheme::adjustColorWellStyle const):
(WebCore::RenderTheme::adjustButtonStyle const):
(WebCore::RenderTheme::adjustInnerSpinButtonStyle const):
(WebCore::RenderTheme::adjustSwitchStyle const):
(WebCore::RenderTheme::adjustButtonOrCheckboxOrColorWellOrInnerSpinButtonOrRadioOrSwitchStyle const): Deleted.
* Source/WebCore/rendering/RenderTheme.h:
* Source/WebCore/rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::adjustSwitchStyle const):
* Source/WebCore/rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::adjustRepaintRect):

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




More information about the webkit-changes mailing list