[webkit-changes] [WebKit/WebKit] b033b4: HTMLDetailsElement::insertedIntoAncestor shouldn't...

Ryosuke Niwa noreply at github.com
Mon Feb 26 11:12:19 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b033b4db86adffed8d81cd195731dd59efa9a1d7
      https://github.com/WebKit/WebKit/commit/b033b4db86adffed8d81cd195731dd59efa9a1d7
  Author: Ryosuke Niwa <rniwa at webkit.org>
  Date:   2024-02-26 (Mon, 26 Feb 2024)

  Changed paths:
    M Source/WebCore/dom/ContainerNode.cpp
    M Source/WebCore/html/HTMLDetailsElement.cpp
    M Source/WebCore/html/HTMLDetailsElement.h

  Log Message:
  -----------
  HTMLDetailsElement::insertedIntoAncestor shouldn't mutate DOM tree
https://bugs.webkit.org/show_bug.cgi?id=270075

Reviewed by Chris Dumez.

This PR moves the code to close other details elements, which mutates DOM state, from
HTMLDetailsElement::insertedIntoAncestor to HTMLDetailsElement::didFinishInsertingNode.

It also reinstates the unconditional debug assertion that the tree is allowed to mutate
in ContainerNode::removeNodeWithScriptAssertion. There is no point in making this a
release assert as ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree
trivially returns true in release builds.

In addition, this PR moves the check of Document::shouldNotFireMutationEvents from
ContainerNode::removeNodeWithScriptAssertion to dispatchChildRemovalEvents so that
both removeAllChildrenWithScriptAssertion and removeNodeWithScriptAssertion will
respect this boolean state of document.

* Source/WebCore/dom/ContainerNode.cpp:
(WebCore::ContainerNode::removeAllChildrenWithScriptAssertion):
(WebCore::ContainerNode::removeNodeWithScriptAssertion):
(WebCore::dispatchChildRemovalEvents):
* Source/WebCore/html/HTMLDetailsElement.cpp:
(WebCore::HTMLDetailsElement::attributeChanged):
(WebCore::HTMLDetailsElement::insertedIntoAncestor):
(WebCore::HTMLDetailsElement::didFinishInsertingNode):
* Source/WebCore/html/HTMLDetailsElement.h:

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list