Title: [207713] trunk/Tools
Revision
207713
Author
m...@apple.com
Date
2016-10-22 09:30:17 -0700 (Sat, 22 Oct 2016)

Log Message

Improve MiniBrowser window titles for URLs without paths and with no title
<https://webkit.org/b/163843>

Reviewed by Darin Adler.

* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController fetch:]): While we’re here, deploy
  +[NSURL _webkit_URLWithUserTypedString:] here to match the WK2BrowserWindowController
  version of this method.
(-[WK1BrowserWindowController updateTitle:]): If the URL doesn’t have a lastPathComponent,
  use the entire URL.
(-[WK1BrowserWindowController webView:didCommitLoadForFrame:]): Also while we’re here,
  deploy +[NSURL _web_userVisibleString] here to match the WK2BrowserWindowController
  behavior.

* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController updateTitle:]): If the URL doesn’t have a lastPathComponent,
  use the entire URL.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (207712 => 207713)


--- trunk/Tools/ChangeLog	2016-10-22 16:26:36 UTC (rev 207712)
+++ trunk/Tools/ChangeLog	2016-10-22 16:30:17 UTC (rev 207713)
@@ -1,3 +1,24 @@
+2016-10-22  Dan Bernstein  <m...@apple.com>
+
+        Improve MiniBrowser window titles for URLs without paths and with no title
+        <https://webkit.org/b/163843>
+
+        Reviewed by Darin Adler.
+
+        * MiniBrowser/mac/WK1BrowserWindowController.m:
+        (-[WK1BrowserWindowController fetch:]): While we’re here, deploy
+          +[NSURL _webkit_URLWithUserTypedString:] here to match the WK2BrowserWindowController
+          version of this method.
+        (-[WK1BrowserWindowController updateTitle:]): If the URL doesn’t have a lastPathComponent,
+          use the entire URL.
+        (-[WK1BrowserWindowController webView:didCommitLoadForFrame:]): Also while we’re here,
+          deploy +[NSURL _web_userVisibleString] here to match the WK2BrowserWindowController
+          behavior.
+
+        * MiniBrowser/mac/WK2BrowserWindowController.m:
+        (-[WK2BrowserWindowController updateTitle:]): If the URL doesn’t have a lastPathComponent,
+          use the entire URL.
+
 2016-10-21  David Kilzer  <ddkil...@apple.com>
 
         Bug 163762: IntSize::area() should used checked arithmetic

Modified: trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m (207712 => 207713)


--- trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m	2016-10-22 16:26:36 UTC (rev 207712)
+++ trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m	2016-10-22 16:30:17 UTC (rev 207713)
@@ -28,6 +28,7 @@
 #import "AppDelegate.h"
 #import "SettingsController.h"
 #import <WebKit/WebKit.h>
+#import <WebKit/WebNSURLExtras.h>
 #import <WebKit/WebPreferences.h>
 #import <WebKit/WebPreferencesPrivate.h>
 #import <WebKit/WebPreferenceKeysPrivate.h>
@@ -81,7 +82,7 @@
 - (IBAction)fetch:(id)sender
 {
     [urlText setStringValue:[self addProtocolIfNecessary:[urlText stringValue]]];
-    NSURL *url = "" URLWithString:[urlText stringValue]];
+    NSURL *url = "" _webkit_URLWithUserTypedString:urlText.stringValue];
     [[_webView mainFrame] loadRequest:[NSURLRequest requestWithURL:url]];
 }
 
@@ -335,7 +336,7 @@
 {
     if (!title) {
         NSURL *url = ""
-        title = url.lastPathComponent;
+        title = url.lastPathComponent ?: url._web_userVisibleString;
     }
     
     [self.window setTitle:[title stringByAppendingString:@" [WK1]"]];
@@ -355,7 +356,7 @@
         return;
 
     NSURL *committedURL = [[[frame dataSource] request] URL];
-    [urlText setStringValue:[committedURL absoluteString]];
+    urlText.stringValue = committedURL._web_userVisibleString;
 
     [self updateTitle:nil];
 }

Modified: trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m (207712 => 207713)


--- trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m	2016-10-22 16:26:36 UTC (rev 207712)
+++ trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m	2016-10-22 16:30:17 UTC (rev 207713)
@@ -403,9 +403,11 @@
 
 - (void)updateTitle:(NSString *)title
 {
-    if (!title)
-        title = _webView.URL.lastPathComponent;
-    
+    if (!title) {
+        NSURL *url = ""
+        title = url.lastPathComponent ?: url._web_userVisibleString;
+    }
+
     self.window.title = [NSString stringWithFormat:@"%@%@ [WK2 %d]", _isPrivateBrowsingWindow ? @"🙈 " : @"", title, _webView._webProcessIdentifier];
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to