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

  Changed paths:
    A 
LayoutTests/http/tests/site-isolation/intersection-observer/resources/report-intersections-frame.html
    A 
LayoutTests/http/tests/site-isolation/intersection-observer/resources/same-site-middle-frame.html
    A 
LayoutTests/http/tests/site-isolation/intersection-observer/target-in-cross-site-frame-nested-in-same-site-frame-expected.txt
    A 
LayoutTests/http/tests/site-isolation/intersection-observer/target-in-cross-site-frame-nested-in-same-site-frame.html
    A 
LayoutTests/http/tests/site-isolation/only-broadcast-frame-geometry-from-frames-with-cross-process-descendants-expected.txt
    A 
LayoutTests/http/tests/site-isolation/only-broadcast-frame-geometry-from-frames-with-cross-process-descendants.html
    M Source/WebCore/page/FrameTree.cpp
    M Source/WebCore/page/FrameTree.h
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/RemoteFrameView.cpp

  Log Message:
  -----------
  [Site Isolation] Only broadcast frame geometry from frames with a 
cross-process descendant
https://bugs.webkit.org/show_bug.cgi?id=322890
rdar://problem/186140629

Reviewed by Kiet Ho and Matt Woodrow.

On every rendering update, each local frame broadcasts its frame geometry to 
every other process
rendering the page.

This is mostly unnecessary, because remote frames only care about geometry from 
ancestors, not the
entire tree:

 - IntersectionObserver: computeClippedRectInRootContentsSpace uses clip 
geometry from ancestors
   only, e.g. layoutViewportRect and visibleRectOfChild.
 - LocalFrameView::windowClipRect: root frames in the remote process calculate 
their clip rect from
   their parent's visibleRectInParent.
 - exposedContentRect: frames in the remote process calculate their 
exposedContentRect from their
   parent's exposedContentRectInParent.

To fix this, skip calculating geometry for any child that is entirely local to 
this process.
Additionally, if a local frame has no remote descendants, then we should send 
nothing, since no
remote frame exists that could use that geometry.

One complication here is with remote frames nested under multiple local frames:

  Local main frame => local child frame => remote grandchild frame

When we process the local main frame in the syncLocalFrameInfoToRemote loop, we 
still have to send
geometry associated with that local main frame even though its direct child is 
local. This is
because an IntersectionObserver in the remote grandchild frame walks all the 
way up to the root of
the frame tree and uses clipping rectangles from all ancestor nodes.

We add a layout test to test this specific frame hierarchy with 
IntersectionObserver. Note that it
is similar to but differs from the existing nested-cross-origin-iframe.sub.html 
IntersectionObserver
test in WPT, since the frame hierarchy in that test contains only remote child 
frames.

There is an obvious follow-up optimization here to stop broadcasting frame 
geometry and only send
it to remote processes that actually need that particular state. That requires 
more significant
refactoring so we'll optimize that in a subsequent patch.

Tests: 
http/tests/site-isolation/intersection-observer/target-in-cross-site-frame-nested-in-same-site-frame.html
       
http/tests/site-isolation/only-broadcast-frame-geometry-from-frames-with-cross-process-descendants.html

* 
LayoutTests/http/tests/site-isolation/intersection-observer/resources/report-intersections-frame.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/intersection-observer/resources/same-site-middle-frame.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/intersection-observer/target-in-cross-site-frame-nested-in-same-site-frame-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/intersection-observer/target-in-cross-site-frame-nested-in-same-site-frame.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/only-broadcast-frame-geometry-from-frames-with-cross-process-descendants-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/only-broadcast-frame-geometry-from-frames-with-cross-process-descendants.html:
 Added.
* Source/WebCore/page/Page.cpp:
(WebCore::Page::syncLocalFrameInfoToRemote):
* Source/WebCore/page/FrameTree.cpp:
(WebCore::FrameTree::containsLocalFrame const):
* Source/WebCore/page/FrameTree.h:
* Source/WebCore/page/RemoteFrameView.cpp:
(WebCore::RemoteFrameView::childFrameOwnerToRootContentTransform const):
(WebCore::RemoteFrameView::absoluteToChildFrameOwnerLocalTransform const):

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



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

Reply via email to