Bug 1421088 - Don't pass an nsIFrame* to DrawStatusBar. r?spohl draft
authorMarkus Stange <mstange@themasta.com>
Fri, 01 Dec 2017 18:08:35 -0500
changeset 782255 b07481eab5ef40251455444db049d7c588490fe6
parent 782254 16d92ad3751e4be57df636e51ab6104bac6251b3
child 782256 18b926b566e8a1d68ccb6191e8b03af7d098bfc9
push id106506
push userbmo:mstange@themasta.com
push dateSun, 15 Apr 2018 03:32:46 +0000
reviewersspohl
bugs1421088
milestone61.0a1
Bug 1421088 - Don't pass an nsIFrame* to DrawStatusBar. r?spohl MozReview-Commit-ID: 6KU2OyZb9BS
widget/cocoa/nsNativeThemeCocoa.h
widget/cocoa/nsNativeThemeCocoa.mm
--- 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;