[webkit-changes] [WebKit/WebKit] 0e0b99: Attribute-dependent state is not updated for chang...

Tyler Wilcock noreply at github.com
Sat Apr 15 20:33:31 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0e0b997d27631c8e4680e6936f09a6a0367ef8ec
      https://github.com/WebKit/WebKit/commit/0e0b997d27631c8e4680e6936f09a6a0367ef8ec
  Author: Tyler Wilcock <tyler_w at apple.com>
  Date:   2023-04-15 (Sat, 15 Apr 2023)

  Changed paths:
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/Element.h

  Log Message:
  -----------
  Attribute-dependent state is not updated for changes of certain attributes
https://bugs.webkit.org/show_bug.cgi?id=255478
rdar://problem/108078305

Reviewed by Chris Dumez.

Several methods are called in Element::attributeChanged with the expectation that this
method will actually be called for every attribute change:

https://github.com/WebKit/WebKit/blob/c5b51dbe820352229236745ca1208d3eb0bc75df/Source/WebCore/dom/Element.cpp#L2131#L2139

However, Element::attributeChanged is a virtual method, and many subclasses return early
without calling up to Element::changed. For example, HTMLOptionElement::attributeChanged
swallows disabled attribute changes:

https://github.com/WebKit/WebKit/blob/c5b51dbe820352229236745ca1208d3eb0bc75df/Source/WebCore/html/HTMLOptionElement.cpp#L180#L188

This means that the attribute-dependent state updates in Element::attributeChanged will not happen.

This patch fixes this by moving these state updates to `notifyAttributeChanged` which is actually called
for every attribute change. This bug was fixed for accessibility in https://bugs.webkit.org/show_bug.cgi?id=255433
(which introduced `notifyAttributeChanged`).

* Source/WebCore/dom/Element.cpp:
(WebCore::Element::notifyAttributeChanged):
(WebCore::Element::attributeChanged):
* Source/WebCore/dom/Element.h:

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




More information about the webkit-changes mailing list