Bug 1421088 - Don't pass an nsIFrame* to DrawTabPanel. r?spohl draft
authorMarkus Stange <mstange@themasta.com>
Fri, 01 Dec 2017 18:03:12 -0500
changeset 782253 f98522ef73a7b1a1485e3fb43756475e3f5679ab
parent 782252 7e837f64d6870f413c0ad4efea2b1b354e645d8a
child 782254 16d92ad3751e4be57df636e51ab6104bac6251b3
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 DrawTabPanel. r?spohl MozReview-Commit-ID: JeWt76t7rRQ
widget/cocoa/nsNativeThemeCocoa.h
widget/cocoa/nsNativeThemeCocoa.mm
--- a/widget/cocoa/nsNativeThemeCocoa.h
+++ b/widget/cocoa/nsNativeThemeCocoa.h
@@ -327,17 +327,18 @@ protected:
 
   // HITheme drawing routines
   void DrawTextBox(CGContextRef context, const HIRect& inBoxRect,
                    TextBoxParams aParams);
   void DrawMeter(CGContextRef context, const HIRect& inBoxRect,
                  const MeterParams& aParams);
   void DrawSegment(CGContextRef cgContext, const HIRect& inBoxRect,
                    const SegmentParams& aParams);
-  void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect, nsIFrame* aFrame);
+  void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect,
+                    bool aIsInsideActiveWindow);
   void DrawScale(CGContextRef context, const HIRect& inBoxRect,
                  const ScaleParams& aParams);
   void DrawCheckboxOrRadio(CGContextRef cgContext, bool inCheckbox,
                            const HIRect& inBoxRect,
                            const CheckboxOrRadioParams& aParams);
   void DrawSearchField(CGContextRef cgContext, const HIRect& inBoxRect,
                        const SearchFieldParams& aParams);
   void DrawRoundedBezelPushButton(CGContextRef cgContext,
--- a/widget/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/cocoa/nsNativeThemeCocoa.mm
@@ -2264,24 +2264,24 @@ nsNativeThemeCocoa::DrawMeter(CGContextR
 
   CGContextRestoreGState(cgContext);
 
   NS_OBJC_END_TRY_ABORT_BLOCK
 }
 
 void
 nsNativeThemeCocoa::DrawTabPanel(CGContextRef cgContext, const HIRect& inBoxRect,
-                                 nsIFrame* aFrame)
+                                 bool aIsInsideActiveWindow)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   HIThemeTabPaneDrawInfo tpdi;
 
   tpdi.version = 1;
-  tpdi.state = FrameIsInActiveWindow(aFrame) ? kThemeStateActive : kThemeStateInactive;
+  tpdi.state = aIsInsideActiveWindow ? kThemeStateActive : kThemeStateInactive;
   tpdi.direction = kThemeTabNorth;
   tpdi.size = kHIThemeTabSizeNormal;
   tpdi.kind = kHIThemeTabKindNormal;
 
   HIThemeDrawTabPane(&inBoxRect, &tpdi, cgContext, HITHEME_ORIENTATION);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
@@ -3367,17 +3367,17 @@ nsNativeThemeCocoa::DrawWidgetBackground
       SegmentParams params =
         ComputeSegmentParams(aFrame, eventState, SegmentType::eTab);
       params.pressed = params.pressed && !params.selected;
       DrawSegment(cgContext, macRect, params);
     }
       break;
 
     case NS_THEME_TABPANELS:
-      DrawTabPanel(cgContext, macRect, aFrame);
+      DrawTabPanel(cgContext, macRect, FrameIsInActiveWindow(aFrame));
       break;
 
     case NS_THEME_RESIZER:
       DrawResizer(cgContext, macRect, aFrame);
       break;
 
     case NS_THEME_MAC_VIBRANCY_LIGHT:
     case NS_THEME_MAC_VIBRANCY_DARK: