[webkit-changes] [WebKit/WebKit] 9ccdb7: Add <input type=checkbox switch> macOS implementation
Anne van Kesteren
noreply at github.com
Tue Nov 7 11:46:07 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9ccdb741ae1c6be732cb630042f27590d0d30c69
https://github.com/WebKit/WebKit/commit/9ccdb741ae1c6be732cb630042f27590d0d30c69
Author: Anne van Kesteren <annevk at annevk.nl>
Date: 2023-11-07 (Tue, 07 Nov 2023)
Changed paths:
A LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-type-checkbox-switch.tentative.window-expected.txt
A LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-type-checkbox-switch.tentative.window.html
A LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-type-checkbox-switch.tentative.window.js
M LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/input-checkbox-switch.tentative.window-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/input-checkbox-switch.tentative.window.js
M Source/WebCore/Headers.cmake
M Source/WebCore/PAL/pal/spi/mac/CoreUISPI.h
M Source/WebCore/SourcesCocoa.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/css/CSSPrimitiveValueMappings.h
M Source/WebCore/css/htmlSwitchControl.css
M Source/WebCore/html/CheckboxInputType.cpp
M Source/WebCore/html/HTMLInputElement.cpp
M Source/WebCore/platform/graphics/controls/ControlFactory.h
A Source/WebCore/platform/graphics/controls/SwitchThumbPart.h
A Source/WebCore/platform/graphics/controls/SwitchTrackPart.h
M Source/WebCore/platform/graphics/ios/controls/ControlFactoryIOS.h
M Source/WebCore/platform/graphics/ios/controls/ControlFactoryIOS.mm
M Source/WebCore/platform/graphics/mac/controls/ControlFactoryMac.h
M Source/WebCore/platform/graphics/mac/controls/ControlFactoryMac.mm
M Source/WebCore/platform/graphics/mac/controls/ControlMac.h
M Source/WebCore/platform/graphics/mac/controls/ControlMac.mm
A Source/WebCore/platform/graphics/mac/controls/SwitchMacUtilities.h
A Source/WebCore/platform/graphics/mac/controls/SwitchMacUtilities.mm
A Source/WebCore/platform/graphics/mac/controls/SwitchThumbMac.h
A Source/WebCore/platform/graphics/mac/controls/SwitchThumbMac.mm
A Source/WebCore/platform/graphics/mac/controls/SwitchTrackMac.h
A Source/WebCore/platform/graphics/mac/controls/SwitchTrackMac.mm
M Source/WebCore/platform/graphics/mac/controls/TextAreaMac.mm
M Source/WebCore/platform/mac/ThemeMac.mm
M Source/WebCore/rendering/RenderTheme.cpp
M Source/WebCore/rendering/RenderThemeMac.mm
M Source/WebCore/style/StyleAppearance.cpp
M Source/WebCore/style/StyleAppearance.h
M Source/WebKit/Shared/WebCoreArgumentCoders.cpp
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
Log Message:
-----------
Add <input type=checkbox switch> macOS implementation
https://bugs.webkit.org/show_bug.cgi?id=263372
rdar://117199685
Reviewed by Aditya Keerthi.
Add a macOS implementation that has these known shortcomings:
- There's no animation support.
- There's no focus support.
- There's no support for dragging the thumb.
Also correct an issue with m_hasSwitchAttribute invalidation. An early
return could be triggered when modifying the control through Web
Inspector which then resulted in the state not being updated correctly.
This builds on excellent prototyping work done by Lily Spiniolas. And
also greatly benefited from the advice and guidance of Aditya, Elika,
and Wenson.
Tests have been added in 270176 at main and tests added here are upstreamed
via https://github.com/web-platform-tests/wpt/pull/42945.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-type-checkbox-switch.tentative.window-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-type-checkbox-switch.tentative.window.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-type-checkbox-switch.tentative.window.js: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/input-checkbox-switch.tentative.window-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/input-checkbox-switch.tentative.window.js:
* Source/WebCore/Headers.cmake:
* Source/WebCore/PAL/pal/spi/mac/CoreUISPI.h:
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/css/CSSPrimitiveValueMappings.h:
(WebCore::toCSSValueID):
* Source/WebCore/css/htmlSwitchControl.css:
(@namespace "http://www.w3.org/1999/xhtml";):
(input[type="checkbox"][switch]::thumb, input[type="checkbox"][switch]::track):
* Source/WebCore/html/CheckboxInputType.cpp:
(WebCore::CheckboxInputType::valueMissingText const):
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::attributeChanged):
* Source/WebCore/platform/graphics/controls/ControlFactory.h:
* Source/WebCore/platform/graphics/controls/SwitchThumbPart.h: Added.
* Source/WebCore/platform/graphics/controls/SwitchTrackPart.h: Added.
* Source/WebCore/platform/graphics/ios/controls/ControlFactoryIOS.h:
* Source/WebCore/platform/graphics/ios/controls/ControlFactoryIOS.mm:
(WebCore::ControlFactoryIOS::createPlatformSwitchThumb):
(WebCore::ControlFactoryIOS::createPlatformSwitchTrack):
* Source/WebCore/platform/graphics/mac/controls/ControlFactoryMac.h:
* Source/WebCore/platform/graphics/mac/controls/ControlFactoryMac.mm:
(WebCore::ControlFactoryMac::createPlatformSwitchThumb):
(WebCore::ControlFactoryMac::createPlatformSwitchTrack):
* Source/WebCore/platform/graphics/mac/controls/ControlMac.h:
* Source/WebCore/platform/graphics/mac/controls/ControlMac.mm:
(WebCore::ControlMac::userPrefersWithoutColorDifferentiation):
* Source/WebCore/platform/graphics/mac/controls/SwitchMacUtilities.h: Added.
* Source/WebCore/platform/graphics/mac/controls/SwitchMacUtilities.mm: Added.
(WebCore::SwitchMacUtilities::cellSize):
(WebCore::SwitchMacUtilities::cellOutsets):
(WebCore::SwitchMacUtilities::rectForBounds):
(WebCore::SwitchMacUtilities::coreUISizeForControlSize):
* Source/WebCore/platform/graphics/mac/controls/SwitchThumbMac.h: Added.
* Source/WebCore/platform/graphics/mac/controls/SwitchThumbMac.mm: Added.
(WebCore::SwitchThumbMac::SwitchThumbMac):
(WebCore::SwitchThumbMac::cellSize const):
(WebCore::SwitchThumbMac::cellOutsets const):
(WebCore::SwitchThumbMac::rectForBounds const):
(WebCore::SwitchThumbMac::draw):
* Source/WebCore/platform/graphics/mac/controls/SwitchTrackMac.h: Added.
* Source/WebCore/platform/graphics/mac/controls/SwitchTrackMac.mm: Added.
(WebCore::SwitchTrackMac::SwitchTrackMac):
(WebCore::SwitchTrackMac::cellSize const):
(WebCore::SwitchTrackMac::cellOutsets const):
(WebCore::SwitchTrackMac::rectForBounds const):
(WebCore::SwitchTrackMac::draw):
* Source/WebCore/platform/graphics/mac/controls/TextAreaMac.mm:
* Source/WebCore/platform/mac/ThemeMac.mm:
(WebCore::switchSizes):
(WebCore::switchMargins):
(WebCore::switchSize):
(WebCore::ThemeMac::controlSize const):
(WebCore::ThemeMac::inflateControlPaintRect const):
* Source/WebCore/rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):
(WebCore::RenderTheme::autoAppearanceForElement const):
(WebCore::RenderTheme::createControlPart const):
* Source/WebCore/rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::canPaint const):
(WebCore::RenderThemeMac::canCreateControlPartForRenderer const):
(WebCore::RenderThemeMac::adjustRepaintRect):
* Source/WebCore/style/StyleAppearance.cpp:
(WebCore::operator<<):
* Source/WebCore/style/StyleAppearance.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<ControlPart>::encode):
(IPC::ArgumentCoder<ControlPart>::decode):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
Canonical link: https://commits.webkit.org/270342@main
More information about the webkit-changes
mailing list