OLD | NEW |
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 Loading... |
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 CGFloat minWindowHeight = [window minSize].height; |
| 845 if (windowFrame.size.height + deltaH < minWindowHeight) { |
| 846 // |deltaH| + |windowFrame.size.height| = |minWindowHeight|. |
| 847 deltaH = minWindowHeight - 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 Loading... |
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) |
OLD | NEW |