[webkit-changes] [WebKit/WebKit] 5780ee: HTMLImageElement and FormAssociatedElement should ...

Ryosuke Niwa noreply at github.com
Tue Nov 15 08:52:44 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5780eeea65cd07eaeb33633e80b07c8c2765d2f7
      https://github.com/WebKit/WebKit/commit/5780eeea65cd07eaeb33633e80b07c8c2765d2f7
  Author: Ryosuke Niwa <rniwa at webkit.org>
  Date:   2022-11-15 (Tue, 15 Nov 2022)

  Changed paths:
    M Source/WebCore/dom/Node.h
    M Source/WebCore/html/FormAssociatedElement.h
    M Source/WebCore/html/FormListedElement.cpp
    M Source/WebCore/html/FormListedElement.h
    M Source/WebCore/html/HTMLFormControlElement.cpp
    M Source/WebCore/html/HTMLFormElement.cpp
    M Source/WebCore/html/HTMLImageElement.cpp
    M Source/WebCore/html/HTMLImageElement.h
    M Source/WebCore/html/HTMLObjectElement.cpp
    M Source/WebCore/loader/FormState.cpp
    M Source/WebCore/loader/FormState.h

  Log Message:
  -----------
  HTMLImageElement and FormAssociatedElement should share more code
https://bugs.webkit.org/show_bug.cgi?id=247936

Reviewed by Aditya Keerthi.

This patch makes HTMLImageElement and FormListedElement share more code in FormAssociatedElement.
m_form and m_formSetByParser are moved from those two classes to FormAssociatedElement along with
some logic to update the associated form.

* Source/WebCore/dom/Node.h:
* Source/WebCore/html/FormAssociatedElement.h:
(WebCore::FormAssociatedElement::~FormAssociatedElement): Moved the release assertion from
FormListedElement::~FormListedElement.
(WebCore::FormAssociatedElement::formWillBeDestroyed): Added.
(WebCore::FormAssociatedElement::form const): Added.
(WebCore::FormAssociatedElement::FormAssociatedElement): Added.
(WebCore::FormAssociatedElement::setForm): Added.
(WebCore::FormAssociatedElement::setFormInternal): Added.
(WebCore::FormAssociatedElement::elementInsertedIntoAncestor): Added.
(WebCore::FormAssociatedElement::elementRemovedFromAncestor): Added.

* Source/WebCore/html/FormListedElement.cpp:
(WebCore::FormListedElement::FormListedElement):
(WebCore::FormListedElement::~FormListedElement): Deleted.
(WebCore::FormListedElement::elementInsertedIntoAncestor): Renamed from insertedIntoAncestor.
Also takes the element and InsertionType as arguments.
(WebCore::FormListedElement::elementRemovedFromAncestor): Ditto from removedFromAncestor.
(WebCore::FormListedElement::form const): Deleted.
(WebCore::FormListedElement::formOwnerRemovedFromTree):
(WebCore::FormListedElement::setFormInternal): Extracted from the old setForm, which has been
moved to FormAssociatedElement.
(WebCore::FormListedElement::formWillBeDestroyed):
(WebCore::FormListedElement::resetFormOwner):
(WebCore::FormListedElement::formAttributeChanged):
(WebCore::FormListedElement::setForm): Deleted.

* Source/WebCore/html/FormListedElement.h:
(WebCore::FormListedElement::clearForm):

* Source/WebCore/html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::insertedIntoAncestor):
(WebCore::HTMLFormControlElement::removedFromAncestor):

* Source/WebCore/html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::~HTMLFormElement): Call formWillBeDestroyed instead of directly
updating HTMLImageElement's private member variable.

* Source/WebCore/html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::HTMLImageElement):
(WebCore::HTMLImageElement::form const): Deleted.
(WebCore::HTMLImageElement::resetFormOwner): Added.
(WebCore::HTMLImageElement::setFormInternal): Renamed from setForm.
(WebCore::HTMLImageElement::insertedIntoAncestor):
(WebCore::HTMLImageElement::removedFromAncestor):

* Source/WebCore/html/HTMLImageElement.h:

* Source/WebCore/html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::insertedIntoAncestor):
(WebCore::HTMLObjectElement::removedFromAncestor):

* Source/WebCore/loader/FormState.cpp:

* Source/WebCore/loader/FormState.h:

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




More information about the webkit-changes mailing list