[webkit-changes] [WebKit/WebKit] 8bc1b9: Remove HTMLElement::form() and de-virtualize the m...

EWS noreply at github.com
Wed Jan 4 07:04:51 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8bc1b9f068aa6256966efb5c40963ebd8009a87c
      https://github.com/WebKit/WebKit/commit/8bc1b9f068aa6256966efb5c40963ebd8009a87c
  Author: Alexey Shvayka <ashvayka at apple.com>
  Date:   2023-01-04 (Wed, 04 Jan 2023)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/compile-event-handler-lexical-scopes-form-owner-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/compile-event-handler-lexical-scopes-form-owner.html
    M Source/WebCore/bindings/js/JSHTMLElementCustom.cpp
    M Source/WebCore/html/HTMLElement.cpp
    M Source/WebCore/html/HTMLElement.h
    M Source/WebCore/html/HTMLFormControlElement.cpp
    M Source/WebCore/html/HTMLFormControlElement.h
    M Source/WebCore/html/HTMLFormElement.cpp
    M Source/WebCore/html/HTMLFormElement.h
    M Source/WebCore/html/HTMLImageElement.h
    M Source/WebCore/html/HTMLLabelElement.h
    M Source/WebCore/html/HTMLLegendElement.h
    M Source/WebCore/html/HTMLObjectElement.h
    M Source/WebCore/html/HTMLOptionElement.h

  Log Message:
  -----------
  Remove HTMLElement::form() and de-virtualize the method
https://bugs.webkit.org/show_bug.cgi?id=248880

Reviewed by Ryosuke Niwa.

De-virtualization of form() speeds up HTMLFormControlElement,
removes method forwarding from form-associated elements, and
exposes 2 issues:

  1. HTMLFormElement::shouldAutocorrect() attempted to access
     form() on a <form> element, which doesn't make sense as
     nested forms are not allowed by HTML [1].

     Removed in favor of now identical HTMLElement::shouldAutocorrect(),
     resolving a few FIXMEs.

  2. Per spec [2], JSHTMLElement::pushEventHandlerScope() should
     set up HTMLFormElement's lexical scope only for form-associated
     elements rather than all <form> descendants.

     This speeds up inline event handler compilation / execution and
     aligns WebKit with Blink and partly Gecko.

[1] https://html.spec.whatwg.org/multipage/forms.html#the-form-element (content model)
[2] https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler (step 3.5)

* Source/WebCore/bindings/js/JSHTMLElementCustom.cpp:
(WebCore::JSHTMLElement::pushEventHandlerScope const):
* Source/WebCore/html/HTMLElement.cpp:
(WebCore::HTMLElement::form const): Deleted.
* Source/WebCore/html/HTMLElement.h:
* Source/WebCore/html/HTMLFormControlElement.cpp:
* Source/WebCore/html/HTMLFormControlElement.h:
* Source/WebCore/html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::formElementIndex):
(WebCore::HTMLFormElement::shouldAutocorrect const): Deleted.
* Source/WebCore/html/HTMLFormElement.h:
* Source/WebCore/html/HTMLImageElement.h:
* Source/WebCore/html/HTMLLabelElement.h:
* Source/WebCore/html/HTMLLegendElement.h:
* Source/WebCore/html/HTMLObjectElement.h:
* Source/WebCore/html/HTMLOptionElement.h:
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/compile-event-handler-lexical-scopes-form-owner-expected.txt
* LayoutTests/imported/w3c/web-platform-tests/html/webappapis/scripting/events/compile-event-handler-lexical-scopes-form-owner.html

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




More information about the webkit-changes mailing list