Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4a79d76de1f311ddb588f5f3671c973baa203c46
      
https://github.com/WebKit/WebKit/commit/4a79d76de1f311ddb588f5f3671c973baa203c46
  Author: Ben Nham <[email protected]>
  Date:   2026-09-30 (Wed, 30 Sep 2026)

  Changed paths:
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm

  Log Message:
  -----------
  [Site Isolation] Avoid calling -addSublayer: on hosted frame's root layer on 
every commit
https://bugs.webkit.org/show_bug.cgi?id=325683
rdar://problem/188740987

Reviewed by Simon Fraser.

RemoteLayerTreeHost::updateLayerTree() calls 
RemoteLayerTreeNode::addToHostingNode() for every
transaction from remote frame processes. This then unconditionally calls 
-[CALayer addSublayer:] to
add the root layer to the hosting layer.

If the root layer is already a sublayer of the hosting layer, this adds some 
extra cost to each
transaction, since -addSublayer: actually removes the layer, re-adds it, and 
then marks the layer
hierarchy as dirty for the subsequent CATransaction.

Instead, skip calling -addSublayer: if the root layer is already a sublayer of 
the hosting layer.
This should be safe as the root layer should be the only sublayer of the 
hosting layer (we added a
new debug assert to check this).

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm

* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
(WebKit::RemoteLayerTreeNode::addToHostingNode):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::(SiteIsolation, 
CommitsFromCrossSiteIframeDoNotReparentItsLayers)):

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



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

Reply via email to