Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0bc30dba55bbd67eb6ea893f5644a9974ed2d05b
https://github.com/WebKit/WebKit/commit/0bc30dba55bbd67eb6ea893f5644a9974ed2d05b
Author: Ryosuke Niwa <[email protected]>
Date: 2026-03-17 (Tue, 17 Mar 2026)
Changed paths:
M LayoutTests/fast/dom/MutationObserver/removed-out-of-order-expected.txt
M LayoutTests/fast/dom/MutationObserver/removed-out-of-order.html
A
LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-details-element/details-name-exclusivity-fragment-insertion-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-details-element/details-name-exclusivity-fragment-insertion.html
M
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/127-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/128-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/130-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/147-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/148-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/shadow-dom/inserting-fragment-under-shadow-host-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/shadow-dom/inserting-fragment-under-shadow-host.html
M Source/WebCore/SaferCPPExpectations/UncheckedLocalVarsCheckerExpectations
M Source/WebCore/SaferCPPExpectations/UncountedLocalVarsCheckerExpectations
M Source/WebCore/dom/CharacterData.cpp
M Source/WebCore/dom/ContainerNode.cpp
M Source/WebCore/dom/ContainerNode.h
M Source/WebCore/dom/Element.cpp
M Source/WebCore/dom/Element.h
M Source/WebCore/dom/ShadowRoot.cpp
M Source/WebCore/html/HTMLDetailsElement.cpp
M Source/WebCore/html/HTMLDetailsElement.h
M Source/WebCore/html/HTMLMeterElement.cpp
M Source/WebCore/html/HTMLProgressElement.cpp
M Source/WebCore/html/HTMLSelectElement.cpp
M Source/WebCore/style/ChildChangeInvalidation.cpp
M Source/WebCore/svg/SVGAnimateMotionElement.cpp
Log Message:
-----------
Consolidate insertions of multiple nodes from a DocumentFragment into a
single notification
https://bugs.webkit.org/show_bug.cgi?id=309975
Reviewed by Chris Dumez and Darin Adler.
This PR changes a various DOM APIs and primitives so that inserting multiple
nodes from
a DocumentFragment happens in a single atomic step without any script execution
(including
mutation events).
To do this, this PR introduces a variant of
executeNodeInsertionWithScriptAssertion which
takes a Vector of nodes to insert instead of a single node. All the nodes in
the Vector
will be inserted within a scope with ScriptDisallowedScope as a single atomic
DOM mutation
without event dispatching or script execution. The function then calls
childrenChanged,
didFinishInsertingNode, and dispatch mutation events for all the nodes that got
inserted.
The new behavior matches that of the latest DOM / HTML5 specification and Gecko
and Blink.
Tests: fast/dom/MutationObserver/removed-out-of-order.html
imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-details-element/details-name-exclusivity-fragment-insertion.html
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/127.html
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/130.html
imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/147.html
imported/w3c/web-platform-tests/shadow-dom/inserting-fragment-under-shadow-host.html
* LayoutTests/fast/dom/MutationObserver/removed-out-of-order-expected.txt:
* LayoutTests/fast/dom/MutationObserver/removed-out-of-order.html:
*
LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-details-element/details-name-exclusivity-fragment-insertion-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-details-element/details-name-exclusivity-fragment-insertion.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/127-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/128-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/130-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/147-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/148-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/shadow-dom/inserting-fragment-under-shadow-host-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/shadow-dom/inserting-fragment-under-shadow-host.html:
Added.
* Source/WebCore/SaferCPPExpectations/UncheckedLocalVarsCheckerExpectations:
* Source/WebCore/SaferCPPExpectations/UncountedLocalVarsCheckerExpectations:
* Source/WebCore/dom/CharacterData.cpp:
(WebCore::makeChildChange):
* Source/WebCore/dom/ContainerNode.cpp:
(WebCore::ContainerNode::removeAllChildrenWithScriptAssertion):
(WebCore::makeChildChangeForRemoval):
(WebCore::makeChildChangeForInsertion):
(WebCore::makeChildChangeForCloneInsertion):
(WebCore::executeNodeInsertionWithScriptAssertion):
(WebCore::ContainerNode::insertBefore):
(WebCore::ContainerNode::insertBeforeCommon):
(WebCore::ContainerNode::appendChildCommon):
(WebCore::ContainerNode::replaceChild):
(WebCore::ContainerNode::replaceAll):
(WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck):
(WebCore::ContainerNode::insertChildrenBeforeWithoutPreInsertionValidityCheck):
(WebCore::ContainerNode::parserNotifyChildrenChanged):
* Source/WebCore/dom/ContainerNode.h:
(WebCore::ContainerNode::ChildChange::isInsertion const):
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::childrenChanged):
* Source/WebCore/dom/Element.h:
* Source/WebCore/dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::childrenChanged):
* Source/WebCore/html/HTMLDetailsElement.cpp:
(WebCore::HTMLDetailsElement::attributeChanged):
(WebCore::HTMLDetailsElement::insertedIntoAncestor):
(WebCore::HTMLDetailsElement::didFinishInsertingNode):
(WebCore::HTMLDetailsElement::otherElementsInNameGroup const):
(WebCore::HTMLDetailsElement::ensureDetailsExclusivityAfterMutation):
(WebCore::HTMLDetailsElement::shouldClose const):
(WebCore::HTMLDetailsElement::otherElementsInNameGroup): Deleted.
* Source/WebCore/html/HTMLDetailsElement.h:
* Source/WebCore/html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::appendShadowTreeForBaseAppearance):
* Source/WebCore/html/HTMLProgressElement.cpp:
(WebCore::HTMLProgressElement::appendShadowTreeForAutoAppearance):
(WebCore::HTMLProgressElement::appendShadowTreeForBaseAppearance):
* Source/WebCore/html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::optionToSelectFromChildChangeScope):
* Source/WebCore/style/ChildChangeInvalidation.cpp:
(WebCore::Style::ChildChangeInvalidation::traverseAddedElements):
* Source/WebCore/svg/SVGAnimateMotionElement.cpp:
(WebCore::SVGAnimateMotionElement::childrenChanged):
Canonical link: https://commits.webkit.org/309388@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications