diff --git a/browser/themes/winstripe/browser/browser-aero.css b/browser/themes/winstripe/browser/browser-aero.css index 7ea93b073be..b72b3827aa2 100644 --- a/browser/themes/winstripe/browser/browser-aero.css +++ b/browser/themes/winstripe/browser/browser-aero.css @@ -17,7 +17,7 @@ @media all and (-moz-windows-compositor) { #main-window:not(:-moz-lwtheme) { - -moz-appearance: -moz-win-glass; + -moz-appearance: -moz-win-borderless-glass; background: transparent; } diff --git a/gfx/src/nsITheme.h b/gfx/src/nsITheme.h index a0b84670b9f..5011aea5d81 100644 --- a/gfx/src/nsITheme.h +++ b/gfx/src/nsITheme.h @@ -69,7 +69,8 @@ class nsIWidget; enum nsTransparencyMode { eTransparencyOpaque = 0, // Fully opaque eTransparencyTransparent, // Parts of the window may be transparent - eTransparencyGlass // Transparent parts of the window have Vista AeroGlass effect applied + eTransparencyGlass, // Transparent parts of the window have Vista AeroGlass effect applied + eTransparencyBorderlessGlass // As above, but without a border around the opaque areas when there would otherwise be one with eTransparencyGlass }; /** diff --git a/gfx/src/nsThemeConstants.h b/gfx/src/nsThemeConstants.h index 4262a475aff..1b8f6687351 100644 --- a/gfx/src/nsThemeConstants.h +++ b/gfx/src/nsThemeConstants.h @@ -236,6 +236,7 @@ #define NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR 224 // Vista glass +#define NS_THEME_WIN_BORDERLESS_GLASS 229 #define NS_THEME_WIN_GLASS 230 // Windows themed window frame elements diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 15261717a4a..ee8d7a1e6d3 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -3287,6 +3287,9 @@ nsLayoutUtils::GetFrameTransparency(nsIFrame* aBackgroundFrame, if (aCSSRootFrame->GetStyleDisplay()->mAppearance == NS_THEME_WIN_GLASS) return eTransparencyGlass; + if (aCSSRootFrame->GetStyleDisplay()->mAppearance == NS_THEME_WIN_BORDERLESS_GLASS) + return eTransparencyBorderlessGlass; + // We need an uninitialized window to be treated as opaque because // doing otherwise breaks window display effects on some platforms, // specifically Vista. (bug 450322) diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index fbf104680d7..a7de64ae0e4 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -593,6 +593,7 @@ CSS_KEY(-moz-win-browsertabbar-toolbox, _moz_win_browsertabbar_toolbox) CSS_KEY(-moz-win-mediatext, _moz_win_mediatext) CSS_KEY(-moz-win-communicationstext, _moz_win_communicationstext) CSS_KEY(-moz-win-glass, _moz_win_glass) +CSS_KEY(-moz-win-borderless-glass, _moz_win_borderless_glass) CSS_KEY(-moz-window-titlebar, _moz_window_titlebar) CSS_KEY(-moz-window-titlebar-maximized, _moz_window_titlebar_maximized) CSS_KEY(-moz-window-frame-left, _moz_window_frame_left) diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index cf225366504..59158fe5bbd 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -499,6 +499,7 @@ const PRInt32 nsCSSProps::kAppearanceKTable[] = { eCSSKeyword__moz_win_communications_toolbox, NS_THEME_WIN_COMMUNICATIONS_TOOLBOX, eCSSKeyword__moz_win_browsertabbar_toolbox, NS_THEME_WIN_BROWSER_TAB_BAR_TOOLBOX, eCSSKeyword__moz_win_glass, NS_THEME_WIN_GLASS, + eCSSKeyword__moz_win_borderless_glass, NS_THEME_WIN_BORDERLESS_GLASS, eCSSKeyword__moz_mac_unified_toolbar, NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR, eCSSKeyword__moz_window_titlebar, NS_THEME_WINDOW_TITLEBAR, eCSSKeyword__moz_window_titlebar_maximized, NS_THEME_WINDOW_TITLEBAR_MAXIMIZED, diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index d25b3b4aa61..15fccfd1875 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -839,7 +839,7 @@ DWORD nsWindow::WindowStyle() case eWindowType_popup: style = WS_POPUP; - if (mTransparencyMode != eTransparencyGlass) { + if (!HasGlass()) { style |= WS_OVERLAPPED; } break; @@ -1275,7 +1275,7 @@ NS_METHOD nsWindow::IsVisible(PRBool & bState) void nsWindow::ClearThemeRegion() { #ifndef WINCE - if (nsUXThemeData::sIsVistaOrLater && mTransparencyMode != eTransparencyGlass && + if (nsUXThemeData::sIsVistaOrLater && !HasGlass() && mWindowType == eWindowType_popup && (mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel)) { SetWindowRgn(mWnd, NULL, false); } @@ -1290,7 +1290,7 @@ void nsWindow::SetThemeRegion() // so default constants are used for part and state. At some point we might need part and // state values from nsNativeThemeWin's GetThemePartAndState, but currently windows that // change shape based on state haven't come up. - if (nsUXThemeData::sIsVistaOrLater && mTransparencyMode != eTransparencyGlass && + if (nsUXThemeData::sIsVistaOrLater && !HasGlass() && mWindowType == eWindowType_popup && (mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel)) { HRGN hRgn = nsnull; RECT rect = {0,0,mBounds.width,mBounds.height}; @@ -2447,7 +2447,7 @@ namespace { void nsWindow::UpdatePossiblyTransparentRegion(const nsIntRegion &aDirtyRegion, const nsIntRegion &aPossiblyTransparentRegion) { #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN - if (mTransparencyMode != eTransparencyGlass) + if (!HasGlass()) return; HWND hWnd = GetTopLevelHWND(mWnd, PR_TRUE); @@ -2508,19 +2508,31 @@ void nsWindow::UpdateGlass() { #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN HWND hWnd = GetTopLevelHWND(mWnd, PR_TRUE); + MARGINS margins = mGlassMargins; // DWMNCRP_USEWINDOWSTYLE - The non-client rendering area is // rendered based on the window style. // DWMNCRP_ENABLED - The non-client area rendering is // enabled; the window style is ignored. DWMNCRENDERINGPOLICY policy = DWMNCRP_USEWINDOWSTYLE; - if (mTransparencyMode == eTransparencyGlass) { + switch (mTransparencyMode) { + case eTransparencyBorderlessGlass: + { + const PRInt32 kGlassMarginAdjustment = 2; + margins.cxLeftWidth += kGlassMarginAdjustment; + margins.cyTopHeight += kGlassMarginAdjustment; + margins.cxRightWidth += kGlassMarginAdjustment; + margins.cyBottomHeight += kGlassMarginAdjustment; + } + // Fall through + case eTransparencyGlass: policy = DWMNCRP_ENABLED; + break; } // Extends the window frame behind the client area if(nsUXThemeData::CheckForCompositor()) { - nsUXThemeData::dwmExtendFrameIntoClientAreaPtr(hWnd, &mGlassMargins); + nsUXThemeData::dwmExtendFrameIntoClientAreaPtr(hWnd, &margins); nsUXThemeData::dwmSetWindowAttributePtr(hWnd, DWMWA_NCRENDERING_POLICY, &policy, sizeof policy); } #endif // #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN @@ -7619,7 +7631,7 @@ void nsWindow::SetWindowTranslucencyInner(nsTransparencyMode aMode) ::SetWindowLongPtrW(hWnd, GWL_EXSTYLE, exStyle); #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN - if (mTransparencyMode == eTransparencyGlass) + if (HasGlass()) memset(&mGlassMargins, 0, sizeof mGlassMargins); #endif // #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN mTransparencyMode = aMode; diff --git a/widget/src/windows/nsWindow.h b/widget/src/windows/nsWindow.h index d6212eefc4f..871a45eadd6 100644 --- a/widget/src/windows/nsWindow.h +++ b/widget/src/windows/nsWindow.h @@ -309,6 +309,10 @@ protected: #if !defined(WINCE) static void InitTrackPointHack(); #endif + PRBool HasGlass() const { + return mTransparencyMode == eTransparencyGlass || + mTransparencyMode == eTransparencyBorderlessGlass; + } /** * Event processing helpers diff --git a/widget/src/windows/nsWindowGfx.cpp b/widget/src/windows/nsWindowGfx.cpp index 5ff7304f1f5..f19c01ce41c 100644 --- a/widget/src/windows/nsWindowGfx.cpp +++ b/widget/src/windows/nsWindowGfx.cpp @@ -541,20 +541,24 @@ DDRAW_FAILED: BasicLayerManager::BUFFER_NONE; if (IsRenderMode(gfxWindowsPlatform::RENDER_GDI)) { # if defined(MOZ_XUL) && !defined(WINCE) - if (eTransparencyGlass == mTransparencyMode && nsUXThemeData::sHaveCompositor) { - doubleBuffering = BasicLayerManager::BUFFER_BUFFERED; - } else if (eTransparencyTransparent == mTransparencyMode) { - // If we're rendering with translucency, we're going to be - // rendering the whole window; make sure we clear it first - thebesContext->SetOperator(gfxContext::OPERATOR_CLEAR); - thebesContext->Paint(); - thebesContext->SetOperator(gfxContext::OPERATOR_OVER); - } else -#endif - { - // If we're not doing translucency, then double buffer - doubleBuffering = BasicLayerManager::BUFFER_BUFFERED; + switch (mTransparencyMode) { + case eTransparencyGlass: + case eTransparencyBorderlessGlass: + default: + // If we're not doing translucency, then double buffer + doubleBuffering = BasicLayerManager::BUFFER_BUFFERED; + break; + case eTransparencyTransparent: + // If we're rendering with translucency, we're going to be + // rendering the whole window; make sure we clear it first + thebesContext->SetOperator(gfxContext::OPERATOR_CLEAR); + thebesContext->Paint(); + thebesContext->SetOperator(gfxContext::OPERATOR_OVER); + break; } +#else + doubleBuffering = BasicLayerManager::BUFFER_BUFFERED; +#endif } {