Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 76bb85cfc990489e5e5faa2de158ee8243d021ce
      
https://github.com/WebKit/WebKit/commit/76bb85cfc990489e5e5faa2de158ee8243d021ce
  Author: Ben Nham <[email protected]>
  Date:   2026-08-20 (Thu, 20 Aug 2026)

  Changed paths:
    A 
LayoutTests/http/tests/site-isolation/animated-image-in-display-none-cross-origin-iframe-expected.txt
    A 
LayoutTests/http/tests/site-isolation/animated-image-in-display-none-cross-origin-iframe.html
    A 
LayoutTests/http/tests/site-isolation/animated-image-outside-viewport-in-cross-origin-iframe-expected.txt
    A 
LayoutTests/http/tests/site-isolation/animated-image-outside-viewport-in-cross-origin-iframe.html
    A 
LayoutTests/http/tests/site-isolation/find-in-page-marker-rects-in-cross-origin-iframe-expected.txt
    A 
LayoutTests/http/tests/site-isolation/find-in-page-marker-rects-in-cross-origin-iframe.html
    A 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-clipped-out-cross-origin-iframe-expected.txt
    A 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-clipped-out-cross-origin-iframe.html
    A 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-display-none-cross-origin-iframe-expected.txt
    A 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-display-none-cross-origin-iframe.html
    A 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-display-none-while-outside-viewport-cross-origin-iframe-expected.txt
    A 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-display-none-while-outside-viewport-cross-origin-iframe.html
    A 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-outside-viewport-in-cross-origin-iframe-expected.txt
    A 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-outside-viewport-in-cross-origin-iframe.html
    A LayoutTests/http/tests/site-isolation/resources/marker-rects-frame.html
    A 
LayoutTests/http/tests/site-isolation/resources/request-animation-frame-throttling-frame.html
    M Source/WebCore/page/LocalFrameView.cpp
    M Source/WebCore/page/LocalFrameView.h
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/RemoteFrameLayoutInfo.cpp
    M Source/WebCore/page/RemoteFrameLayoutInfo.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h

  Log Message:
  -----------
  [Site Isolation] Fix offscreen frame throttling
https://bugs.webkit.org/show_bug.cgi?id=321885
rdar://problem/185063323

Reviewed by Simon Fraser.

LocalFrameView::windowClipRect doesn't work correctly when Site Isolation is 
enabled. It tries to
apply the clip rect from its ancestors by using ownerElement, which is null 
once reaching a root
frame with SI enabled. When it doesn't find a clip rect to apply, it assumes 
the whole view is
visible.

This leads to a number of visibility-based heuristics being broken when Site 
Isolation is enabled,
e.g. offscreen remote frames never throttle rAF or timer callbacks, animated 
images in offscreen
frames never pause, find in page marker rects are incorrect, etc.

To fix this, we now send three extra pieces of state per rendering update for 
each child frame in
RemoteFrameLayoutInfo:

a. visibleRectInParent and windowClipRectInParent: These are the visible rect 
of the child frame and
the parent frame's windowClipRect, both in the parent's content coordinate 
space.

On the receiving side, we intersect the rects, project it into the child's 
window space, and give
that to LocalFrameView::setVisibleRectFromParentFrameProcess. (The projection 
is necessary because
when SI is enabled, each root frame has its own window coordinate space, 
whereas with SI disabled,
all frames share the same window coordinate space.) 
LocalFrameView::windowClipRect then intersects
against that visibleRectFromParentFrameProcess instead of bailing out, which is 
the main fix in this
patch.

Note there was already a visibleRectInParent member in RemoteFrameLayoutInfo 
which was actually carrying
exposedContentRect info. I renamed that field exposedContentRectInParent.

b. ownerHasRenderer: whether the frame's owning element has a renderer. The 
receiving frame process
uses this to avoid throttling display:none frames, which is an existing 
heuristic.

This is in the same area as the previous tile coverage change (318269@main), 
but I purposely avoided
changing any of the tile-coverage related logic in this patch outside of 
renames.

* 
LayoutTests/http/tests/site-isolation/animated-image-in-display-none-cross-origin-iframe-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/animated-image-in-display-none-cross-origin-iframe.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/animated-image-outside-viewport-in-cross-origin-iframe-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/animated-image-outside-viewport-in-cross-origin-iframe.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/find-in-page-marker-rects-in-cross-origin-iframe-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/find-in-page-marker-rects-in-cross-origin-iframe.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-clipped-out-cross-origin-iframe-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-clipped-out-cross-origin-iframe.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-display-none-cross-origin-iframe-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-display-none-cross-origin-iframe.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-display-none-while-outside-viewport-cross-origin-iframe-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-display-none-while-outside-viewport-cross-origin-iframe.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-outside-viewport-in-cross-origin-iframe-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/request-animation-frame-throttling-outside-viewport-in-cross-origin-iframe.html:
 Added.
* LayoutTests/http/tests/site-isolation/resources/marker-rects-frame.html: 
Added.
* 
LayoutTests/http/tests/site-isolation/resources/request-animation-frame-throttling-frame.html:
 Added.
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::updateScriptedAnimationsAndTimersThrottlingState):
(WebCore::LocalFrameView::windowClipRect const):
* Source/WebCore/page/LocalFrameView.h:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::syncLocalFrameInfoToRemote):
* Source/WebCore/page/RemoteFrameLayoutInfo.cpp:
(WebCore::RemoteFrameLayoutInfo::RemoteFrameLayoutInfo):
(WebCore::RemoteFrameLayoutInfo::mapParentContentsToChildWindow const):
(WebCore::RemoteFrameLayoutInfo::create): Deleted.
(WebCore::RemoteFrameLayoutInfo::projectVisibleRectToChildContent const): 
Deleted.
* Source/WebCore/page/RemoteFrameLayoutInfo.h:
(WebCore::RemoteFrameLayoutInfo::create):
(WebCore::RemoteFrameLayoutInfo::windowClipRectInParent const):
(WebCore::RemoteFrameLayoutInfo::exposedContentRectInParent const):
(WebCore::RemoteFrameLayoutInfo::ownerHasRenderer const):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::updateLocalFrameRect):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::frameTreeSyncDataChangedInAnotherProcess):
(WebKit::WebPage::allFrameTreeSyncDataChangedInAnotherProcess):
(WebKit::WebPage::updateChildFrameVisibleRectsFromParent):
(WebKit::WebPage::updateExposedRectFromParent): Deleted.
* Source/WebKit/WebProcess/WebPage/WebPage.h:

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



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

Reply via email to