Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d9f2d0740db2c49a9b5614534e552a4e40e71294
https://github.com/WebKit/WebKit/commit/d9f2d0740db2c49a9b5614534e552a4e40e71294
Author: Kiet Ho <[email protected]>
Date: 2026-01-29 (Thu, 29 Jan 2026)
Changed paths:
M Source/WebCore/dom/ContentVisibilityDocumentState.cpp
M Source/WebCore/dom/Document.cpp
M Source/WebCore/dom/Document.h
M Source/WebCore/page/ChromeClient.h
M Source/WebCore/page/IntersectionObserver.cpp
M Source/WebCore/page/IntersectionObserver.h
M Source/WebCore/page/LocalFrame.cpp
M Source/WebCore/page/Page.cpp
M Source/WebKit/UIProcess/WebFrameProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/WebPageProxy.messages.in
M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Log Message:
-----------
[Site Isolation] [intersection-observer] Update intersection observers in
cross-origin frames when main frame updates its rendering
rdar://168084353
https://bugs.webkit.org/show_bug.cgi?id=305411
Reviewed by Simon Fraser.
When an implicit root intersection observer is created, it registers itself
with the
main frame's document (top document). In turn, when the top document updates its
rendering, it calls registered observers to update their observations. With Site
Isolation, this wouldn't work if the observer is created in a frame that's
cross-origin with the top document, since they live in separate processes.
This commit refactors the updating mechanism to allow intersection observers to
be updated with Site Isolation enabled:
* A intersection observer now has a "type", Local or Remote. A local observer
lives in
the same process as the root, and a remote observer lives in a different
process.
* A local observer still registers with the top document, while a remote
observer
instead registers with its own document.
* Each Document keeps track of registered local and remote observers separately.
* When a non-top document updates its rendering, it updates both local and
remote
observers registered to that document.
* When the top document updates its rendering, it updates registered local
observers,
and broadcasts to other documents to update their registered remote observers.
When other documents receive the message, they update ONLY remote observers
registered
to the document.
With these changes, intersection observers that lives in different processes
from
the top document are updated when the top document updates its rendering.
* Source/WebCore/dom/ContentVisibilityDocumentState.cpp:
(WebCore::ContentVisibilityDocumentState::determineInitialVisibleContentVisibility
const):
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::commonTeardown):
(WebCore::Document::addIntersectionObserver):
(WebCore::Document::removeIntersectionObserver):
(WebCore::updateAndNotifyIntersectionObservers):
(WebCore::Document::updateRemoteIntersectionObservers):
(WebCore::Document::updateIntersectionObservers):
(WebCore::Document::updateIntersectionObservations): Deleted.
* Source/WebCore/dom/Document.h:
(WebCore::Document::numberOfIntersectionObservers const):
* Source/WebCore/page/ChromeClient.h:
(WebCore::ChromeClient::updateRemoteIntersectionObserversInOtherWebProcesses):
* Source/WebCore/page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::IntersectionObserver):
(WebCore::IntersectionObserver::computeIntersectionState const):
* Source/WebCore/page/IntersectionObserver.h:
(WebCore::IntersectionObserver::type const):
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::usedZoomForChild const):
- Add ASSERTs to check the supplied frame is a child of current frame.
* Source/WebCore/page/Page.cpp:
(WebCore::Page::updateRendering):
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::updateRemoteIntersectionObserversInOtherWebProcesses):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::updateRemoteIntersectionObserversInOtherWebProcesses):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateRemoteIntersectionObservers):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
Canonical link: https://commits.webkit.org/306473@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications