[webkit-changes] [WebKit/WebKit] 36537b: Form-association for <img> is inconsistent
Ryosuke Niwa
noreply at github.com
Sun Nov 13 20:33:20 PST 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 36537bb39ed82312d1d971018950910fac8b8b6a
https://github.com/WebKit/WebKit/commit/36537bb39ed82312d1d971018950910fac8b8b6a
Author: Ryosuke Niwa <rniwa at webkit.org>
Date: 2022-11-13 (Sun, 13 Nov 2022)
Changed paths:
A LayoutTests/fast/forms/image/image-named-access-expected.txt
A LayoutTests/fast/forms/image/image-named-access.html
M Source/WebCore/html/HTMLFormElement.cpp
M Source/WebCore/html/HTMLImageElement.cpp
M Source/WebCore/html/HTMLImageElement.h
Log Message:
-----------
Form-association for <img> is inconsistent
https://bugs.webkit.org/show_bug.cgi?id=129742
Reviewed by Darin Adler.
This patch updates the way HTMLImageElement associates itself with HTMLFormElement to be more consistent
with FormAssociatedElement. New behavior matches that of Gecko and Blink.
* LayoutTests/fast/forms/image/image-named-access-expected.txt: Added.
* LayoutTests/fast/forms/image/image-named-access.html: Added.
* Source/WebCore/html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::removedFromAncestor):
* Source/WebCore/html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::~HTMLImageElement):
(WebCore::HTMLImageElement::form const): Added. Returns m_form instead of returning the form ancestor.
(WebCore::HTMLImageElement::setForm): Extracted from insertedIntoAncestor. Automatically calls
removeImgElement and registerImgElement.
(WebCore::HTMLImageElement::formOwnerRemovedFromTree): Added. Clear m_form when the associated form element
is no longer in the same subtree as this element.
(WebCore::HTMLImageElement::insertedIntoAncestor): Don't associate this element with a from element set by
the parser if the form had been disconnected like FormAssociatedElement.
(WebCore::HTMLImageElement::removedFromAncestor): Don't remove this element from the form element if
the root node didn't change like FormAssociatedElement.
* Source/WebCore/html/HTMLImageElement.h:
Canonical link: https://commits.webkit.org/256629@main
More information about the webkit-changes
mailing list