[webkit-changes] [WebKit/WebKit] 7da094: The beforeinput event should fire before textInput

sideshowbarker noreply at github.com
Sun May 19 15:44:16 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7da094e1da191c5d59b9abe0125e4bd9746b9ec2
      https://github.com/WebKit/WebKit/commit/7da094e1da191c5d59b9abe0125e4bd9746b9ec2
  Author: Michael[tm] Smith <mike at w3.org>
  Date:   2024-05-19 (Sun, 19 May 2024)

  Changed paths:
    M LayoutTests/editing/execCommand/break-out-of-empty-list-item.html
    M LayoutTests/editing/inserting/typing-space-to-trigger-smart-link.html
    M LayoutTests/editing/pasteboard/paste-text-events-expected.txt
    M LayoutTests/editing/pasteboard/paste-text-events.html
    M LayoutTests/editing/style/highlight-insert-paragraph.html
    M LayoutTests/fast/events/input-events-fired-when-typing-expected.txt
    M LayoutTests/fast/events/input-events-fired-when-typing.html
    M LayoutTests/fast/events/ios/submit-form-target-blank-using-return-key.html
    M LayoutTests/fast/events/onchange-passwordfield.html
    M LayoutTests/fast/events/onchange-searchfield.html
    M LayoutTests/fast/events/onchange-textfield.html
    M LayoutTests/fast/forms/onchange-change-type.html
    M LayoutTests/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt
    M LayoutTests/http/tests/navigation/keyboard-events-during-provisional-subframe-navigation-expected.txt
    M LayoutTests/platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt
    M LayoutTests/platform/wpe/TestExpectations
    M Source/WebCore/dom/Node.cpp
    M Source/WebCore/dom/TextEvent.cpp
    M Source/WebCore/dom/TextEvent.h
    M Source/WebCore/editing/AlternativeTextController.cpp
    M Source/WebCore/editing/Editor.cpp
    M Source/WebCore/editing/Editor.h
    M Source/WebCore/editing/EditorCommand.cpp
    M Source/WebCore/page/EventHandler.cpp
    M Source/WebCore/page/EventHandler.h

  Log Message:
  -----------
  The beforeinput event should fire before textInput
https://bugs.webkit.org/show_bug.cgi?id=268988

Reviewed by Wenson Hsieh and Ryosuke Niwa.

This change makes WebKit fire the beforeinput & textInput events in the
order (beforeinput first, textInput after) conforming to UI Events spec
requirements at https://github.com/w3c/uievents/pull/362 and in the spec at
https://w3c.github.io/uievents/event-algo.html#fire%20key%20input%20events
and consistent with the order in which the events are fired in Blink.

Otherwise, without this change, WebKit fires the events in an order
(textInput first, beforeinput after) that breaks conformance with
the spec requirements, and that breaks compatibility with Blink.

Note also that this change makes WebKit conform to the requirements in
https://w3c.github.io/uievents/event-algo.html#fire%20key%20input%20events,
https://w3c.github.io/uievents/event-algo.html#handle%20native%20paste, and
https://w3c.github.io/uievents/event-algo.html#end%20composition — limiting
textInput to being fired only when ending a composition or when the input
type is insertText, insertParagraph, insertLineBreak, or insertFromPaste.

* LayoutTests/editing/execCommand/break-out-of-empty-list-item.html:
* LayoutTests/editing/inserting/typing-space-to-trigger-smart-link.html:
* LayoutTests/editing/pasteboard/paste-text-events-expected.txt:
* LayoutTests/editing/pasteboard/paste-text-events.html:
* LayoutTests/editing/style/highlight-insert-paragraph.html:
* LayoutTests/fast/events/input-events-fired-when-typing-expected.txt:
* LayoutTests/fast/events/input-events-fired-when-typing.html:
* LayoutTests/fast/events/ios/submit-form-target-blank-using-return-key.html:
* LayoutTests/fast/events/onchange-passwordfield.html:
* LayoutTests/fast/events/onchange-searchfield.html:
* LayoutTests/fast/events/onchange-textfield.html:
* LayoutTests/fast/forms/onchange-change-type.html:
* LayoutTests/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt:
* LayoutTests/http/tests/navigation/keyboard-events-during-provisional-subframe-navigation-expected.txt:
* LayoutTests/platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt:
* LayoutTests/platform/wpe/TestExpectations:
* Source/WebCore/dom/Node.cpp:
(WebCore::Node::defaultEventHandler):
* Source/WebCore/dom/TextEvent.cpp:
(WebCore::TextEvent::TextEvent):
(WebCore::TextEvent::initTextEvent):
(WebCore::TextEvent::createForPlainTextPaste): Deleted.
(WebCore::TextEvent::createForFragmentPaste): Deleted.
(WebCore::TextEvent::createForDictation): Deleted.
* Source/WebCore/dom/TextEvent.h:
* Source/WebCore/editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::insertDictatedText):
* Source/WebCore/editing/Editor.cpp:
(WebCore::dispatchTextInputEvent):
(WebCore::Editor::selectionForCommand):
(WebCore::Editor::pasteAsPlainText):
(WebCore::Editor::pasteAsFragment):
(WebCore::dispatchTextInputEvents):
(WebCore::Editor::appliedEditing):
(WebCore::Editor::insertText):
(WebCore::Editor::insertTextForConfirmedComposition):
(WebCore::Editor::insertTextWithoutSendingTextEvent):
(WebCore::Editor::setComposition):
(WebCore::Editor::handleTextEvent): Deleted.
* Source/WebCore/editing/Editor.h:
* Source/WebCore/editing/EditorCommand.cpp:
(WebCore::executeInsertBacktab):
(WebCore::executeInsertLineBreak):
(WebCore::executeInsertNewline):
(WebCore::executeInsertTab):
(WebCore::executeYank):
(WebCore::executeYankAndSelect):
(WebCore::enabledVisibleSelection):
(WebCore::enabledVisibleSelectionAndMark):
(WebCore::enableCaretInEditableText):
(WebCore::enabledInEditableText):
* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::handleTextInput):
(WebCore::EventHandler::handleTextInputEvent): Deleted.
(WebCore::EventHandler::defaultTextInputEventHandler): Deleted.
* Source/WebCore/page/EventHandler.h:

Canonical link: https://commits.webkit.org/278971@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