diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-04 19:16:28 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-04 19:16:28 +0000 |
commit | a3046083f16194a4e5d783e5933b26f7bddb4a8c (patch) | |
tree | 04cb7afa214eea31a62cfd82cb9d1f8c9af80f7b /chrome/browser/cocoa/find_bar_cocoa_controller.mm | |
parent | 61e27acc8de9d271950c4adbae678fa4bdd28a09 (diff) | |
download | chromium_src-a3046083f16194a4e5d783e5933b26f7bddb4a8c.zip chromium_src-a3046083f16194a4e5d783e5933b26f7bddb4a8c.tar.gz chromium_src-a3046083f16194a4e5d783e5933b26f7bddb4a8c.tar.bz2 |
Mac: fullscreen mode find bar positioning fix.
Always position the find bar (if visible) below the visually contiguous toolbar
(i.e., toolbar + maybe bookmark bar). In fullscreen mode, this may mean that it
hangs off the top of the screen, which is intended.
BUG=31638
TEST=Find bar still works normally (and is positioned correctly) in non-fullscreen mode. For developers who know how to enable fullscreen mode, it should be positioned as described above and work correctly.
Review URL: http://codereview.chromium.org/572006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/find_bar_cocoa_controller.mm')
-rw-r--r-- | chrome/browser/cocoa/find_bar_cocoa_controller.mm | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/chrome/browser/cocoa/find_bar_cocoa_controller.mm b/chrome/browser/cocoa/find_bar_cocoa_controller.mm index 05ae37a..c78a1bc 100644 --- a/chrome/browser/cocoa/find_bar_cocoa_controller.mm +++ b/chrome/browser/cocoa/find_bar_cocoa_controller.mm @@ -99,27 +99,18 @@ const float kFindBarCloseDuration = 0.15; stopSearch:YES]; } -// Positions the find bar container view in the correct location based on the -// current state of the window. The find bar container is always positioned one -// pixel above the infobar container. Note that we are using the infobar -// container location as a proxy for the toolbar location, but we cannot -// position based on the toolbar because the toolbar is not always present (for -// example in fullscreen windows). -- (void)positionFindBarView:(NSView*)infoBarContainerView { - static const int kRightEdgeOffset = 25; +- (void)positionFindBarViewAtMaxY:(CGFloat)maxY maxWidth:(CGFloat)maxWidth { + static const CGFloat kRightEdgeOffset = 25; NSView* containerView = [self view]; - int containerHeight = NSHeight([containerView frame]); - int containerWidth = NSWidth([containerView frame]); - - // Start by computing the upper right corner of the infobar container, then - // move left by a constant offset and up one pixel. This gives us the upper - // right corner of our bounding box. We move up one pixel to overlap with the - // toolbar area, which allows us to cover up the toolbar's border, if present. - NSRect windowRect = [infoBarContainerView frame]; - int max_x = NSMaxX(windowRect) - kRightEdgeOffset; - int max_y = NSMaxY(windowRect) + 1; - - NSRect newFrame = NSMakeRect(max_x - containerWidth, max_y - containerHeight, + CGFloat containerHeight = NSHeight([containerView frame]); + CGFloat containerWidth = NSWidth([containerView frame]); + + // Adjust where we'll actually place the find bar. + CGFloat maxX = maxWidth - kRightEdgeOffset; + DLOG_IF(WARNING, maxX < 0) << "Window too narrow for find bar"; + maxY += 1; + + NSRect newFrame = NSMakeRect(maxX - containerWidth, maxY - containerHeight, containerWidth, containerHeight); [containerView setFrame:newFrame]; } |