зеркало из https://github.com/mozilla/pjs.git
Bug 554982 - Add support for borderless glass and remove the borders from the main window. r=roc,dao a=blocking2.0
This commit is contained in:
Родитель
5a1aacf42f
Коммит
02f784b117
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -309,6 +309,10 @@ protected:
|
|||
#if !defined(WINCE)
|
||||
static void InitTrackPointHack();
|
||||
#endif
|
||||
PRBool HasGlass() const {
|
||||
return mTransparencyMode == eTransparencyGlass ||
|
||||
mTransparencyMode == eTransparencyBorderlessGlass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event processing helpers
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче