Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ae41312593bb58c26c42c74c0f876a6d253ffa23
      
https://github.com/WebKit/WebKit/commit/ae41312593bb58c26c42c74c0f876a6d253ffa23
  Author: Brady Eidson <beid...@apple.com>
  Date:   2025-07-02 (Wed, 02 Jul 2025)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/Element.h
    M Source/WebCore/dom/KeyboardEvent.cpp
    M Source/WebCore/dom/KeyboardEvent.h
    M Source/WebCore/html/BaseDateAndTimeInputType.cpp
    M Source/WebCore/html/BaseDateAndTimeInputType.h
    M Source/WebCore/html/ColorInputType.cpp
    M Source/WebCore/html/ColorInputType.h
    M Source/WebCore/html/HTMLAnchorElement.cpp
    M Source/WebCore/html/HTMLAnchorElement.h
    M Source/WebCore/html/HTMLAreaElement.cpp
    M Source/WebCore/html/HTMLAreaElement.h
    M Source/WebCore/html/HTMLFormControlElement.cpp
    M Source/WebCore/html/HTMLFormControlElement.h
    M Source/WebCore/html/HTMLFrameOwnerElement.cpp
    M Source/WebCore/html/HTMLFrameOwnerElement.h
    M Source/WebCore/html/HTMLInputElement.cpp
    M Source/WebCore/html/HTMLInputElement.h
    M Source/WebCore/html/HTMLPlugInElement.cpp
    M Source/WebCore/html/HTMLPlugInElement.h
    M Source/WebCore/html/HTMLSelectElement.cpp
    M Source/WebCore/html/HTMLSelectElement.h
    M Source/WebCore/html/HTMLTextAreaElement.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/TextFieldInputType.cpp
    M Source/WebCore/html/TextFieldInputType.h
    M Source/WebCore/mathml/MathMLElement.cpp
    M Source/WebCore/mathml/MathMLElement.h
    M Source/WebCore/page/EventHandler.cpp
    M Source/WebCore/page/EventHandler.h
    M Source/WebCore/page/FocusController.cpp
    M Source/WebCore/page/FocusController.h
    A Source/WebCore/page/FocusEventData.h
    M Source/WebCore/svg/SVGAElement.cpp
    M Source/WebCore/svg/SVGAElement.h

  Log Message:
  -----------
  For element focus decisions (e.g FocusController and related), use a new 
limited data structure instead of KeyboardEvent
rdar://154911405
https://bugs.webkit.org/show_bug.cgi?id=295376

Reviewed by Alex Christensen.

When advancing focus for <tab> key presses, FocusController uses the initiating 
`KeyboardEvent` at various points
for decision making.

`KeyboardEvent` is a deceptively large and complicated class at the top of a 
complicated class hierarchy,
but the `FocusController` decision making uses a trivial number of its data 
members.

Tabbing to advance focus works across iframes, which means with site isolation 
it works across WebContent processes.
Which means the `FocusController` objects in various processes all need 
information about that initiating event.

One approach would have been to serialize full fidelity `KeyboardEvent` objects.

Instead, the approach in this patch is to refactor everywhere that looks at the 
`KeyboardEvent` to instead look
at a new data structure that is limited to only the required data members and 
will be trivial to serialize.

With site isolation or without, this should have no change in behavior.

* Source/WebCore/dom/Element.cpp:
(WebCore::Element::isKeyboardFocusable const):
(WebCore::Element::findFocusDelegateForTarget):
* Source/WebCore/dom/Element.h:
* Source/WebCore/dom/KeyboardEvent.cpp:
(WebCore::KeyboardEvent::focusEventData const):
* Source/WebCore/dom/KeyboardEvent.h:
* Source/WebCore/html/BaseDateAndTimeInputType.cpp:
(WebCore::BaseDateAndTimeInputType::isKeyboardFocusable const):
* Source/WebCore/html/BaseDateAndTimeInputType.h:
* Source/WebCore/html/ColorInputType.cpp:
(WebCore::ColorInputType::isKeyboardFocusable const):
* Source/WebCore/html/ColorInputType.h:
* Source/WebCore/html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::isKeyboardFocusable const):
* Source/WebCore/html/HTMLAnchorElement.h:
* Source/WebCore/html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::isKeyboardFocusable const):
* Source/WebCore/html/HTMLAreaElement.h:
* Source/WebCore/html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::isKeyboardFocusable const):
* Source/WebCore/html/HTMLFormControlElement.h:
* Source/WebCore/html/HTMLFrameOwnerElement.cpp:
(WebCore::HTMLFrameOwnerElement::isKeyboardFocusable const):
* Source/WebCore/html/HTMLFrameOwnerElement.h:
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::isKeyboardFocusable const):
(WebCore::HTMLInputElement::isTextFormControlKeyboardFocusable const):
* Source/WebCore/html/HTMLInputElement.h:
* Source/WebCore/html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::isKeyboardFocusable const):
* Source/WebCore/html/HTMLPlugInElement.h:
* Source/WebCore/html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::isKeyboardFocusable const):
* Source/WebCore/html/HTMLSelectElement.h:
* Source/WebCore/html/HTMLTextAreaElement.h:
* Source/WebCore/html/InputType.cpp:
(WebCore::InputType::isKeyboardFocusable const):
* Source/WebCore/html/InputType.h:
* Source/WebCore/html/RadioInputType.cpp:
(WebCore::RadioInputType::isKeyboardFocusable const):
* Source/WebCore/html/RadioInputType.h:
* Source/WebCore/html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::isKeyboardFocusable const):
* Source/WebCore/html/TextFieldInputType.h:
* Source/WebCore/mathml/MathMLElement.cpp:
(WebCore::MathMLElement::isKeyboardFocusable const):
* Source/WebCore/mathml/MathMLElement.h:
* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::isKeyboardOptionTab):
(WebCore::EventHandler::eventInvertsTabsToLinksClientCallResult):
(WebCore::EventHandler::tabsToLinks const):
(WebCore::EventHandler::tabsToAllFormControls const):
* Source/WebCore/page/EventHandler.h:
* Source/WebCore/page/FocusController.cpp:
(WebCore::isFocusableElementOrScopeOwner):
(WebCore::isNonFocusableScopeOwner):
(WebCore::isFocusableScopeOwner):
(WebCore::shadowAdjustedTabIndex):
(WebCore::FocusController::findFocusableElementDescendingIntoSubframes):
(WebCore::FocusController::advanceFocus):
(WebCore::FocusController::advanceFocusInDocumentOrder):
(WebCore::FocusController::findFocusableElementAcrossFocusScope):
(WebCore::FocusController::findFocusableElementWithinScope):
(WebCore::FocusController::nextFocusableElementWithinScope):
(WebCore::FocusController::previousFocusableElementWithinScope):
(WebCore::FocusController::findFocusableElementOrScopeOwner):
(WebCore::FocusController::findElementWithExactTabIndex):
(WebCore::nextElementWithGreaterTabIndex):
(WebCore::previousElementWithLowerTabIndex):
(WebCore::FocusController::nextFocusableElement):
(WebCore::FocusController::previousFocusableElement):
(WebCore::FocusController::nextFocusableElementOrScopeOwner):
(WebCore::FocusController::previousFocusableElementOrScopeOwner):
(WebCore::FocusController::findFocusCandidateInContainer):
(WebCore::FocusController::advanceFocusDirectionallyInContainer):
(WebCore::FocusController::advanceFocusDirectionally):
* Source/WebCore/page/FocusController.h:
* Source/WebCore/svg/SVGAElement.cpp:
(WebCore::SVGAElement::isKeyboardFocusable const):
* Source/WebCore/svg/SVGAElement.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to