diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-11 20:59:56 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-11 20:59:56 +0000 |
commit | 60ffe9d1ca0a85e4254135d377de1cc47b0987d3 (patch) | |
tree | f1bfd1922104c0b74d7064a1082e72c074b13729 /chrome | |
parent | 3eebe5de65edfcf40efffac399fd6083db4b55f7 (diff) | |
download | chromium_src-60ffe9d1ca0a85e4254135d377de1cc47b0987d3.zip chromium_src-60ffe9d1ca0a85e4254135d377de1cc47b0987d3.tar.gz chromium_src-60ffe9d1ca0a85e4254135d377de1cc47b0987d3.tar.bz2 |
Made RemoveViewFromView() handle top-most subviews.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31708 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/cocoa/preferences_window_controller.mm | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm index ba1f51f..6e5a671 100644 --- a/chrome/browser/cocoa/preferences_window_controller.mm +++ b/chrome/browser/cocoa/preferences_window_controller.mm @@ -263,11 +263,11 @@ void RemoveViewFromView(NSView* view, NSView* toRemove) { NSUInteger index = [views indexOfObject:toRemove]; DCHECK_NE(index, NSNotFound); NSUInteger count = [views count]; - CGFloat shiftDown = 0; + CGFloat shrinkHeight = 0; if (index < (count - 1)) { // The amount to shift is the bottom of |toRemove| to the bottom of the view // above it. - shiftDown = + CGFloat shiftDown = NSMinY([[views objectAtIndex:index + 1] frame]) - NSMinY([toRemove frame]); @@ -278,6 +278,12 @@ void RemoveViewFromView(NSView* view, NSView* toRemove) { origin.y -= shiftDown; [view setFrameOrigin:origin]; } + + shrinkHeight = shiftDown; + } else if (index > 0) { + shrinkHeight = + NSMaxY([toRemove frame]) - + NSMaxY([[views objectAtIndex:index - 1] frame]); } // Remove |toRemove|. @@ -286,7 +292,7 @@ void RemoveViewFromView(NSView* view, NSView* toRemove) { // Resize the view. [GTMUILocalizerAndLayoutTweaker resizeViewWithoutAutoResizingSubViews:view - delta:NSMakeSize(0, -shiftDown)]; + delta:NSMakeSize(0, -shrinkHeight)]; } // Helper to tweak the layout of the "Under the Hood" content by autosizing all |