diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-15 01:05:11 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-15 01:05:11 +0000 |
commit | b73b0c81558e70c7ac4c069b24dd7dbed99548a2 (patch) | |
tree | 16693129f61d3a26cc51968dab833810891b95b2 /chrome/browser/views | |
parent | f3ec774a2c177d3c6845553d3bf9735a7b8a5907 (diff) | |
download | chromium_src-b73b0c81558e70c7ac4c069b24dd7dbed99548a2.zip chromium_src-b73b0c81558e70c7ac4c069b24dd7dbed99548a2.tar.gz chromium_src-b73b0c81558e70c7ac4c069b24dd7dbed99548a2.tar.bz2 |
Fix status bubble positioning with custom border widths by positioning the bubble relative to the client area and then converting to parent coordinates instead of trying to position it absolutely with hardcoded constants.
Also changes an Offset() call to ConvertPointToView(), which is functionally the same but I think clearer in intent.
BUG=5054
TEST=In both Classic and Luna, use the Display control panel to set your active/inactive border widths to something nonstandard (try 20, that's real noticeable) and maximize a Chrome window. Make sure when hovering a link that the status bubble appears aligned with the screen corner instead of partly offscreen.
Review URL: http://codereview.chromium.org/18253
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8059 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index ce04f73..9c28a59 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -61,10 +61,10 @@ static const int kToolbarTabStripVerticalOverlap = 3; static const int kTabShadowSize = 2; // The height of the status bubble. static const int kStatusBubbleHeight = 20; -// The distance of the status bubble from the left edge of the window. -static const int kStatusBubbleHorizontalOffset = 3; -// The distance of the status bubble from the bottom edge of the window. -static const int kStatusBubbleVerticalOffset = 2; +// The overlap of the status bubble with the left edge of the window. +static const int kStatusBubbleHorizontalOverlap = 2; +// The overlap of the status bubble with the bottom edge of the window. +static const int kStatusBubbleVerticalOverlap = 2; // An offset distance between certain toolbars and the toolbar that preceded // them in layout. static const int kSeparationLineHeight = 1; @@ -178,7 +178,9 @@ gfx::Rect BrowserView::GetToolbarBounds() const { gfx::Rect BrowserView::GetClientAreaBounds() const { gfx::Rect container_bounds = contents_container_->bounds(); - container_bounds.Offset(x(), y()); + gfx::Point container_origin = container_bounds.origin(); + ConvertPointToView(this, GetParent(), &container_origin); + container_bounds.set_origin(container_origin); return container_bounds; } @@ -1127,10 +1129,11 @@ int BrowserView::LayoutDownloadShelf() { } void BrowserView::LayoutStatusBubble(int top) { - int status_bubble_y = - top - kStatusBubbleHeight + kStatusBubbleVerticalOffset + y(); - status_bubble_->SetBounds(kStatusBubbleHorizontalOffset, status_bubble_y, - width() / 3, kStatusBubbleHeight); + gfx::Point origin(-kStatusBubbleHorizontalOverlap, + top - kStatusBubbleHeight + kStatusBubbleVerticalOverlap); + ConvertPointToView(this, GetParent(), &origin); + status_bubble_->SetBounds(origin.x(), origin.y(), width() / 3, + kStatusBubbleHeight); } bool BrowserView::MaybeShowBookmarkBar(TabContents* contents) { |