[webkit-changes] [WebKit/WebKit] c2e702: Correct <input type=checkbox switch> animation cor...

Anne van Kesteren noreply at github.com
Wed Nov 29 22:41:44 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c2e7027de483cb5d51dd8a79965e10a4851ebc52
      https://github.com/WebKit/WebKit/commit/c2e7027de483cb5d51dd8a79965e10a4851ebc52
  Author: Anne van Kesteren <annevk at annevk.nl>
  Date:   2023-11-29 (Wed, 29 Nov 2023)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/fast/forms/switch/click-animation-disabled-expected.html
    A LayoutTests/fast/forms/switch/click-animation-disabled.html
    A LayoutTests/fast/forms/switch/click-animation-expected-mismatch.html
    A LayoutTests/fast/forms/switch/click-animation-interrupted-document-removed-expected.html
    A LayoutTests/fast/forms/switch/click-animation-interrupted-document-removed.html
    A LayoutTests/fast/forms/switch/click-animation-interrupted-expected.html
    A LayoutTests/fast/forms/switch/click-animation-interrupted-type-change-expected.html
    A LayoutTests/fast/forms/switch/click-animation-interrupted-type-change.html
    A LayoutTests/fast/forms/switch/click-animation-interrupted.html
    A LayoutTests/fast/forms/switch/click-animation-preventdefault-expected.html
    A LayoutTests/fast/forms/switch/click-animation-preventdefault.html
    A LayoutTests/fast/forms/switch/click-animation-redundant-checked-expected-mismatch.html
    A LayoutTests/fast/forms/switch/click-animation-redundant-checked.html
    A LayoutTests/fast/forms/switch/click-animation-redundant-disabled-expected-mismatch.html
    A LayoutTests/fast/forms/switch/click-animation-redundant-disabled.html
    A LayoutTests/fast/forms/switch/click-animation-twice-expected.html
    A LayoutTests/fast/forms/switch/click-animation-twice-fast-expected.html
    A LayoutTests/fast/forms/switch/click-animation-twice-fast.html
    A LayoutTests/fast/forms/switch/click-animation-twice.html
    A LayoutTests/fast/forms/switch/click-animation.html
    M LayoutTests/platform/mac/TestExpectations
    M Source/WebCore/html/CheckboxInputType.cpp
    M Source/WebCore/html/CheckboxInputType.h

  Log Message:
  -----------
  Correct <input type=checkbox switch> animation corner case and add tests
https://bugs.webkit.org/show_bug.cgi?id=265356

Reviewed by Aditya Keerthi.

I've decided on the following things:

* When an animation is running and setChecked() is called with the same
  value the animation is running for, the animation continues to run.
  As such we do not modify the early return in setChecked() for when
  the state does not change unlike an earlier iteration of this change.
* When an animation is running and the checked or disabled state
  changes underneath, the animation is stopped.

Stopping the animation is abstracted into a method for clarity.

Test coverage is added for these scenarios and a couple more to reduce
the chances of regressions when refactoring in the future.

I also want to mention here that I strongly considered an alternative
approach whereby CheckboxInputType would be solely responsible for
calling performSwitchCheckedChangeAnimation() right after it calls
setChecked(), but setChecked() can invalidate or reverse an animation
and I could not find a good way to integrate that behavior.

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




More information about the webkit-changes mailing list