Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 870a0515b649fa5462225fbf33a150e41f1827b5
      
https://github.com/WebKit/WebKit/commit/870a0515b649fa5462225fbf33a150e41f1827b5
  Author: Anne van Kesteren <[email protected]>
  Date:   2023-12-05 (Tue, 05 Dec 2023)

  Changed paths:
    A LayoutTests/fast/forms/switch/pointer-tracking-disabled-expected.html
    A LayoutTests/fast/forms/switch/pointer-tracking-disabled.html
    A LayoutTests/fast/forms/switch/pointer-tracking-expected-mismatch.html
    A 
LayoutTests/fast/forms/switch/pointer-tracking-there-and-back-again-expected.html
    A 
LayoutTests/fast/forms/switch/pointer-tracking-there-and-back-again-rtl-expected.html
    A 
LayoutTests/fast/forms/switch/pointer-tracking-there-and-back-again-rtl.html
    A LayoutTests/fast/forms/switch/pointer-tracking-there-and-back-again.html
    A LayoutTests/fast/forms/switch/pointer-tracking.html
    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.cpp
    M Source/WebCore/html/InputType.h
    M Source/WebCore/html/RadioInputType.cpp
    M Source/WebCore/html/RadioInputType.h
    M Source/WebCore/html/RangeInputType.cpp
    M Source/WebCore/platform/graphics/controls/SwitchThumbPart.h
    M Source/WebCore/platform/graphics/controls/SwitchTrackPart.h
    M Source/WebCore/platform/graphics/mac/controls/SwitchThumbMac.mm
    M Source/WebCore/platform/graphics/mac/controls/SwitchTrackMac.mm
    M Source/WebCore/rendering/RenderTheme.cpp
    M Source/WebCore/rendering/RenderTheme.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in

  Log Message:
  -----------
  Add <input type=checkbox switch> pointer tracking
https://bugs.webkit.org/show_bug.cgi?id=265658

Reviewed by Aditya Keerthi.

This change enables the switch's thumb to be "dragged" left and right.

This requires the introduction of a visual on/off state as actual state
changes, i.e., to checkedness, are only made after the tracking stops.
As such we simplify RenderTheme::isChecked() back to how it was before
we started adding <input type=checkbox switch> as switches don't need
it.

Despite what 271327@main claimed this change makes CheckboxInputType
solely responsible for performSwitchCheckedChangeAnimation(). This
works by passing along the event's isTrusted() bit to
willUpdateCheckedness() and instead stopping the animation from there.

A future change might have to abstract some of the logic in
CheckboxInputType::handleMouseMoveEvent() somewhat as more platforms
become supported.

A difference with macOS switches is that these remain active/pressed
and responsive to mouseup events while tracking is ongoing. This
difference with is also there for checkboxes and radio buttons.

* LayoutTests/fast/forms/switch/pointer-tracking-disabled-expected.html: Added.
* LayoutTests/fast/forms/switch/pointer-tracking-disabled.html: Added.
* LayoutTests/fast/forms/switch/pointer-tracking-expected-mismatch.html: Added.
* 
LayoutTests/fast/forms/switch/pointer-tracking-there-and-back-again-expected.html:
 Added.
* 
LayoutTests/fast/forms/switch/pointer-tracking-there-and-back-again-rtl-expected.html:
 Added.
* LayoutTests/fast/forms/switch/pointer-tracking-there-and-back-again-rtl.html: 
Added.
* LayoutTests/fast/forms/switch/pointer-tracking-there-and-back-again.html: 
Added.
* LayoutTests/fast/forms/switch/pointer-tracking.html: Added.
* Source/WebCore/html/CheckboxInputType.cpp:
(WebCore::CheckboxInputType::handleMouseDownEvent):
(WebCore::CheckboxInputType::handleMouseMoveEvent):
(WebCore::CheckboxInputType::willDispatchClick):
(WebCore::CheckboxInputType::startSwitchPointerTracking):
(WebCore::CheckboxInputType::stopSwitchPointerTracking):
(WebCore::CheckboxInputType::isSwitchPointerTracking const):
(WebCore::CheckboxInputType::disabledStateChanged):
(WebCore::CheckboxInputType::willUpdateCheckedness):
(WebCore::CheckboxInputType::performSwitchCheckedChangeAnimation):
(WebCore::CheckboxInputType::isSwitchVisuallyOn const):
* Source/WebCore/html/CheckboxInputType.h:
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setChecked):
(WebCore::HTMLInputElement::defaultEventHandler):
(WebCore::HTMLInputElement::switchCheckedChangeAnimationProgress const):
(WebCore::HTMLInputElement::isSwitchVisuallyOn const):
* Source/WebCore/html/HTMLInputElement.h:
* Source/WebCore/html/InputType.cpp:
(WebCore::InputType::handleClickEvent): Deleted.
(WebCore::InputType::handleMouseDownEvent): Deleted.
(WebCore::InputType::handleDOMActivateEvent): Deleted.
(WebCore::InputType::willDispatchClick): Deleted.
(WebCore::InputType::didDispatchClick): Deleted.
* Source/WebCore/html/InputType.h:
(WebCore::InputType::handleClickEvent):
(WebCore::InputType::handleMouseDownEvent):
(WebCore::InputType::handleMouseMoveEvent):
(WebCore::InputType::willDispatchClick):
(WebCore::InputType::didDispatchClick):
(WebCore::InputType::handleDOMActivateEvent):
(WebCore::InputType::willUpdateCheckedness):
* Source/WebCore/html/RadioInputType.cpp:
(WebCore::RadioInputType::willUpdateCheckedness):
* Source/WebCore/html/RadioInputType.h:
* Source/WebCore/html/RangeInputType.cpp:
(WebCore::RangeInputType::handleMouseDownEvent):
* Source/WebCore/platform/graphics/controls/SwitchThumbPart.h:
* Source/WebCore/platform/graphics/controls/SwitchTrackPart.h:
* Source/WebCore/platform/graphics/mac/controls/SwitchThumbMac.mm:
(WebCore::SwitchThumbMac::draw):
* Source/WebCore/platform/graphics/mac/controls/SwitchTrackMac.mm:
(WebCore::SwitchTrackMac::draw):
* Source/WebCore/rendering/RenderTheme.cpp:
(WebCore::updateSwitchThumbPartForRenderer):
(WebCore::updateSwitchTrackPartForRenderer):
(WebCore::RenderTheme::isChecked const):
* Source/WebCore/rendering/RenderTheme.h:
(WebCore::RenderTheme::switchPointerTrackingMagnitudeProportion const):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to