Title: [257364] trunk
Revision
257364
Author
cdu...@apple.com
Date
2020-02-25 11:08:27 -0800 (Tue, 25 Feb 2020)

Log Message

REGRESSION (r256882): Can't drag an HTML file into a new (empty) Safari tab
https://bugs.webkit.org/show_bug.cgi?id=208199
<rdar://problem/59746887>

Reviewed by Alex Christensen.

Source/WebKit:

Make sure we launch the initial WKWebView's WebProcess when a drag enters the view, so that the drag & drop
logic still works on empty views.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::dragEntered):

Tools:

Add API test coverage.

* TestWebKitAPI/Tests/WebKitCocoa/DragAndDropTests.mm:
(TEST):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (257363 => 257364)


--- trunk/Source/WebKit/ChangeLog	2020-02-25 18:49:00 UTC (rev 257363)
+++ trunk/Source/WebKit/ChangeLog	2020-02-25 19:08:27 UTC (rev 257364)
@@ -1,3 +1,17 @@
+2020-02-25  Chris Dumez  <cdu...@apple.com>
+
+        REGRESSION (r256882): Can't drag an HTML file into a new (empty) Safari tab
+        https://bugs.webkit.org/show_bug.cgi?id=208199
+        <rdar://problem/59746887>
+
+        Reviewed by Alex Christensen.
+
+        Make sure we launch the initial WKWebView's WebProcess when a drag enters the view, so that the drag & drop
+        logic still works on empty views.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::dragEntered):
+
 2020-02-25  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         Make HostWindow be the creator of the remote ImageBuffer

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (257363 => 257364)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-02-25 18:49:00 UTC (rev 257363)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-02-25 19:08:27 UTC (rev 257364)
@@ -2339,6 +2339,7 @@
 #if ENABLE(DRAG_SUPPORT)
 void WebPageProxy::dragEntered(DragData& dragData, const String& dragStorageName)
 {
+    launchInitialProcessIfNecessary();
     performDragControllerAction(DragControllerAction::Entered, dragData, dragStorageName, { }, { });
 }
 

Modified: trunk/Tools/ChangeLog (257363 => 257364)


--- trunk/Tools/ChangeLog	2020-02-25 18:49:00 UTC (rev 257363)
+++ trunk/Tools/ChangeLog	2020-02-25 19:08:27 UTC (rev 257364)
@@ -1,3 +1,16 @@
+2020-02-25  Chris Dumez  <cdu...@apple.com>
+
+        REGRESSION (r256882): Can't drag an HTML file into a new (empty) Safari tab
+        https://bugs.webkit.org/show_bug.cgi?id=208199
+        <rdar://problem/59746887>
+
+        Reviewed by Alex Christensen.
+
+        Add API test coverage.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/DragAndDropTests.mm:
+        (TEST):
+
 2020-02-25  Sihui Liu  <sihui_...@apple.com>
 
         spinRunLoop should take a non-zero integer as parameter

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DragAndDropTests.mm (257363 => 257364)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DragAndDropTests.mm	2020-02-25 18:49:00 UTC (rev 257363)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DragAndDropTests.mm	2020-02-25 19:08:27 UTC (rev 257364)
@@ -116,6 +116,35 @@
     EXPECT_WK_STREQ("https://webkit.org/\nhttps://apple.com/", [webView stringByEvaluatingJavaScript:@"urlData.textContent"]);
 }
 
+TEST(DragAndDropTests, DragAndDropOnEmptyView)
+{
+    auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebViewFrame:CGRectMake(0, 0, 320, 500)]);
+    simulator.get().dragDestinationAction = WKDragDestinationActionAny;
+    auto webView = [simulator webView];
+
+    NSURL *url = "" mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
+
+#if PLATFORM(MAC)
+    NSPasteboard *pasteboard = [NSPasteboard pasteboardWithUniqueName];
+    [pasteboard writeObjects:@[ url ]];
+    [simulator setExternalDragPasteboard:pasteboard];
+#else
+    auto urlItem = adoptNS([[NSItemProvider alloc] initWithObject:url]);
+    urlItem.get().preferredPresentationStyle = UIPreferredPresentationStyleInline;
+    [simulator setExternalItemProviders:@[ urlItem.get() ]];
+#endif
+
+    [simulator runFrom:CGPointMake(0, 0) to:CGPointMake(100, 100)];
+
+    __block bool finished = false;
+    [webView performAfterLoading:^{
+        finished = true;
+    }];
+    TestWebKitAPI::Util::run(&finished);
+
+    EXPECT_WK_STREQ("Simple HTML file.", [webView stringByEvaluatingJavaScript:@"document.body.innerText"]);
+}
+
 TEST(DragAndDropTests, PreventingMouseDownShouldPreventDragStart)
 {
     auto simulator = adoptNS([[DragAndDropSimulator alloc] initWithWebViewFrame:CGRectMake(0, 0, 320, 500)]);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to