Changeset 207713 in webkit


Ignore:
Timestamp:
Oct 22, 2016 9:30:17 AM (7 years ago)
Author:
mitz@apple.com
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.

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r207708 r207713  
     12016-10-22  Dan Bernstein  <mitz@apple.com>
     2
     3        Improve MiniBrowser window titles for URLs without paths and with no title
     4        <https://webkit.org/b/163843>
     5
     6        Reviewed by Darin Adler.
     7
     8        * MiniBrowser/mac/WK1BrowserWindowController.m:
     9        (-[WK1BrowserWindowController fetch:]): While we’re here, deploy
     10          +[NSURL _webkit_URLWithUserTypedString:] here to match the WK2BrowserWindowController
     11          version of this method.
     12        (-[WK1BrowserWindowController updateTitle:]): If the URL doesn’t have a lastPathComponent,
     13          use the entire URL.
     14        (-[WK1BrowserWindowController webView:didCommitLoadForFrame:]): Also while we’re here,
     15          deploy +[NSURL _web_userVisibleString] here to match the WK2BrowserWindowController
     16          behavior.
     17
     18        * MiniBrowser/mac/WK2BrowserWindowController.m:
     19        (-[WK2BrowserWindowController updateTitle:]): If the URL doesn’t have a lastPathComponent,
     20          use the entire URL.
     21
    1222016-10-21  David Kilzer  <ddkilzer@apple.com>
    223
  • trunk/Tools/MiniBrowser/mac/WK1BrowserWindowController.m

    r207512 r207713  
    2929#import "SettingsController.h"
    3030#import <WebKit/WebKit.h>
     31#import <WebKit/WebNSURLExtras.h>
    3132#import <WebKit/WebPreferences.h>
    3233#import <WebKit/WebPreferencesPrivate.h>
     
    8283{
    8384    [urlText setStringValue:[self addProtocolIfNecessary:[urlText stringValue]]];
    84     NSURL *url = [NSURL URLWithString:[urlText stringValue]];
     85    NSURL *url = [NSURL _webkit_URLWithUserTypedString:urlText.stringValue];
    8586    [[_webView mainFrame] loadRequest:[NSURLRequest requestWithURL:url]];
    8687}
     
    336337    if (!title) {
    337338        NSURL *url = _webView.mainFrame.dataSource.request.URL;
    338         title = url.lastPathComponent;
     339        title = url.lastPathComponent ?: url._web_userVisibleString;
    339340    }
    340341   
     
    356357
    357358    NSURL *committedURL = [[[frame dataSource] request] URL];
    358     [urlText setStringValue:[committedURL absoluteString]];
     359    urlText.stringValue = committedURL._web_userVisibleString;
    359360
    360361    [self updateTitle:nil];
  • trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m

    r207512 r207713  
    404404- (void)updateTitle:(NSString *)title
    405405{
    406     if (!title)
    407         title = _webView.URL.lastPathComponent;
    408    
     406    if (!title) {
     407        NSURL *url = _webView.URL;
     408        title = url.lastPathComponent ?: url._web_userVisibleString;
     409    }
     410
    409411    self.window.title = [NSString stringWithFormat:@"%@%@ [WK2 %d]", _isPrivateBrowsingWindow ? @"🙈 " : @"", title, _webView._webProcessIdentifier];
    410412}
Note: See TracChangeset for help on using the changeset viewer.