[webkit-changes] [WebKit/WebKit] b39199: formDisabledCallback() sometimes fires even when d...

EWS noreply at github.com
Wed Jan 25 10:41:59 PST 2023


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

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/form-disabled-callback-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/form-disabled-callback.html
    M Source/WebCore/html/HTMLFieldSetElement.cpp
    M Source/WebCore/html/HTMLFieldSetElement.h
    M Source/WebCore/html/ValidatedFormListedElement.cpp
    M Source/WebCore/html/ValidatedFormListedElement.h

  Log Message:
  -----------
  formDisabledCallback() sometimes fires even when disabled-ness hasn't changed
https://bugs.webkit.org/show_bug.cgi?id=251097

Reviewed by Ryosuke Niwa.

This change:

1. Replaces disabledAttributeChanged() hook, which was only used by <fieldset>,
   with hasDisabledAttribute() protected method, removing a virtual call
   and reducing sizeof(HTMLFieldSetElement) by 8.
2. Extracts setDisabledInternal() so that disabledStateChanged() hook is called
   only when disabled-ness is actually changed, always taking into account
   m_disabledByAncestorFieldset.

The latter wasn't a huge issue before form-associated custom elements were introduced,
whose disabledAttributeChanged() calls into userland JS code, yet even apart from that,
this change eliminates redundant work for native controls and even makes psedo-class
invalidation more precise, reducing matches{Valid,Invalid}PseudoClass() calls.

Also, moving the pseudo-class invalidation into a single function paves the way for
a follow-up patch that will invalidate a few more selectors to match the spec.

Aligns WebKit with Blink and Gecko.

* LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/form-disabled-callback-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/form-associated/form-disabled-callback.html:
* Source/WebCore/html/HTMLFieldSetElement.cpp:
(WebCore::HTMLFieldSetElement::~HTMLFieldSetElement):
(WebCore::HTMLFieldSetElement::parseAttribute):
(WebCore::HTMLFieldSetElement::didMoveToNewDocument):
(WebCore::HTMLFieldSetElement::disabledAttributeChanged): Deleted.
* Source/WebCore/html/HTMLFieldSetElement.h:
* Source/WebCore/html/ValidatedFormListedElement.cpp:
(WebCore::ValidatedFormListedElement::setDisabledByAncestorFieldset):
(WebCore::ValidatedFormListedElement::setDisabledInternal):
(WebCore::ValidatedFormListedElement::parseDisabledAttribute):
(WebCore::ValidatedFormListedElement::syncWithFieldsetAncestors):
(WebCore::ValidatedFormListedElement::removedFromAncestor):
(WebCore::ValidatedFormListedElement::disabledAttributeChanged): Deleted.
* Source/WebCore/html/ValidatedFormListedElement.h:
(WebCore::ValidatedFormListedElement::hasDisabledAttribute const):

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




More information about the webkit-changes mailing list