From c8c263cd3773206f91d8db83d995ed8007c39d79 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Fri, 1 Dec 2017 19:54:29 -0500 Subject: [PATCH] Bug 1421088 - Create a DrawNativeTitlebar overload that takes a UnifiedToolbarParams param. r=spohl MozReview-Commit-ID: Gxe4qIZV7HI --HG-- extra : rebase_source : c9f2b295bf7270f2167641ec27901878f5b362f7 --- widget/cocoa/nsNativeThemeCocoa.h | 2 ++ widget/cocoa/nsNativeThemeCocoa.mm | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/widget/cocoa/nsNativeThemeCocoa.h b/widget/cocoa/nsNativeThemeCocoa.h index 9642fd795963..1b606b6baf94 100644 --- a/widget/cocoa/nsNativeThemeCocoa.h +++ b/widget/cocoa/nsNativeThemeCocoa.h @@ -383,6 +383,8 @@ protected: bool aIsMain); void DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inBoxRect, const UnifiedToolbarParams& aParams); + void DrawNativeTitlebar(CGContextRef aContext, CGRect aTitlebarRect, + const UnifiedToolbarParams& aParams); void DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRect, bool aIsMain); void DrawResizer(CGContextRef cgContext, const HIRect& aRect, bool aIsRTL); diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm index 51bcca865676..c4bfa39ab910 100644 --- a/widget/cocoa/nsNativeThemeCocoa.mm +++ b/widget/cocoa/nsNativeThemeCocoa.mm @@ -2660,6 +2660,14 @@ nsNativeThemeCocoa::DrawNativeTitlebar(CGContextRef aContext, CGRect aTitlebarRe DrawNativeTitlebarToolbarWithSquareCorners(aContext, aTitlebarRect, unifiedHeight, aIsMain, aIsFlipped); } +void +nsNativeThemeCocoa::DrawNativeTitlebar(CGContextRef aContext, CGRect aTitlebarRect, + const UnifiedToolbarParams& aParams) +{ + DrawNativeTitlebar(aContext, aTitlebarRect, aParams.unifiedHeight, + aParams.isMain, YES); +} + static void RenderResizer(CGContextRef cgContext, const HIRect& aRenderRect, void* aData) { @@ -3160,10 +3168,11 @@ nsNativeThemeCocoa::DrawWidgetBackground(gfxContext* aContext, case NS_THEME_WINDOW_TITLEBAR: { NSWindow* win = NativeWindowForFrame(aFrame); - BOOL isMain = [win isMainWindow]; + bool isMain = [win isMainWindow]; float unifiedToolbarHeight = [win isKindOfClass:[ToolbarWindow class]] ? [(ToolbarWindow*)win unifiedToolbarHeight] : macRect.size.height; - DrawNativeTitlebar(cgContext, macRect, unifiedToolbarHeight, isMain, YES); + DrawNativeTitlebar(cgContext, macRect, + UnifiedToolbarParams{unifiedToolbarHeight, isMain}); } break;