-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a fast path to Node::moveNodeToNewDocument
https://bugs.webkit.org/show_bug.cgi?id=268065 Reviewed by Yusuke Suzuki. Add a fast path to Node::moveNodeToNewDocument when documents don't have ranges, node iterators, event listeners, etc... as it is the case with the document created by DOMParser by default. In the fast path, we only call Element::didMoveToNewDocument on elements when newly introduced TypeFlag::HasDidMoveToNewDocument flag is set. Only a select few elements set this flag upon construction so it avoids virtual function calls in most cases. We also coalesce the updates to each document's referencing node count so that they're updated once at the end instead of getting incremented and decremented by 1 upon visiting each node. * Source/WebCore/Modules/model-element/HTMLModelElement.cpp: (WebCore::HTMLModelElement::HTMLModelElement): * Source/WebCore/dom/Document.h: (WebCore::Document::incrementReferencingNodeCount): (WebCore::Document::decrementReferencingNodeCount): (WebCore::Document::hasRanges): (WebCore::Document::hasEventListeners const): * Source/WebCore/dom/DocumentInlines.h: (WebCore::Document::hasNodeIterators const): * Source/WebCore/dom/Node.cpp: (WebCore::traverseSubtreeToUpdateTreeScope): (WebCore::isDocumentEligibleForFastAdoption): (WebCore::Node::moveShadowTreeToNewDocumentFastCase): (WebCore::Node::moveShadowTreeToNewDocumentSlowCase): Renamed from moveShadowTreeToNewDocument. (WebCore::Node::moveTreeToNewScope): (WebCore::Node::moveNodeToNewDocumentFastCase): (WebCore::Node::moveNodeToNewDocumentSlowCase): Renamed from moveNodeToNewDocument. * Source/WebCore/dom/Node.h: * Source/WebCore/html/HTMLCanvasElement.cpp: (WebCore::HTMLCanvasElement::HTMLCanvasElement): * Source/WebCore/html/HTMLDataListElement.cpp: (WebCore::HTMLDataListElement::HTMLDataListElement): * Source/WebCore/html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::HTMLFormControlElement): * Source/WebCore/html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::HTMLFormElement): * Source/WebCore/html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::HTMLImageElement): * Source/WebCore/html/HTMLMaybeFormAssociatedCustomElement.cpp: (WebCore::HTMLMaybeFormAssociatedCustomElement::HTMLMaybeFormAssociatedCustomElement): * Source/WebCore/html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::HTMLMediaElement): * Source/WebCore/html/HTMLPlugInElement.cpp: (WebCore::HTMLPlugInElement::HTMLPlugInElement): * Source/WebCore/html/HTMLPlugInElement.h: (WebCore::HTMLPlugInElement::HTMLPlugInElement): * Source/WebCore/html/HTMLPlugInImageElement.cpp: (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): * Source/WebCore/html/HTMLTemplateElement.cpp: (WebCore::HTMLTemplateElement::HTMLTemplateElement): * Source/WebCore/svg/SVGGraphicsElement.cpp: (WebCore::SVGGraphicsElement::SVGGraphicsElement): * Source/WebCore/svg/SVGGraphicsElement.h: (WebCore::SVGGraphicsElement::SVGGraphicsElement): * Source/WebCore/svg/SVGImageElement.cpp: (WebCore::SVGImageElement::SVGImageElement): * Source/WebCore/svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::SVGSVGElement): Canonical link: https://commits.webkit.org/273544@main
- Loading branch information
Showing
21 changed files
with
132 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.