Bug 889085 - Make our sheets semi-transparent. r=mstange.

This commit is contained in:
stefanh@inbox.com 2014-01-18 12:52:22 +01:00
parent 9703b89906
commit 579105656d
2 changed files with 26 additions and 1 deletions

View File

@ -71,6 +71,7 @@ protected:
nsIFrame* SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter);
CGRect SeparatorAdjustedRect(CGRect aRect, nsIFrame* aLeft,
nsIFrame* aCurrent, nsIFrame* aRight);
bool IsWindowSheet(nsIFrame* aFrame);
// HITheme drawing routines
void DrawFrame(CGContextRef context, HIThemeFrameKind inKind,

View File

@ -2100,7 +2100,14 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
switch (aWidgetType) {
case NS_THEME_DIALOG: {
HIThemeSetFill(kThemeBrushDialogBackgroundActive, NULL, cgContext, HITHEME_ORIENTATION);
CGContextClearRect(cgContext, macRect);
if (IsWindowSheet(aFrame)) {
HIThemeSetFill(kThemeBrushSheetBackgroundTransparent, NULL, cgContext, HITHEME_ORIENTATION);
}
else {
HIThemeSetFill(kThemeBrushDialogBackgroundActive, NULL, cgContext, HITHEME_ORIENTATION);
}
CGContextFillRect(cgContext, macRect);
}
break;
@ -3355,6 +3362,20 @@ nsNativeThemeCocoa::WidgetAppearanceDependsOnWindowFocus(uint8_t aWidgetType)
}
}
bool
nsNativeThemeCocoa::IsWindowSheet(nsIFrame* aFrame)
{
NSWindow* win = NativeWindowForFrame(aFrame);
id winDelegate = [win delegate];
nsIWidget* widget = [(WindowDelegate *)winDelegate geckoWidget];
if (!widget) {
return false;
}
nsWindowType windowType;
widget->GetWindowType(windowType);
return (windowType == eWindowType_sheet);
}
nsITheme::Transparency
nsNativeThemeCocoa::GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType)
{
@ -3363,6 +3384,9 @@ nsNativeThemeCocoa::GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType)
case NS_THEME_TOOLTIP:
return eTransparent;
case NS_THEME_DIALOG:
return IsWindowSheet(aFrame) ? eTransparent : eOpaque;
case NS_THEME_SCROLLBAR_SMALL:
case NS_THEME_SCROLLBAR:
return nsLookAndFeel::UseOverlayScrollbars() ? eTransparent : eOpaque;