Share the implementation of MiniBrowser view hiding functionality
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 Jan 2017 21:08:43 +0000 (21:08 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 Jan 2017 21:08:43 +0000 (21:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=166800

Reviewed by Andy Estes.

* MiniBrowser/mac/BrowserWindowController.m:
(-[BrowserWindowController showHideWebView:]):
(-[BrowserWindowController removeReinsertWebView:]):
* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController showHideWebView:]): Deleted.
(-[WK1BrowserWindowController removeReinsertWebView:]): Deleted.
* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController showHideWebView:]): Deleted.
(-[WK2BrowserWindowController removeReinsertWebView:]): Deleted.
Move the implementation of these two things to the shared superclass,
since they don't depend on WebKit-specific things.
Also, there was no reason to retain the (WK)WebView while it was unparented,
as the BrowserWindowController maintains a reference the entire time.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210481 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/MiniBrowser/mac/BrowserWindowController.m
Tools/MiniBrowser/mac/WK1BrowserWindowController.m
Tools/MiniBrowser/mac/WK2BrowserWindowController.m

index 5908528..4710518 100644 (file)
@@ -1,3 +1,24 @@
+2017-01-07  Tim Horton  <timothy_horton@apple.com>
+
+        Share the implementation of MiniBrowser view hiding functionality
+        https://bugs.webkit.org/show_bug.cgi?id=166800
+
+        Reviewed by Andy Estes.
+
+        * MiniBrowser/mac/BrowserWindowController.m:
+        (-[BrowserWindowController showHideWebView:]):
+        (-[BrowserWindowController removeReinsertWebView:]):
+        * MiniBrowser/mac/WK1BrowserWindowController.m:
+        (-[WK1BrowserWindowController showHideWebView:]): Deleted.
+        (-[WK1BrowserWindowController removeReinsertWebView:]): Deleted.
+        * MiniBrowser/mac/WK2BrowserWindowController.m:
+        (-[WK2BrowserWindowController showHideWebView:]): Deleted.
+        (-[WK2BrowserWindowController removeReinsertWebView:]): Deleted.
+        Move the implementation of these two things to the shared superclass,
+        since they don't depend on WebKit-specific things.
+        Also, there was no reason to retain the (WK)WebView while it was unparented,
+        as the BrowserWindowController maintains a reference the entire time.
+
 2017-01-06  Andy Estes  <aestes@apple.com>
 
         [Cocoa] Consolidate duplicate copies of WebArchiveDumpSupport in DRT and WKTR into WebCoreTestSupport
index 6c4b135..92d8733 100644 (file)
 
 - (IBAction)showHideWebView:(id)sender
 {
-    [self doesNotRecognizeSelector:_cmd];
+    self.mainContentView.hidden = !self.mainContentView.isHidden;
 }
 
 - (IBAction)removeReinsertWebView:(id)sender
 {
-    [self doesNotRecognizeSelector:_cmd];
+    if (self.mainContentView.window)
+        [self.mainContentView removeFromSuperview];
+    else
+        [containerView addSubview:self.mainContentView];
 }
 
 - (IBAction)zoomIn:(id)sender
index 83f40a5..93c5ff7 100644 (file)
     [[_webView mainFrame] loadRequest:[NSURLRequest requestWithURL:url]];
 }
 
-- (IBAction)showHideWebView:(id)sender
-{
-    BOOL hidden = ![_webView isHidden];
-    
-    [_webView setHidden:hidden];
-}
-
-- (IBAction)removeReinsertWebView:(id)sender
-{
-    if ([_webView window]) {
-        [_webView retain];
-        [_webView removeFromSuperview]; 
-    } else {
-        [containerView addSubview:_webView];
-        [_webView release];
-    }
-}
-
 - (IBAction)setPageScale:(id)sender
 {
     CGFloat scale = [self pageScaleForMenuItemTag:[sender tag]];
index fd0f6c4..f2546da 100644 (file)
@@ -124,24 +124,6 @@ static const int testFooterBannerHeight = 58;
     [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL _webkit_URLWithUserTypedString:[urlText stringValue]]]];
 }
 
-- (IBAction)showHideWebView:(id)sender
-{
-    BOOL hidden = ![_webView isHidden];
-    
-    [_webView setHidden:hidden];
-}
-
-- (IBAction)removeReinsertWebView:(id)sender
-{
-    if ([_webView window]) {
-        [_webView retain];
-        [_webView removeFromSuperview]; 
-    } else {
-        [containerView addSubview:_webView];
-        [_webView release];
-    }
-}
-
 - (IBAction)setPageScale:(id)sender
 {
     CGFloat scale = [self pageScaleForMenuItemTag:[sender tag]];