Changeset 166241 in webkit


Ignore:
Timestamp:
Mar 25, 2014 12:17:54 PM (10 years ago)
Author:
andersca@apple.com
Message:

Add goBack: and goForward: IBActions and move stopLoading: to a new WKIBActions category on WKWebView
https://bugs.webkit.org/show_bug.cgi?id=130732

Reviewed by Tim Horton.

Source/WebKit2:

  • UIProcess/API/Cocoa/WKWebView.h:
  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView goBack]):
(-[WKWebView goForward]):
(-[WKWebView validateUserInterfaceItem:]):
(-[WKWebView goBack:]):
(-[WKWebView goForward:]):
(-[WKWebView stopLoading:]):

Tools:

  • MiniBrowser/mac/WK2BrowserWindowController.m:

(-[WK2BrowserWindowController validateUserInterfaceItem:]):

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r166239 r166241  
     12014-03-25  Anders Carlsson  <andersca@apple.com>
     2
     3        Add goBack: and goForward: IBActions and move stopLoading: to a new WKIBActions category on WKWebView
     4        https://bugs.webkit.org/show_bug.cgi?id=130732
     5
     6        Reviewed by Tim Horton.
     7
     8        * UIProcess/API/Cocoa/WKWebView.h:
     9        * UIProcess/API/Cocoa/WKWebView.mm:
     10        (-[WKWebView goBack]):
     11        (-[WKWebView goForward]):
     12        (-[WKWebView validateUserInterfaceItem:]):
     13        (-[WKWebView goBack:]):
     14        (-[WKWebView goForward:]):
     15        (-[WKWebView stopLoading:]):
     16
    1172014-03-25  Martin Robinson  <mrobinson@igalia.com>
    218
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.h

    r165678 r166241  
    9090- (WKNavigation *)goToBackForwardListItem:(WKBackForwardListItem *)item;
    9191
    92 - (IBAction)stopLoading:(id)sender;
    93 
    9492@property (nonatomic, readonly) NSString *title;
    9593
     
    118116@property (readonly) BOOL canGoForward;
    119117
    120 - (void)goBack;
    121 - (void)goForward;
     118- (WKNavigation *)goBack;
     119- (WKNavigation *)goForward;
    122120
    123121@property (nonatomic) BOOL allowsBackForwardNavigationGestures;
     
    134132@end
    135133
     134@interface WKWebView (WKIBActions) <NSUserInterfaceValidations>
     135
     136- (IBAction)goBack:(id)sender;
     137- (IBAction)goForward:(id)sender;
     138
     139- (IBAction)stopLoading:(id)sender;
     140
     141@end
     142
    136143#endif
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r166188 r166241  
    257257}
    258258
    259 - (IBAction)stopLoading:(id)sender
    260 {
    261     _page->stopLoading();
    262 }
    263 
    264259- (NSString *)title
    265260{
     
    299294}
    300295
    301 // FIXME: This should return a WKNavigation object.
    302 - (void)goBack
     296- (WKNavigation *)goBack
    303297{
    304298    _page->goBack();
    305 }
    306 
    307 // FIXME: This should return a WKNavigation object.
    308 - (void)goForward
     299
     300    // FIXME: Return a navigation object.
     301    return nil;
     302}
     303
     304- (WKNavigation *)goForward
    309305{
    310306    _page->goForward();
     307
     308    // FIXME: Return a navigation object.
     309    return nil;
    311310}
    312311
     
    11781177@end
    11791178
     1179@implementation WKWebView (WKIBActions)
     1180
     1181- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
     1182{
     1183    SEL action = item.action;
     1184
     1185    if (action == @selector(goBack:))
     1186        return !!_page->backForwardList().backItem();
     1187
     1188    if (action == @selector(goForward:))
     1189        return !!_page->backForwardList().forwardItem();
     1190
     1191    if (action == @selector(stopLoading:)) {
     1192        // FIXME: Return no if we're stopped.
     1193        return YES;
     1194    }
     1195
     1196    return NO;
     1197}
     1198
     1199- (IBAction)goBack:(id)sender
     1200{
     1201    [self goBack];
     1202}
     1203
     1204- (IBAction)goForward:(id)sender
     1205{
     1206    [self goForward];
     1207}
     1208
     1209- (IBAction)stopLoading:(id)sender
     1210{
     1211    _page->stopLoading();
     1212}
     1213
     1214@end
     1215
    11801216#endif // WK_API_ENABLED
  • trunk/Tools/ChangeLog

    r166239 r166241  
     12014-03-25  Anders Carlsson  <andersca@apple.com>
     2
     3        Add goBack: and goForward: IBActions and move stopLoading: to a new WKIBActions category on WKWebView
     4        https://bugs.webkit.org/show_bug.cgi?id=130732
     5
     6        Reviewed by Tim Horton.
     7
     8        * MiniBrowser/mac/WK2BrowserWindowController.m:
     9        (-[WK2BrowserWindowController validateUserInterfaceItem:]):
     10
    1112014-03-25  Martin Robinson  <mrobinson@igalia.com>
    212
  • trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m

    r165930 r166241  
    195195- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
    196196{
    197     SEL action = [item action];
    198 
    199     if (action == @selector(goBack:))
    200         return _webView && [_webView canGoBack];
    201    
    202     if (action == @selector(goForward:))
    203         return _webView && [_webView canGoForward];
    204    
     197    SEL action = item.action;
     198
     199    if (action == @selector(goBack:) || action == @selector(goForward:))
     200        return [_webView validateUserInterfaceItem:item];
     201
    205202    return YES;
    206203}
Note: See TracChangeset for help on using the changeset viewer.