diff options
author | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-10 18:05:11 +0000 |
---|---|---|
committer | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-10 18:05:11 +0000 |
commit | e62090e3bd77a23a23e350d38776fd56dd8c74fc (patch) | |
tree | ac017cdce9939006e6cc3255d555c4438de85388 /chrome | |
parent | 960133a6919b514507cdab560493b04de70b3715 (diff) | |
download | chromium_src-e62090e3bd77a23a23e350d38776fd56dd8c74fc.zip chromium_src-e62090e3bd77a23a23e350d38776fd56dd8c74fc.tar.gz chromium_src-e62090e3bd77a23a23e350d38776fd56dd8c74fc.tar.bz2 |
Fix grab bag of AeroGlassFrame issues:
- better names and documentation for varions kOnstants in the AeroGlassNonClientView
- AeroGlassFrame now uses the actual bounds of the tabstrip to adjust the DWM frame, rather than hard-coding constants.
- fix bug in hit testing that meant that tabs weren't selectable... wrong coordinate system used for one function call... not sure how this didn't affect XP?!!
B=1031854
Review URL: http://codereview.chromium.org/1882
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1996 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/views/frame/aero_glass_frame.cc | 8 | ||||
-rw-r--r-- | chrome/browser/views/frame/aero_glass_non_client_view.cc | 28 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_frame.h | 2 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view2.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view2.h | 3 |
5 files changed, 22 insertions, 21 deletions
diff --git a/chrome/browser/views/frame/aero_glass_frame.cc b/chrome/browser/views/frame/aero_glass_frame.cc index 2ebbea4..2d7d4bf 100644 --- a/chrome/browser/views/frame/aero_glass_frame.cc +++ b/chrome/browser/views/frame/aero_glass_frame.cc @@ -191,10 +191,6 @@ void AeroGlassFrame::UpdateDWMFrame() { if (!client_view()) return; - // TODO(beng): when TabStrip is hooked up, obtain this offset from its - // bounds. - int toolbar_y = 36; - // We only adjust the DWM's glass rendering when we're a browser window or a // detached popup. App windows get the standard client edge. if (browser_view_->IsTabStripVisible() || @@ -208,8 +204,10 @@ void AeroGlassFrame::UpdateDWMFrame() { int client_edge_bottom_height = kWindowsDWMBevelSize; int client_edge_top_height = kWindowsDWMBevelSize; if (browser_view_->IsTabStripVisible()) { + gfx::Rect tabstrip_bounds = + GetBoundsForTabStrip(browser_view_->tabstrip()); client_edge_top_height = - client_view()->GetY() + kToolbarOverlapVertOffset + toolbar_y; + client_view()->GetY() + tabstrip_bounds.bottom(); } // Now poke the DWM. diff --git a/chrome/browser/views/frame/aero_glass_non_client_view.cc b/chrome/browser/views/frame/aero_glass_non_client_view.cc index a9d0aa0..6657355 100644 --- a/chrome/browser/views/frame/aero_glass_non_client_view.cc +++ b/chrome/browser/views/frame/aero_glass_non_client_view.cc @@ -100,18 +100,18 @@ SkBitmap AeroGlassNonClientView::distributor_logo_; // The distance between the top of the TabStrip and the top of the non-client // area of the window. static const int kNoTitleTopSpacing = 8; -// TODO(beng): figure out what this is for. -static const int kWindowHorizontalBorderSize = 2; -// TODO(beng): figure out what this is for. -static const int kWindowVerticalBorderSize = 2; +// The width of the client edge to the left and right of the window. +static const int kWindowHorizontalClientEdgeWidth = 2; +// The height of the client edge to the bottom of the window. +static const int kWindowBottomClientEdgeHeight = 2; // The horizontal distance between the left of the minimize button and the // right edge of the distributor logo. static const int kDistributorLogoHorizontalOffset = 7; // The distance from the top of the non-client view and the top edge of the // distributor logo. static const int kDistributorLogoVerticalOffset = 3; -// TODO(beng): figure out what this is for. -static const int kTitlebarHeight = 14; +// The distance of the TabStrip from the top of the window's client area. +static const int kTabStripY = 14; // A single pixel. static const int kPixel = 1; // The height of the sizing border. @@ -146,7 +146,7 @@ gfx::Rect AeroGlassNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) { tabstrip_width -= (tabstrip_width - titlebar_info.rgrect[2].left); } int tabstrip_height = tabstrip->GetPreferredHeight(); - return gfx::Rect(0, kTitlebarHeight, tabstrip_width, tabstrip_height); + return gfx::Rect(0, kTabStripY, tabstrip_width, tabstrip_height); } /////////////////////////////////////////////////////////////////////////////// @@ -160,17 +160,17 @@ gfx::Rect AeroGlassNonClientView::CalculateClientAreaBounds(int width, } int top_margin = CalculateNonClientTopHeight(); - return gfx::Rect(kWindowHorizontalBorderSize, top_margin, - std::max(0, width - (2 * kWindowHorizontalBorderSize)), - std::max(0, height - top_margin - kWindowVerticalBorderSize)); + return gfx::Rect(kWindowHorizontalClientEdgeWidth, top_margin, + std::max(0, width - (2 * kWindowHorizontalClientEdgeWidth)), + std::max(0, height - top_margin - kWindowBottomClientEdgeHeight)); } gfx::Size AeroGlassNonClientView::CalculateWindowSizeForClientSize( int width, int height) const { int top_margin = CalculateNonClientTopHeight(); - return gfx::Size(width + (2 * kWindowHorizontalBorderSize), - height + top_margin + kWindowVerticalBorderSize); + return gfx::Size(width + (2 * kWindowHorizontalClientEdgeWidth), + height + top_margin + kWindowBottomClientEdgeHeight); } CPoint AeroGlassNonClientView::GetSystemMenuPoint() const { @@ -236,8 +236,8 @@ void AeroGlassNonClientView::Layout() { void AeroGlassNonClientView::GetPreferredSize(CSize* out) { DCHECK(out); frame_->client_view()->GetPreferredSize(out); - out->cx += 2 * kWindowHorizontalBorderSize; - out->cy += CalculateNonClientTopHeight() + kWindowVerticalBorderSize; + out->cx += 2 * kWindowHorizontalClientEdgeWidth; + out->cy += CalculateNonClientTopHeight() + kWindowBottomClientEdgeHeight; } void AeroGlassNonClientView::DidChangeBounds(const CRect& previous, diff --git a/chrome/browser/views/frame/browser_frame.h b/chrome/browser/views/frame/browser_frame.h index c551cc1..db87a71 100644 --- a/chrome/browser/views/frame/browser_frame.h +++ b/chrome/browser/views/frame/browser_frame.h @@ -34,7 +34,7 @@ class BrowserFrame { virtual void SizeToContents(const gfx::Rect& contents_bounds) = 0; // Returns the bounds that should be used to size and position the specified - // TabStrip. + // TabStrip. The coordinate system is that of the window's client area. virtual gfx::Rect GetBoundsForTabStrip(TabStrip* tabstrip) const = 0; // Returns the ChromeViews::Window associated with this frame. diff --git a/chrome/browser/views/frame/browser_view2.cc b/chrome/browser/views/frame/browser_view2.cc index 607ddb0..b89cadf 100644 --- a/chrome/browser/views/frame/browser_view2.cc +++ b/chrome/browser/views/frame/browser_view2.cc @@ -696,7 +696,7 @@ int BrowserView2::NonClientHitTest(const gfx::Point& point) { CPoint point_in_tabstrip_coords(point.ToPOINT()); View::ConvertPointToView(GetParent(), tabstrip_, &point_in_tabstrip_coords); if (tabstrip_->HitTest(point_in_tabstrip_coords)) { - if (tabstrip_->PointIsWithinWindowCaption(point_in_view_coords)) + if (tabstrip_->PointIsWithinWindowCaption(point_in_tabstrip_coords)) return HTCAPTION; return HTCLIENT; } diff --git a/chrome/browser/views/frame/browser_view2.h b/chrome/browser/views/frame/browser_view2.h index 58723f7..5d97e58 100644 --- a/chrome/browser/views/frame/browser_view2.h +++ b/chrome/browser/views/frame/browser_view2.h @@ -56,6 +56,9 @@ class BrowserView2 : public BrowserWindow, // avatar icon. int GetTabStripHeight() const; + // Accessor for the TabStrip. + TabStrip* tabstrip() const { return tabstrip_; } + // Returns true if various window components are visible. bool IsToolbarVisible() const; bool IsTabStripVisible() const; |