-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Site Isolation][macOS] Propagate drag events to isolated frames
https://bugs.webkit.org/show_bug.cgi?id=264502 rdar://118184993 Reviewed by Wenson Hsieh. This follows the same pattern as mouse events, where IPC is sent between the UI process and web processes until the target frame is reached. * Source/WebCore/Headers.cmake: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/loader/EmptyClients.cpp: * Source/WebCore/page/DragClient.h: * Source/WebCore/page/DragController.cpp: (WebCore::DragController::dragExited): (WebCore::DragController::dragEnteredOrUpdated): (WebCore::DragController::tryDocumentDrag): (WebCore::DragController::tryDHTMLDrag): (WebCore::DragController::doSystemDrag): (WebCore::DragController::dragEntered): Deleted. (WebCore::DragController::dragUpdated): Deleted. * Source/WebCore/page/DragController.h: There were several places in `DragController` where drag functions would always be called on the main frame’s event handler. This won’t work when the main frame is being hosted in another process. I changed these functions to pass the frame which the drag is happening in, and instead call functions on the event handler of that frame. There were also places where we were down casting frames to local when we didn’t need to. In `doSystemDrag()` and `tryDHTMLDrag()` all functions called on the main frame and main frame view are accessible even if the frame is out-of-process. `dragEntered()` and `dragUpdated()` didn’t seem like a useful abstraction, so I removed them. * Source/WebCore/page/EventHandler.cpp: (WebCore::EventHandler::mouseEventDataForRemoteFrame): (WebCore::EventHandler::dragSourceEndedAt): * Source/WebCore/page/EventHandler.h: I changed `dragSourceEndedAt()` to return a `FrameIdentifier` if the hit test leads to a remote frame. * Source/WebCore/page/HandleMouseEventResult.h: (WebCore::HandleMouseEventResult::HandleMouseEventResult): (WebCore::HandleMouseEventResult::remoteInputEventData): (WebCore::HandleMouseEventResult::remoteMouseEventData): Deleted. * Source/WebCore/page/RemoteUserInputEventData.h: Renamed from Source/WebCore/page/RemoteMouseEventData.h. I renamed `RemoteMouseEventData` to `RemoteUserInputEventData` since we can use the struct for things other than mouse events. I used it here for drag events, and can likely be used for touch events too. * Source/WebCore/platform/DragData.h: (WebCore::DragData::setClientPosition): I added `setClientPosition` to update the client positions coordinates on `DragData` when passing a drag event to a remote frame. * Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in: * Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: (WebKit::WebPasteboardProxy::determineDataOwner const): When dragging in a isolated frame, each of the `MESSAGE_CHECK_COMPLETION(dataOwner, completionHandler())` would fail. This is because `determineDataOwner()` is only checking for a `WebPageProxy` associated with the `WebProcessProxy`, which may not exist. We also need to check each `RemotePageProxy`. * Source/WebKit/UIProcess/RemotePageProxy.cpp: (WebKit::RemotePageProxy::sendMouseEvent): * Source/WebKit/UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::performDragOperation): (WebKit::WebPageProxy::performDragControllerAction): (WebKit::WebPageProxy::dragEnded): (WebKit::WebPageProxy::handleMouseEventReply): (WebKit::WebPageProxy::sendMouseEvent): * Source/WebKit/UIProcess/WebPageProxy.h: The completion handler in `performDragControllerAction()` and `dragEnded()` is where the drag is forwarded to the iframe process. I also added a frame identifier as a parameter so the same function could be used to send the next drag. `TestWebKitAPI.DragAndDropTests.DragAndDropOnEmptyView` expects drag events to be sent for empty webviews, so we still need to send the drag IPC even if `m_mainFrame` is null. I made `FrameIdentifier` optional in the drag IPC messages to the web page which will default to the main frame, since we don't know the frame identifier of the main frame in the UI process in this case. * Source/WebKit/UIProcess/WebProcessProxy.cpp: (WebKit::WebProcessProxy::remotePages const): * Source/WebKit/UIProcess/WebProcessProxy.h: I added `remotePages()` so they could be accessed in `WebPasteboardProxyCocoa`. * Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.cpp: (WebKit::WebDragClient::startDrag): * Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.h: * Source/WebKit/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp: (WebKit::WebDragClient::startDrag): * Source/WebKit/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm: (WebKit::convertDragImageToBitmap): (WebKit::WebDragClient::startDrag): * Source/WebKit/WebProcess/WebPage/WebFrame.cpp: * Source/WebKit/WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::mouseEvent): (WebKit::WebPage::performDragControllerAction): (WebKit::WebPage::dragEnded): * Source/WebKit/WebProcess/WebPage/WebPage.h: * Source/WebKit/WebProcess/WebPage/WebPage.messages.in: Change these functions to expect a frame identifier to be passed. If the frame identifer is null, use the main frame. * Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.h: * Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.mm: (WebDragClient::startDrag): * Source/WebKitLegacy/mac/WebView/WebFrame.mm: * Source/WebKitLegacy/mac/WebView/WebView.mm: (-[WebView _enteredDataInteraction:client:global:operation:]): (-[WebView _updatedDataInteraction:client:global:operation:]): (-[WebView _exitedDataInteraction:client:global:operation:]): (-[WebView draggingEntered:]): (-[WebView draggingUpdated:]): (-[WebView draggingExited:]): * Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm: (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/270614@main
- Loading branch information
1 parent
d53d6d2
commit a1ad995
Showing
31 changed files
with
308 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.