Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: a1ad995cedf051ec5c280355b0a28696cdbba5d3 https://github.com/WebKit/WebKit/commit/a1ad995cedf051ec5c280355b0a28696cdbba5d3 Author: Charlie Wolfe <charl...@apple.com> Date: 2023-11-12 (Sun, 12 Nov 2023)
Changed paths: M Source/WebCore/Headers.cmake M Source/WebCore/WebCore.xcodeproj/project.pbxproj M Source/WebCore/loader/EmptyClients.cpp M Source/WebCore/page/DragClient.h M Source/WebCore/page/DragController.cpp M Source/WebCore/page/DragController.h M Source/WebCore/page/EventHandler.cpp M Source/WebCore/page/EventHandler.h M Source/WebCore/page/HandleMouseEventResult.h R Source/WebCore/page/RemoteMouseEventData.h A Source/WebCore/page/RemoteUserInputEventData.h M Source/WebCore/platform/DragData.h M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in M Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm M Source/WebKit/UIProcess/RemotePageProxy.cpp M Source/WebKit/UIProcess/WebPageProxy.cpp M Source/WebKit/UIProcess/WebPageProxy.h M Source/WebKit/UIProcess/WebProcessProxy.cpp M Source/WebKit/UIProcess/WebProcessProxy.h M Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.cpp M Source/WebKit/WebProcess/WebCoreSupport/WebDragClient.h M Source/WebKit/WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp M Source/WebKit/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm M Source/WebKit/WebProcess/WebPage/WebFrame.cpp M Source/WebKit/WebProcess/WebPage/WebPage.cpp M Source/WebKit/WebProcess/WebPage/WebPage.h M Source/WebKit/WebProcess/WebPage/WebPage.messages.in M Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.h M Source/WebKitLegacy/mac/WebCoreSupport/WebDragClient.mm M Source/WebKitLegacy/mac/WebView/WebFrame.mm M Source/WebKitLegacy/mac/WebView/WebView.mm M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm Log Message: ----------- [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 _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes