diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-26 01:28:52 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-26 01:28:52 +0000 |
commit | 0191afb579f359623cf31a956ec8d602057ffdcb (patch) | |
tree | 11c9f6d84346e718b92d37bff1c2edcf6786c16d | |
parent | 58377e2edb08dabeeba8a01bfb4484eb61527b4a (diff) | |
download | chromium_src-0191afb579f359623cf31a956ec8d602057ffdcb.zip chromium_src-0191afb579f359623cf31a956ec8d602057ffdcb.tar.gz chromium_src-0191afb579f359623cf31a956ec8d602057ffdcb.tar.bz2 |
Fix fullscreen mode opacity issues on Aero glass. We need to not extend the glass into the client area at all in fullscreen mode or text over it becomes semitransparent.
Because I can't use "IsTabStripVisible()" to indicate "do we need to goof with the window frame" anymore, I've introduced "IsNormalMode()" instead, and tried to change callers of the former to use the latter where appropriate.
BUG=8066
Review URL: http://codereview.chromium.org/28159
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10431 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/views/frame/aero_glass_frame.cc | 35 | ||||
-rw-r--r-- | chrome/browser/views/frame/aero_glass_non_client_view.cc | 33 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 13 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.h | 6 | ||||
-rw-r--r-- | chrome/browser/views/frame/opaque_non_client_view.cc | 18 |
5 files changed, 64 insertions, 41 deletions
diff --git a/chrome/browser/views/frame/aero_glass_frame.cc b/chrome/browser/views/frame/aero_glass_frame.cc index d51b69c..bc9b0f2 100644 --- a/chrome/browser/views/frame/aero_glass_frame.cc +++ b/chrome/browser/views/frame/aero_glass_frame.cc @@ -132,7 +132,7 @@ LRESULT AeroGlassFrame::OnNCActivate(BOOL active) { return TRUE; if (!frame_initialized_) { - if (browser_view_->IsTabStripVisible()) { + if (browser_view_->IsBrowserTypeNormal()) { ::SetWindowPos(GetHWND(), NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_FRAMECHANGED); UpdateDWMFrame(); @@ -145,16 +145,19 @@ LRESULT AeroGlassFrame::OnNCActivate(BOOL active) { } LRESULT AeroGlassFrame::OnNCCalcSize(BOOL mode, LPARAM l_param) { - if (!browser_view_->IsTabStripVisible() || !mode) { + if (!browser_view_->IsBrowserTypeNormal() || !mode) { SetMsgHandled(FALSE); return 0; } - NCCALCSIZE_PARAMS* params = reinterpret_cast<NCCALCSIZE_PARAMS*>(l_param); - int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); - params->rgrc[0].left += (border_thickness - kClientEdgeThickness); - params->rgrc[0].right -= (border_thickness - kClientEdgeThickness); - params->rgrc[0].bottom -= (border_thickness - kClientEdgeThickness); + // In fullscreen mode, we make the whole window client area. + if (!browser_view_->IsFullscreen()) { + NCCALCSIZE_PARAMS* params = reinterpret_cast<NCCALCSIZE_PARAMS*>(l_param); + int border_thickness = GetSystemMetrics(SM_CXSIZEFRAME); + params->rgrc[0].left += (border_thickness - kClientEdgeThickness); + params->rgrc[0].right -= (border_thickness - kClientEdgeThickness); + params->rgrc[0].bottom -= (border_thickness - kClientEdgeThickness); + } UpdateDWMFrame(); @@ -186,13 +189,17 @@ void AeroGlassFrame::UpdateDWMFrame() { if (!client_view()) return; - MARGINS margins = { kClientEdgeThickness + 1, - kClientEdgeThickness + 1, - GetBoundsForTabStrip(browser_view_->tabstrip()).bottom(), - kClientEdgeThickness + 1 }; - // Note: we don't use DwmEnableBlurBehindWindow because any region not - // included in the glass region is composited source over. This means - // that anything drawn directly with GDI appears fully transparent. + // In fullscreen mode, we don't extend glass into the client area at all, + // because the GDI-drawn text in the web content composited over it will + // become semi-transparent over any glass area. + MARGINS margins = { 0 }; + if (!browser_view_->IsFullscreen()) { + margins.cxLeftWidth = kClientEdgeThickness + 1; + margins.cxRightWidth = kClientEdgeThickness + 1; + margins.cyTopHeight = + GetBoundsForTabStrip(browser_view_->tabstrip()).bottom(); + margins.cyBottomHeight = kClientEdgeThickness + 1; + } DwmExtendFrameIntoClientArea(GetHWND(), &margins); } 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 6c5589e..cf8ba83 100644 --- a/chrome/browser/views/frame/aero_glass_non_client_view.cc +++ b/chrome/browser/views/frame/aero_glass_non_client_view.cc @@ -150,7 +150,7 @@ gfx::Size AeroGlassNonClientView::CalculateWindowSizeForClientSize( gfx::Point AeroGlassNonClientView::GetSystemMenuPoint() const { gfx::Point system_menu_point; - if (browser_view_->IsTabStripVisible()) { + if (browser_view_->IsBrowserTypeNormal()) { // The maximized mode bit here is because in maximized mode the frame edge // and the client edge are both offscreen, whereas in the opaque frame // (where we don't do this trick) maximized windows have no client edge and @@ -167,10 +167,11 @@ gfx::Point AeroGlassNonClientView::GetSystemMenuPoint() const { } int AeroGlassNonClientView::NonClientHitTest(const gfx::Point& point) { - // If we don't have a tabstrip, we haven't customized the frame, so Windows - // can figure this out. If the point isn't within our bounds, then it's in - // the native portion of the frame, so again Windows can figure it out. - if (!browser_view_->IsTabStripVisible() || !bounds().Contains(point)) + // If the browser isn't in normal mode, we haven't customized the frame, so + // Windows can figure this out. If the point isn't within our bounds, then + // it's in the native portion of the frame, so again Windows can figure it + // out. + if (!browser_view_->IsBrowserTypeNormal() || !bounds().Contains(point)) return HTNOWHERE; int frame_component = frame_->client_view()->NonClientHitTest(point); @@ -190,12 +191,13 @@ int AeroGlassNonClientView::NonClientHitTest(const gfx::Point& point) { // AeroGlassNonClientView, views::View overrides: void AeroGlassNonClientView::Paint(ChromeCanvas* canvas) { + if (!browser_view_->IsTabStripVisible()) + return; // Nothing is visible, so don't bother to paint. + PaintDistributorLogo(canvas); - if (browser_view_->IsTabStripVisible()) - PaintToolbarBackground(canvas); + PaintToolbarBackground(canvas); PaintOTRAvatar(canvas); - if (browser_view_->IsTabStripVisible()) - PaintClientEdge(canvas); + PaintClientEdge(canvas); } void AeroGlassNonClientView::Layout() { @@ -323,10 +325,15 @@ void AeroGlassNonClientView::LayoutDistributorLogo() { void AeroGlassNonClientView::LayoutOTRAvatar() { SkBitmap otr_avatar_icon = browser_view_->GetOTRAvatarIcon(); int top_height = NonClientTopBorderHeight(); - int tabstrip_height = browser_view_->GetTabStripHeight() - kOTRBottomSpacing; - int otr_height = frame_->IsMaximized() ? - (tabstrip_height - kOTRMaximizedTopSpacing) : - otr_avatar_icon.height(); + int tabstrip_height, otr_height; + if (browser_view_->IsTabStripVisible()) { + tabstrip_height = browser_view_->GetTabStripHeight() - kOTRBottomSpacing; + otr_height = frame_->IsMaximized() ? + (tabstrip_height - kOTRMaximizedTopSpacing) : + otr_avatar_icon.height(); + } else { + tabstrip_height = otr_height = 0; + } otr_avatar_bounds_.SetRect(NonClientBorderThickness() + kOTRSideSpacing, top_height + tabstrip_height - otr_height, otr_avatar_icon.width(), otr_height); diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index d1aae0b..5976013 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -304,7 +304,7 @@ gfx::Rect BrowserView::GetFindBarBoundingBox() const { } int BrowserView::GetTabStripHeight() const { - return tabstrip_->GetPreferredHeight(); + return tabstrip_->height(); } bool BrowserView::IsToolbarVisible() const { @@ -321,7 +321,7 @@ bool BrowserView::IsOffTheRecord() const { } bool BrowserView::ShouldShowOffTheRecordAvatar() const { - return IsOffTheRecord() && browser_->type() == Browser::TYPE_NORMAL; + return IsOffTheRecord() && IsBrowserTypeNormal(); } bool BrowserView::AcceleratorPressed(const views::Accelerator& accelerator) { @@ -1267,7 +1267,7 @@ void BrowserView::InitSystemMenu() { int insertion_index = std::max(0, system_menu_->ItemCount() - 1); // We add the menu items in reverse order so that insertion_index never needs // to change. - if (browser_->type() == Browser::TYPE_NORMAL) { + if (IsBrowserTypeNormal()) { system_menu_->AddSeparator(insertion_index); system_menu_->AddMenuItemWithLabel(insertion_index, IDC_TASK_MANAGER, l10n_util::GetString(IDS_TASK_MANAGER)); @@ -1279,16 +1279,15 @@ void BrowserView::InitSystemMenu() { } bool BrowserView::SupportsWindowFeature(WindowFeature feature) const { - const Browser::Type type = browser_->type(); unsigned int features = FEATURE_INFOBAR | FEATURE_DOWNLOADSHELF; - if (type == Browser::TYPE_NORMAL) + if (IsBrowserTypeNormal()) features |= FEATURE_BOOKMARKBAR; if (!fullscreen_) { - if (type == Browser::TYPE_NORMAL) + if (IsBrowserTypeNormal()) features |= FEATURE_TABSTRIP | FEATURE_TOOLBAR; else features |= FEATURE_TITLEBAR; - if (type != Browser::TYPE_APP) + if (browser_->type() != Browser::TYPE_APP) features |= FEATURE_LOCATIONBAR; } return !!(features & feature); diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index 12634b9..592e264 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -163,6 +163,12 @@ class BrowserView : public BrowserWindow, FEATURE_DOWNLOADSHELF = 64 }; + // Returns true if the Browser object associated with this BrowserView is a + // normal-type window (i.e. a browser window, not an app or popup). + bool IsBrowserTypeNormal() const { + return browser_->type() == Browser::TYPE_NORMAL; + } + // Register preferences specific to this view. static void RegisterBrowserViewPrefs(PrefService* prefs); diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc index d1bb800..7aa2d60 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.cc +++ b/chrome/browser/views/frame/opaque_non_client_view.cc @@ -470,10 +470,9 @@ gfx::Size OpaqueNonClientView::CalculateWindowSizeForClientSize( } gfx::Point OpaqueNonClientView::GetSystemMenuPoint() const { - int tabstrip_height = browser_view_->IsTabStripVisible() ? - browser_view_->GetTabStripHeight() : 0; gfx::Point system_menu_point(FrameBorderThickness(), - NonClientTopBorderHeight() + tabstrip_height - kClientEdgeThickness); + NonClientTopBorderHeight() + browser_view_->GetTabStripHeight() - + kClientEdgeThickness); ConvertPointToScreen(this, &system_menu_point); return system_menu_point; } @@ -1028,10 +1027,15 @@ void OpaqueNonClientView::LayoutTitleBar() { void OpaqueNonClientView::LayoutOTRAvatar() { SkBitmap otr_avatar_icon = browser_view_->GetOTRAvatarIcon(); int top_height = NonClientTopBorderHeight(); - int tabstrip_height = browser_view_->GetTabStripHeight() - kOTRBottomSpacing; - int otr_height = frame_->IsMaximized() ? - (tabstrip_height - kOTRMaximizedTopSpacing) : - otr_avatar_icon.height(); + int tabstrip_height, otr_height; + if (browser_view_->IsTabStripVisible()) { + tabstrip_height = browser_view_->GetTabStripHeight() - kOTRBottomSpacing; + otr_height = frame_->IsMaximized() ? + (tabstrip_height - kOTRMaximizedTopSpacing) : + otr_avatar_icon.height(); + } else { + tabstrip_height = otr_height = 0; + } otr_avatar_bounds_.SetRect(NonClientBorderThickness() + kOTRSideSpacing, top_height + tabstrip_height - otr_height, otr_avatar_icon.width(), otr_height); |