Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e57ff52d6600fb653624faeeda2393a5eeaad364
      
https://github.com/WebKit/WebKit/commit/e57ff52d6600fb653624faeeda2393a5eeaad364
  Author: Ryosuke Niwa <[email protected]>
  Date:   2026-02-21 (Sat, 21 Feb 2026)

  Changed paths:
    M Source/WebCore/dom/TreeScope.cpp

  Log Message:
  -----------
  Eliminate memory allocation in TreeScope::retargetToScope
https://bugs.webkit.org/show_bug.cgi?id=308398

Reviewed by Wenson Hsieh.

This PR rewrite TreeScope::retargetToScope to avoid memory allocation.

We use the same strategy as commonInclusiveAncestorAndChildren in Node.cpp
where we do the initial traversal to find the depth of each TreeScope trees,
then look for the common ancestor from the shallower of the two depths.

No new tests since there should be no behavioral changes.

* Source/WebCore/dom/TreeScope.cpp:
(WebCore::TreeScope::retargetToScope const):
(WebCore::host):
(WebCore::findNodesInCommonTreeScope):
(WebCore::commonTreeScope):
(WebCore::listTreeScopes): Deleted.

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



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

Reply via email to