[webkit-changes] [WebKit/WebKit] 0a064d: Fire selectionchange event on input and textarea e...

Ryosuke Niwa noreply at github.com
Sat Mar 16 01:24:55 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0a064d401bd0a68d148be77d03cb3c157188c04b
      https://github.com/WebKit/WebKit/commit/0a064d401bd0a68d148be77d03cb3c157188c04b
  Author: Ryosuke Niwa <rniwa at webkit.org>
  Date:   2024-03-16 (Sat, 16 Mar 2024)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/selection/textcontrols/selectionchange-bubble-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/selection/textcontrols/selectionchange-expected.txt
    A LayoutTests/platform/gtk/imported/w3c/web-platform-tests/selection/textcontrols/selectionchange-expected.txt
    M Source/WebCore/editing/FrameSelection.cpp
    M Source/WebCore/html/HTMLTextAreaElement.cpp
    M Source/WebCore/html/HTMLTextFormControlElement.cpp
    M Source/WebCore/html/HTMLTextFormControlElement.h

  Log Message:
  -----------
  Fire selectionchange event on input and textarea elements
https://bugs.webkit.org/show_bug.cgi?id=271033

Reviewed by Sihui Liu and Wenson Hsieh.

This PR updates the implementation of selectionchange event to be fired on input element and textarea
element instead of document whenever either real selection or cached selection offsets have been updated
to match the specification: https://w3c.github.io/selection-api/#selectionchange-event

* LayoutTests/imported/w3c/web-platform-tests/selection/textcontrols/selectionchange-bubble-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/selection/textcontrols/selectionchange-expected.txt:
* LayoutTests/platform/gtk/imported/w3c/web-platform-tests/selection/textcontrols/selectionchange-expected.txt: Added.

* Source/WebCore/editing/FrameSelection.cpp:
(WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance): Fire selectionchange event on input
element and textarea element when the selection resides within those elements.

* Source/WebCore/html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::setValueCommon): Fixed a bug that this code was always updating selection
even when TextControlSetValueSelection::DoNotSet is passed in.

* Source/WebCore/html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::selectionChanged): Made this function return a boolean indicating
whether the selection end points have changed or not.

(WebCore::HTMLTextFormControlElement::scheduleSelectEvent):
* Source/WebCore/html/HTMLTextFormControlElement.h:

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list