Bug 1421088 - Don't pass an nsIFrame* to DrawStatusBar. r?spohl
MozReview-Commit-ID: 6KU2OyZb9BS
--- a/widget/cocoa/nsNativeThemeCocoa.h
+++ b/widget/cocoa/nsNativeThemeCocoa.h
@@ -375,17 +375,17 @@ protected:
void DrawSpinButtons(CGContextRef context, const HIRect& inBoxRect,
const SpinButtonParams& aParams);
void DrawSpinButton(CGContextRef context,
const HIRect& inBoxRect, SpinButton aDrawnButton,
const SpinButtonParams& aParams);
void DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inBoxRect,
const UnifiedToolbarParams& aParams);
void DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRect,
- nsIFrame *aFrame);
+ bool aIsMain);
void DrawResizer(CGContextRef cgContext, const HIRect& aRect, nsIFrame *aFrame);
void DrawScrollbarThumb(CGContextRef cgContext, const CGRect& inBoxRect,
ScrollbarParams aParams);
void DrawScrollbarTrack(CGContextRef cgContext, const CGRect& inBoxRect,
ScrollbarParams aParams);
// Scrollbars
nsIFrame* GetParentScrollbarFrame(nsIFrame *aFrame);
--- a/widget/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/cocoa/nsNativeThemeCocoa.mm
@@ -2577,17 +2577,17 @@ nsNativeThemeCocoa::DrawUnifiedToolbar(C
CGContextRestoreGState(cgContext);
NS_OBJC_END_TRY_ABORT_BLOCK;
}
void
nsNativeThemeCocoa::DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRect,
- nsIFrame *aFrame)
+ bool aIsMain)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
if (inBoxRect.size.height < 2.0f)
return;
CGContextSaveGState(cgContext);
CGContextClipToRect(cgContext, inBoxRect);
@@ -2598,17 +2598,17 @@ nsNativeThemeCocoa::DrawStatusBar(CGCont
CGRect drawRect = inBoxRect;
const int extendUpwards = 40;
drawRect.origin.y -= extendUpwards;
drawRect.size.height += extendUpwards;
RenderWithCoreUI(drawRect, cgContext,
[NSDictionary dictionaryWithObjectsAndKeys:
@"kCUIWidgetWindowFrame", @"widget",
@"regularwin", @"windowtype",
- (IsActive(aFrame, YES) ? @"normal" : @"inactive"), @"state",
+ (aIsMain ? @"normal" : @"inactive"), @"state",
[NSNumber numberWithInt:inBoxRect.size.height], @"kCUIWindowFrameBottomBarHeightKey",
[NSNumber numberWithBool:YES], @"kCUIWindowFrameDrawBottomBarSeparatorKey",
[NSNumber numberWithBool:YES], @"is.flipped",
nil]);
CGContextRestoreGState(cgContext);
NS_OBJC_END_TRY_ABORT_BLOCK;
@@ -3098,17 +3098,17 @@ nsNativeThemeCocoa::DrawWidgetBackground
BOOL isMain = [win isMainWindow];
float unifiedToolbarHeight = [win isKindOfClass:[ToolbarWindow class]] ?
[(ToolbarWindow*)win unifiedToolbarHeight] : macRect.size.height;
DrawNativeTitlebar(cgContext, macRect, unifiedToolbarHeight, isMain, YES);
}
break;
case NS_THEME_STATUSBAR:
- DrawStatusBar(cgContext, macRect, aFrame);
+ DrawStatusBar(cgContext, macRect, IsActive(aFrame, YES));
break;
case NS_THEME_MENULIST:
case NS_THEME_MENULIST_TEXTFIELD: {
ControlParams controlParams = ComputeControlParams(aFrame, eventState);
controlParams.focused = controlParams.focused || IsFocused(aFrame);
controlParams.pressed = IsOpenButton(aFrame);
DropdownParams params;