Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6939be86d6d771a3c94810704a94ebbead81b551
      
https://github.com/WebKit/WebKit/commit/6939be86d6d771a3c94810704a94ebbead81b551
  Author: Rupin Mittal <[email protected]>
  Date:   2026-04-23 (Thu, 23 Apr 2026)

  Changed paths:
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTree.serialization.in
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeCommitBundle.h
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeCommitBundle.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
    M 
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm
    M Source/WebKit/WebProcess/WebPage/WebPage.h

  Log Message:
  -----------
  [Site Isolation] Make WebPage::scheduleFullEditorStateUpdate() work for 
cross-site iframes
https://bugs.webkit.org/show_bug.cgi?id=313084
rdar://175382453

Reviewed by Wenson Hsieh, Ryosuke Niwa, and Aditya Keerthi.

Many user actions can result in the editing state of the webview being changed.
When this happens, the web process must send the UI process a new EditorState to
reflect these changes.

The web process does this by calling WebPage::scheduleFullEditorStateUpdate().
This sets m_needsEditorStateVisualDataUpdate to true and schedules a rendering
update. Then, when RemoteLayerTreeDrawingArea::updateRendering() is called,
it will compute the new EditorState and send it to the UIProcess as part of the
RemoteLayerTreeDrawingAreaProxy::CommitLayerTree IPC message.

With site isolation on, when such actions happen in a cross-site iframe, (such
as tapping on an input element which changes the selection), no EditorState is
sent from the iframe's web process. The web process does indeed schedule the
editor state update, but it never arrives in the UI process.

The issue is that RemoteLayerTreeDrawingArea::updateRendering() only computes
and sends the new EditorState if this web process is that of the main frame:

if (webPage->localMainFrame()) {
    ...
    webPage->willCommitMainFrameData(mainFrameData, transactionID);
    ...
}

Here, willCommitMainFrameData() computes the EditorState and stores it in
mainFrameData. This is part of the the data that is sent to the UI Process by 
the
RemoteLayerTreeDrawingAreaProxy::CommitLayerTree IPC message.

This was fine before site isolation since the main frame and cross-site iframe
were in the same web process. So if the iframe scheduled an editor state update,
this code would still compute and send the new EditorState. But with site
isolation, the iframe is in its own process, and so webPage->localMainFrame() is
false.

To fix this, we amend the code to send the EditorState any time this web process
has noted that the editor state needs to be updated (not just when it's the main
frame's process).

Note that WebPageProxy stores only a single EditorState. This is fine with site
isolation off because there is only web process per WebPageProxy. But with site
isolation on, there are multiple web processes per WebPageProxy, and since there
is one EditorState per web process, making this change will mean WebPageProxy
will now receive EditorStates from multiple web process.

WebPageProxy hasn't yet been modified to handle this. But for now, it will 
mostly
ignore EditorStates that come from non-main frame web processes since the
EditorStates they send will likely have an identifier less than that of the
EditorStates sent by the main frame's web process (assuming more changes are
happening in the main frame's web process).

So this will cause no behavior change for now. This is the first step in making
EditorState work with site isolation. A follow up patch will make WebPageProxy
deal with multiple web processes sending it EditorStates.

* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTree.serialization.in:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeCommitBundle.h:

Move editorState out of mainFrameData and into RemoteLayerTreeCommitBundle since
its no longer tied to the main frame.

* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeCommitBundle.mm:
(WebKit::MainFrameData::description const):
(WebKit::RemoteLayerTreeCommitBundle::description const):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):

If the web process sent an EditorState, send it to WebPageProxy.

* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::willCommitMainFrameData):
(WebKit::WebPage::editorStateIfUpdateNeeded):
* 
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::updateRendering):

Compute and store the editorState if this web process says the editor state
needs updating. The IPC will send it to the UI process.

* Source/WebKit/WebProcess/WebPage/WebPage.h:

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



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

Reply via email to