Title: [214442] trunk/Source
Revision
214442
Author
[email protected]
Date
2017-03-27 16:37:40 -0700 (Mon, 27 Mar 2017)

Log Message

Web Inspector: Saving files should not suggest the top level directory
https://bugs.webkit.org/show_bug.cgi?id=170085
<rdar://problem/30197794>

Patch by Joseph Pecoraro <[email protected]> on 2017-03-27
Reviewed by Matt Baker.

Source/WebKit/mac:

* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorFrontendClient::save):
Don't set panel.directoryURL unless we have a good suggestion.

Source/WebKit2:

* UIProcess/mac/RemoteWebInspectorProxyMac.mm:
(WebKit::RemoteWebInspectorProxy::platformSave):
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::platformSave):
Don't set panel.directoryURL unless we have a good suggestion.

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (214441 => 214442)


--- trunk/Source/WebKit/mac/ChangeLog	2017-03-27 23:36:36 UTC (rev 214441)
+++ trunk/Source/WebKit/mac/ChangeLog	2017-03-27 23:37:40 UTC (rev 214442)
@@ -1,3 +1,15 @@
+2017-03-27  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Saving files should not suggest the top level directory
+        https://bugs.webkit.org/show_bug.cgi?id=170085
+        <rdar://problem/30197794>
+
+        Reviewed by Matt Baker.
+
+        * WebCoreSupport/WebInspectorClient.mm:
+        (WebInspectorFrontendClient::save):
+        Don't set panel.directoryURL unless we have a good suggestion.
+
 2017-03-24  Wenson Hsieh  <[email protected]>
 
         [WK2] Add a UI delegate SPI hook to enable or disable navigation on drop

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm (214441 => 214442)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm	2017-03-27 23:36:36 UTC (rev 214441)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm	2017-03-27 23:37:40 UTC (rev 214442)
@@ -329,8 +329,13 @@
 
     NSSavePanel *panel = [NSSavePanel savePanel];
     panel.nameFieldStringValue = platformURL.lastPathComponent;
-    panel.directoryURL = [platformURL URLByDeletingLastPathComponent];
 
+    // If we have a file URL we've already saved this file to a path and
+    // can provide a good directory to show. Otherwise, use the system's
+    // default behavior for the initial directory to show in the dialog.
+    if (platformURL.isFileURL)
+        panel.directoryURL = [platformURL URLByDeletingLastPathComponent];
+
     auto completionHandler = ^(NSInteger result) {
         if (result == NSModalResponseCancel)
             return;

Modified: trunk/Source/WebKit2/ChangeLog (214441 => 214442)


--- trunk/Source/WebKit2/ChangeLog	2017-03-27 23:36:36 UTC (rev 214441)
+++ trunk/Source/WebKit2/ChangeLog	2017-03-27 23:37:40 UTC (rev 214442)
@@ -1,3 +1,17 @@
+2017-03-27  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Saving files should not suggest the top level directory
+        https://bugs.webkit.org/show_bug.cgi?id=170085
+        <rdar://problem/30197794>
+
+        Reviewed by Matt Baker.
+
+        * UIProcess/mac/RemoteWebInspectorProxyMac.mm:
+        (WebKit::RemoteWebInspectorProxy::platformSave):
+        * UIProcess/mac/WebInspectorProxyMac.mm:
+        (WebKit::WebInspectorProxy::platformSave):
+        Don't set panel.directoryURL unless we have a good suggestion.
+
 2017-03-27  Yongjun Zhang  <[email protected]>
 
         Add delegate method to let an WebKit client provide a custom image preview controller.

Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteWebInspectorProxyMac.mm (214441 => 214442)


--- trunk/Source/WebKit2/UIProcess/mac/RemoteWebInspectorProxyMac.mm	2017-03-27 23:36:36 UTC (rev 214441)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteWebInspectorProxyMac.mm	2017-03-27 23:37:40 UTC (rev 214442)
@@ -179,8 +179,13 @@
 
     NSSavePanel *panel = [NSSavePanel savePanel];
     panel.nameFieldStringValue = platformURL.lastPathComponent;
-    panel.directoryURL = [platformURL URLByDeletingLastPathComponent];
 
+    // If we have a file URL we've already saved this file to a path and
+    // can provide a good directory to show. Otherwise, use the system's
+    // default behavior for the initial directory to show in the dialog.
+    if (platformURL.isFileURL)
+        panel.directoryURL = [platformURL URLByDeletingLastPathComponent];
+
     auto completionHandler = ^(NSInteger result) {
         if (result == NSModalResponseCancel)
             return;

Modified: trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm (214441 => 214442)


--- trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm	2017-03-27 23:36:36 UTC (rev 214441)
+++ trunk/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm	2017-03-27 23:37:40 UTC (rev 214442)
@@ -460,8 +460,13 @@
 
     NSSavePanel *panel = [NSSavePanel savePanel];
     panel.nameFieldStringValue = platformURL.lastPathComponent;
-    panel.directoryURL = [platformURL URLByDeletingLastPathComponent];
 
+    // If we have a file URL we've already saved this file to a path and
+    // can provide a good directory to show. Otherwise, use the system's
+    // default behavior for the initial directory to show in the dialog.
+    if (platformURL.isFileURL)
+        panel.directoryURL = [platformURL URLByDeletingLastPathComponent];
+
     auto completionHandler = ^(NSInteger result) {
         if (result == NSModalResponseCancel)
             return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to