Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 21d657acd1bac107e61954490567c7685c20ee57
https://github.com/WebKit/WebKit/commit/21d657acd1bac107e61954490567c7685c20ee57
Author: Ryosuke Niwa <[email protected]>
Date: 2024-01-29 (Mon, 29 Jan 2024)
Changed paths:
M Source/WebCore/dom/ContainerNode.cpp
M Source/WebCore/dom/ContainerNode.h
M Source/WebCore/dom/Document.cpp
M Source/WebCore/dom/Element.cpp
M Source/WebCore/dom/Node.h
M Source/WebCore/html/parser/HTMLDocumentParserFastPath.cpp
Log Message:
-----------
Coalesce ContainerNode::childrenChanged in fast parser
https://bugs.webkit.org/show_bug.cgi?id=268324
Reviewed by Yusuke Suzuki.
This PR adds a new member function parserAppendChildIntoIsolatedTree to
ContainerNode which inserts
child nodes without calling childrenChanged on the parent, and deploys it in
HTMLFastPathParser.
childrenChanged gets called later in Element::finishParsingChildren via
ContainerNode's
parserNotifyChildrenChanged. Newly introduced
StateFlag::HeldBackChildrenChanged keeps track of
whether we held back childrenChanged calls when inserting child nodes or not.
Delaying calls to childrenChanged this way is safe in HTMLFastPathParser
because the parsed tree
isn't exposed to scripts until the parsing ends so there won't be any event
listeners that run
synchronously in response to DOM mutations.
Inspired by
https://github.com/chromium/chromium/commit/b366b305efb5289f3bcf3bbbe549cbad82fc0daf
* Source/WebCore/dom/ContainerNode.cpp:
(WebCore::executeParserNodeInsertionIntoIsolatedTreeWithoutNotifyingParent):
Added.
(WebCore::ContainerNode::parserAppendChildIntoIsolatedTree): Added.
(WebCore::ContainerNode::parserNotifyChildrenChanged): Added.
* Source/WebCore/dom/ContainerNode.h:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::setMarkupUnsafe):
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::finishParsingChildren):
* Source/WebCore/dom/Node.h:
(WebCore::Node::hasHeldBackChildrenChanged const): Added.
(WebCore::Node::setHasHeldBackChildrenChanged): Added.
(WebCore::Node::clearHasHeldBackChildrenChanged): Added.
* Source/WebCore/html/parser/HTMLDocumentParserFastPath.cpp:
(WebCore::HTMLFastPathParser::parseChildren): Uses
parserAppendChildIntoIsolatedTree now.
(WebCore::HTMLFastPathParser::parseContainerElement): Ditto.
(WebCore::HTMLFastPathParser::parseVoidElement): Ditto.
Canonical link: https://commits.webkit.org/273720@main
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes