diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-14 00:13:35 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-14 00:13:35 +0000 |
commit | a6c513da38eac47ff5898153b8995571892ef75a (patch) | |
tree | 9f6875ef691858a7bdcc029b4ae74d8bd1826138 /chrome | |
parent | 98c2b16db508ecbdf0398a78cf68cf4dc938d697 (diff) | |
download | chromium_src-a6c513da38eac47ff5898153b8995571892ef75a.zip chromium_src-a6c513da38eac47ff5898153b8995571892ef75a.tar.gz chromium_src-a6c513da38eac47ff5898153b8995571892ef75a.tar.bz2 |
[Mac] Fix weird layout issues when dragging a tab from a large screen to a small one.
BUG=http://crbug.com/27652
TEST=With two monitors of different vertical sizes connected, make a chrome window on the larger monitor, as tall as the monitor. Drag it over to the smaller monitor and drop it. The window should not re-layout weirdly during the drag and should continue to have a tab strip after the drop.
Review URL: http://codereview.chromium.org/385106
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31967 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/cocoa/chrome_browser_window.mm | 14 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_window_controller.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_window_controller.mm | 6 |
3 files changed, 23 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/chrome_browser_window.mm b/chrome/browser/cocoa/chrome_browser_window.mm index 20d3c77..c4b503b 100644 --- a/chrome/browser/cocoa/chrome_browser_window.mm +++ b/chrome/browser/cocoa/chrome_browser_window.mm @@ -329,4 +329,18 @@ namespace { return shouldHideTitle_; } +// This method is called whenever a window is moved in order to ensure it fits +// on the screen. We cannot always handle resizes without breaking, so we +// prevent frame constraining in those cases. +- (NSRect)constrainFrameRect:(NSRect)frame toScreen:(NSScreen*)screen { + // Do not constrain the frame rect if our delegate says no. In this case, + // return the original (unconstrained) frame. + id delegate = [self delegate]; + if ([delegate respondsToSelector:@selector(shouldConstrainFrameRect)] && + ![delegate shouldConstrainFrameRect]) + return frame; + + return [super constrainFrameRect:frame toScreen:screen]; +} + @end diff --git a/chrome/browser/cocoa/tab_window_controller.h b/chrome/browser/cocoa/tab_window_controller.h index 04346e5..c9c2589 100644 --- a/chrome/browser/cocoa/tab_window_controller.h +++ b/chrome/browser/cocoa/tab_window_controller.h @@ -49,6 +49,9 @@ - (void)removeOverlayAfterDelay:(NSTimeInterval)delay; - (NSWindow*)overlayWindow; +// Returns YES if it is ok to constrain the window's frame to fit the screen. +- (BOOL)shouldConstrainFrameRect; + // A collection of methods, stubbed out in this base class, that provide // the implementation of tab dragging based on whatever model is most // appropriate. diff --git a/chrome/browser/cocoa/tab_window_controller.mm b/chrome/browser/cocoa/tab_window_controller.mm index b627214..c8e881c 100644 --- a/chrome/browser/cocoa/tab_window_controller.mm +++ b/chrome/browser/cocoa/tab_window_controller.mm @@ -125,6 +125,12 @@ return overlayWindow_; } +- (BOOL)shouldConstrainFrameRect { + // If we currently have an overlay window, do not attempt to change the + // window's size, as our overlay window doesn't know how to resize properly. + return overlayWindow_ == nil; +} + - (BOOL)canReceiveFrom:(TabWindowController*)source { // subclass must implement NOTIMPLEMENTED(); |