Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller.mm

Issue 1052123006: Prevent bookmarks bar toggling from decreasing window height to 0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <numeric> 8 #include <numeric>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 - (BOOL)adjustWindowHeightBy:(CGFloat)deltaH { 831 - (BOOL)adjustWindowHeightBy:(CGFloat)deltaH {
832 // By not adjusting the window height when initializing, we can ensure that 832 // By not adjusting the window height when initializing, we can ensure that
833 // the window opens with the same size that was saved on close. 833 // the window opens with the same size that was saved on close.
834 if (initializing_ || [self isInAnyFullscreenMode] || deltaH == 0) 834 if (initializing_ || [self isInAnyFullscreenMode] || deltaH == 0)
835 return NO; 835 return NO;
836 836
837 NSWindow* window = [self window]; 837 NSWindow* window = [self window];
838 NSRect windowFrame = [window frame]; 838 NSRect windowFrame = [window frame];
839 NSRect workarea = [[window screen] visibleFrame]; 839 NSRect workarea = [[window screen] visibleFrame];
840 840
841 // Prevent the window from growing smaller than its minimum height:
842 // http://crbug.com/230400 .
843 if (deltaH < 0) {
844 NSSize minWindowSize = [window minSize];
Avi (use Gerrit) 2015/04/15 04:27:26 Might as well do CGFloat minWindowHeight = [windo
shrike 2015/04/15 17:01:33 Agreed.
845 if (windowFrame.size.height + deltaH < minWindowSize.height) {
846 // |deltaH| + |windowFrame.size.height| = |minWindowSize.height|.
847 deltaH = minWindowSize.height - windowFrame.size.height;
848 }
849 if (deltaH == 0) {
850 return NO;
851 }
852 }
853
841 // If the window is not already fully in the workarea, do not adjust its frame 854 // If the window is not already fully in the workarea, do not adjust its frame
842 // at all. 855 // at all.
843 if (!NSContainsRect(workarea, windowFrame)) 856 if (!NSContainsRect(workarea, windowFrame))
844 return NO; 857 return NO;
845 858
846 // Record the position of the top/bottom of the window, so we can easily check 859 // Record the position of the top/bottom of the window, so we can easily check
847 // whether we grew the window upwards/downwards. 860 // whether we grew the window upwards/downwards.
848 CGFloat oldWindowMaxY = NSMaxY(windowFrame); 861 CGFloat oldWindowMaxY = NSMaxY(windowFrame);
849 CGFloat oldWindowMinY = NSMinY(windowFrame); 862 CGFloat oldWindowMinY = NSMinY(windowFrame);
850 863
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after
2206 2219
2207 - (BOOL)supportsBookmarkBar { 2220 - (BOOL)supportsBookmarkBar {
2208 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR]; 2221 return [self supportsWindowFeature:Browser::FEATURE_BOOKMARKBAR];
2209 } 2222 }
2210 2223
2211 - (BOOL)isTabbedWindow { 2224 - (BOOL)isTabbedWindow {
2212 return browser_->is_type_tabbed(); 2225 return browser_->is_type_tabbed();
2213 } 2226 }
2214 2227
2215 @end // @implementation BrowserWindowController(WindowType) 2228 @end // @implementation BrowserWindowController(WindowType)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698