Bug 534170 - Remove uses of -moz-mac-unified-toolbar and instead make all toolbars at the top of the window unified. r=dao, r=josh

This commit is contained in:
Markus Stange 2009-12-30 16:23:51 +01:00
Родитель 7ab969efff
Коммит 037d6acb51
5 изменённых файлов: 24 добавлений и 19 удалений

Просмотреть файл

@ -64,7 +64,7 @@ prefwindow[type="child"] > prefpane {
.paneSelector {
font: message-box;
padding: 1px 4px;
-moz-appearance: -moz-mac-unified-toolbar;
-moz-appearance: toolbar;
margin: 0;
}

Просмотреть файл

@ -80,12 +80,6 @@ toolbarseparator {
min-height: 24px;
}
.toolbar-primary,
window > toolbox:nth-of-type(1) > toolbar:nth-of-type(1) {
-moz-appearance: -moz-mac-unified-toolbar;
}
/* ::::: toolbarpaletteitem ::::: */
toolbarpaletteitem {

Просмотреть файл

@ -37,7 +37,7 @@
%include shared.inc
#topBar {
-moz-appearance: -moz-mac-unified-toolbar;
-moz-appearance: toolbar;
}
.viewGroupWrapper {

Просмотреть файл

@ -132,7 +132,7 @@ protected:
ThemeButtonAdornment inAdornment, PRInt32 inState,
nsIFrame* aFrame);
void DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inBoxRect,
nsIFrame *aFrame);
NSWindow* aWindow);
void DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRect,
nsIFrame *aFrame);
void DrawResizer(CGContextRef cgContext, const HIRect& aRect, nsIFrame *aFrame);

Просмотреть файл

@ -1385,26 +1385,32 @@ static BOOL DrawingAtWindowTop(CGContextRef cgContext, float viewHeight, float y
return ctm.ty - yPos >= viewHeight;
}
static BOOL
ToolbarCanBeUnified(CGContextRef cgContext, const HIRect& inBoxRect, NSWindow* aWindow)
{
return [aWindow isKindOfClass:[ToolbarWindow class]] &&
![(ToolbarWindow*)aWindow drawsContentsIntoWindowFrame] &&
DrawingAtWindowTop(cgContext, [[aWindow contentView] bounds].size.height,
inBoxRect.origin.y);
}
void
nsNativeThemeCocoa::DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inBoxRect,
nsIFrame *aFrame)
NSWindow* aWindow)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
float titlebarHeight = 0;
NSWindow* win = NativeWindowForFrame(aFrame);
if ([win isKindOfClass:[ToolbarWindow class]] &&
![(ToolbarWindow*)win drawsContentsIntoWindowFrame] &&
DrawingAtWindowTop(cgContext, [[win contentView] bounds].size.height, inBoxRect.origin.y)) {
if (ToolbarCanBeUnified(cgContext, inBoxRect, aWindow)) {
// Consider the titlebar height when calculating the gradient.
titlebarHeight = [(ToolbarWindow*)win titlebarHeight];
titlebarHeight = [(ToolbarWindow*)aWindow titlebarHeight];
// Notify the window about the toolbar's height so that it can draw the
// correct gradient in the titlebar.
[(ToolbarWindow*)win setUnifiedToolbarHeight:inBoxRect.size.height];
[(ToolbarWindow*)aWindow setUnifiedToolbarHeight:inBoxRect.size.height];
}
BOOL isMain = [win isMainWindow] || ![NSView focusView];
BOOL isMain = [aWindow isMainWindow] || ![NSView focusView];
// Draw the gradient
UnifiedGradientInfo info = { titlebarHeight, inBoxRect.size.height, isMain, NO };
@ -1707,11 +1713,16 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
break;
case NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR:
DrawUnifiedToolbar(cgContext, macRect, aFrame);
DrawUnifiedToolbar(cgContext, macRect, NativeWindowForFrame(aFrame));
break;
case NS_THEME_TOOLBAR: {
BOOL isMain = [NativeWindowForFrame(aFrame) isMainWindow] || ![NSView focusView];
NSWindow* win = NativeWindowForFrame(aFrame);
if (ToolbarCanBeUnified(cgContext, macRect, win)) {
DrawUnifiedToolbar(cgContext, macRect, win);
break;
}
BOOL isMain = [win isMainWindow] || ![NSView focusView];
CGRect drawRect = macRect;
// top border