[webkit-changes] [WebKit/WebKit] 26a483: Add <input type=checkbox switch> iOS infrastructure

Anne van Kesteren noreply at github.com
Thu Dec 7 10:30:25 PST 2023


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

  Changed paths:
    M Source/WebCore/PAL/pal/ios/UIKitSoftLink.h
    M Source/WebCore/PAL/pal/ios/UIKitSoftLink.mm
    M Source/WebCore/css/htmlSwitchControl.css
    M Source/WebCore/html/CheckboxInputType.cpp
    M Source/WebCore/html/CheckboxInputType.h
    M Source/WebCore/html/HTMLInputElement.cpp
    M Source/WebCore/html/HTMLInputElement.h
    M Source/WebCore/html/InputType.h
    M Source/WebCore/platform/Theme.h
    M Source/WebCore/platform/ios/ThemeIOS.h
    M Source/WebCore/platform/ios/ThemeIOS.mm
    M Source/WebCore/rendering/RenderTheme.cpp
    M Source/WebCore/rendering/RenderTheme.h
    M Source/WebCore/rendering/RenderThemeIOS.h
    M Source/WebCore/rendering/RenderThemeIOS.mm

  Log Message:
  -----------
  Add <input type=checkbox switch> iOS infrastructure
https://bugs.webkit.org/show_bug.cgi?id=265947

Reviewed by Aditya Keerthi.

This makes the following changes:

- Resets default styling of <input type=checkbox switch> on iOS.
- Adds support for reading the on/off labels preference.
- Adds support for touch-based pointer tracking to CheckboxInputType as
  well as a Pressed animation that can run simultaneously with the
  VisuallyOn animation.
- Make the non-IOS_TOUCH_EVENTS code in HTMLInputElement compatible
  with IOS_TOUCH_EVENTS so events get delivered to CheckboxInputType.
- Adds the relevant hooks to RenderTheme to enable painting on iOS.

* Source/WebCore/PAL/pal/ios/UIKitSoftLink.h:
* Source/WebCore/PAL/pal/ios/UIKitSoftLink.mm:
* Source/WebCore/css/htmlSwitchControl.css:
(#if defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY):
(input[type="checkbox"][switch]:checked):
(input[type="checkbox"][switch]:disabled):
(input[type="checkbox"][switch]:checked:disabled):
* Source/WebCore/html/CheckboxInputType.cpp:
(WebCore::CheckboxInputType::handleMouseDownEvent):
(WebCore::findTouchWithIdentifier):
(WebCore::CheckboxInputType::handleTouchEvent):
(WebCore::CheckboxInputType::startSwitchPointerTracking):
(WebCore::CheckboxInputType::stopSwitchPointerTracking):
(WebCore::CheckboxInputType::disabledStateChanged):
(WebCore::CheckboxInputType::willUpdateCheckedness):
(WebCore::switchAnimationDuration):
(WebCore::CheckboxInputType::switchAnimationStartTime const):
(WebCore::CheckboxInputType::setSwitchAnimationStartTime):
(WebCore::CheckboxInputType::switchAnimationPressedProgress const):
(WebCore::CheckboxInputType::switchAnimationTimerFired):
* Source/WebCore/html/CheckboxInputType.h:
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::~HTMLInputElement):
(WebCore::HTMLInputElement::runPostTypeUpdateTasks):
(WebCore::HTMLInputElement::didMoveToNewDocument):
(WebCore::HTMLInputElement::switchAnimationPressedProgress const):
* Source/WebCore/html/HTMLInputElement.h:
* Source/WebCore/html/InputType.h:
* Source/WebCore/platform/Theme.h:
(WebCore::Theme::userPrefersOnOffLabels const):
* Source/WebCore/platform/ios/ThemeIOS.h:
* Source/WebCore/platform/ios/ThemeIOS.mm:
(WebCore::ThemeIOS::userPrefersOnOffLabels const):
* Source/WebCore/rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):
(WebCore::RenderTheme::paint):
* Source/WebCore/rendering/RenderTheme.h:
(WebCore::RenderTheme::switchAnimationPressedDuration const):
(WebCore::RenderTheme::adjustSwitchStyle const):
(WebCore::RenderTheme::paintSwitchThumb):
(WebCore::RenderTheme::paintSwitchTrack):
* Source/WebCore/rendering/RenderThemeIOS.h:
* Source/WebCore/rendering/RenderThemeIOS.mm:
(WebCore::renderThemePaintSwitchThumb):
(WebCore::renderThemePaintSwitchTrack):
(WebCore::RenderThemeIOS::adjustSwitchStyle const):
(WebCore::RenderThemeIOS::paintSwitchThumb):
(WebCore::RenderThemeIOS::paintSwitchTrack):

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




More information about the webkit-changes mailing list