summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-10 21:06:30 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-10 21:06:30 +0000
commitf2a57883ebd85748688e4a5f1d133a06e4ae5cee (patch)
treec4999f886d9a7f2e835ce4cf1740e6a15f9ce6f5 /chrome
parent2af00e8a9351952b24fa74d1b87ddc5cdff7a3a7 (diff)
downloadchromium_src-f2a57883ebd85748688e4a5f1d133a06e4ae5cee.zip
chromium_src-f2a57883ebd85748688e4a5f1d133a06e4ae5cee.tar.gz
chromium_src-f2a57883ebd85748688e4a5f1d133a06e4ae5cee.tar.bz2
Merge 120895 - mac: Invalidate resize box rect if the download shelf opens.
But only if the shelf opening doesn't resize the web window. Reviewed as part of http://codereview.chromium.org/9159057/ BUG=111266 TEST=open page with scrollbar, save it. no resize corner in web. Resize window a bit, close download shelf. resize corner doesn't overlap scrollbar. TBR=avi Review URL: http://codereview.chromium.org/9362003 TBR=thakis@chromium.org Review URL: https://chromiumcodereview.appspot.com/9378020 git-svn-id: svn://svn.chromium.org/chrome/branches/1025/src@121530 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/ui/cocoa/browser_window_cocoa.mm2
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.h3
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm31
3 files changed, 29 insertions, 7 deletions
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
index e2e9492..43a353e 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
@@ -376,6 +376,8 @@ bool BrowserWindowCocoa::IsToolbarVisible() const {
}
gfx::Rect BrowserWindowCocoa::GetRootWindowResizerRect() const {
+ if (IsDownloadShelfVisible())
+ return gfx::Rect();
NSRect tabRect = [controller_ selectedTabGrowBoxRect];
return gfx::Rect(NSRectToCGRect(tabRect));
}
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.h b/chrome/browser/ui/cocoa/browser_window_controller.h
index 0a2ecbc..9fdac23 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.h
+++ b/chrome/browser/ui/cocoa/browser_window_controller.h
@@ -453,7 +453,8 @@ class WebContents;
// partially offscreen, its height is not adjusted at all. This function
// prefers to grow the window down, but will grow up if needed. Calls to this
// function should be followed by a call to |layoutSubviews|.
-- (void)adjustWindowHeightBy:(CGFloat)deltaH;
+// Returns if the window height was changed.
+- (BOOL)adjustWindowHeightBy:(CGFloat)deltaH;
// Return an autoreleased NSWindow suitable for fullscreen use.
- (NSWindow*)createFullscreenWindow;
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index 627ec8a..eb1566a 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -62,6 +62,7 @@
#include "chrome/browser/ui/window_sizer.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
+#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "grit/generated_resources.h"
@@ -767,11 +768,11 @@ enum {
}
// Adjusts the window height by the given amount.
-- (void)adjustWindowHeightBy:(CGFloat)deltaH {
+- (BOOL)adjustWindowHeightBy:(CGFloat)deltaH {
// By not adjusting the window height when initializing, we can ensure that
// the window opens with the same size that was saved on close.
if (initializing_ || [self isFullscreen] || deltaH == 0)
- return;
+ return NO;
NSWindow* window = [self window];
NSRect windowFrame = [window frame];
@@ -780,7 +781,7 @@ enum {
// If the window is not already fully in the workarea, do not adjust its frame
// at all.
if (!NSContainsRect(workarea, windowFrame))
- return;
+ return NO;
// Record the position of the top/bottom of the window, so we can easily check
// whether we grew the window upwards/downwards.
@@ -827,13 +828,13 @@ enum {
// here. Don't reset |isShrinkingFromZoomed_| since we might get called
// again for the same shrink.
if (isShrinkingFromZoomed_ && !didChange)
- return;
+ return NO;
} else {
isShrinkingFromZoomed_ = NO;
// Don't bother with anything else.
if (isZoomed)
- return;
+ return NO;
}
// Shrinking from zoomed is handled above (and is constrained by
@@ -870,6 +871,7 @@ enum {
[contentView setAutoresizesSubviews:NO];
[window setFrame:windowFrame display:NO];
[contentView setAutoresizesSubviews:YES];
+ return YES;
}
// Main method to resize browser window subviews. This method should be called
@@ -904,17 +906,34 @@ enum {
BOOL shouldAdjustBookmarkHeight =
[bookmarkBarController_ isAnimatingBetweenState:bookmarks::kHiddenState
andState:bookmarks::kShowingState];
+
+ BOOL resizeRectDirty = NO;
if ((shouldAdjustBookmarkHeight && view == [bookmarkBarController_ view]) ||
view == [downloadShelfController_ view]) {
[[self window] disableScreenUpdatesUntilFlush];
CGFloat deltaH = height - frame.size.height;
- [self adjustWindowHeightBy:deltaH];
+ if ([self adjustWindowHeightBy:deltaH] &&
+ view == [downloadShelfController_ view]) {
+ // If the window height didn't change, the download shelf will change the
+ // size of the contents. If the contents size doesn't change, send it
+ // an explicit grow box invalidation (else, the resize message does that.)
+ resizeRectDirty = YES;
+ }
}
frame.size.height = height;
// TODO(rohitrao): Determine if calling setFrame: twice is bad.
[view setFrame:frame];
[self layoutSubviews];
+
+ if (resizeRectDirty) {
+ // Send new resize rect to foreground tab.
+ if (content::WebContents* contents = browser_->GetSelectedWebContents()) {
+ if (RenderViewHost* rvh = contents->GetRenderViewHost()) {
+ rvh->ResizeRectChanged(windowShim_->GetRootWindowResizerRect());
+ }
+ }
+ }
}
- (void)setAnimationInProgress:(BOOL)inProgress {