Bug 1421088 - Create DrawToolbar. r=spohl

MozReview-Commit-ID: 3NMidcVazQo

--HG--
extra : rebase_source : 18cc2df0dd61a5039b8ce50d634441cf6645e702
This commit is contained in:
Markus Stange 2017-12-01 17:55:02 -05:00
parent a2bb203dde
commit 6868ae0bf5
2 changed files with 24 additions and 15 deletions

View File

@ -377,6 +377,8 @@ protected:
void DrawSpinButton(CGContextRef context,
const HIRect& inBoxRect, SpinButton aDrawnButton,
const SpinButtonParams& aParams);
void DrawToolbar(CGContextRef cgContext, const CGRect& inBoxRect,
bool aIsMain);
void DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inBoxRect,
const UnifiedToolbarParams& aParams);
void DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRect,

View File

@ -2517,6 +2517,27 @@ nsNativeThemeCocoa::GetParentScrollbarFrame(nsIFrame *aFrame)
return scrollbarFrame;
}
void
nsNativeThemeCocoa::DrawToolbar(CGContextRef cgContext, const CGRect& inBoxRect,
bool aIsMain)
{
CGRect drawRect = inBoxRect;
// top border
drawRect.size.height = 1.0f;
DrawNativeGreyColorInRect(cgContext, toolbarTopBorderGrey, drawRect, aIsMain);
// background
drawRect.origin.y += drawRect.size.height;
drawRect.size.height = inBoxRect.size.height - 2.0f;
DrawNativeGreyColorInRect(cgContext, toolbarFillGrey, drawRect, aIsMain);
// bottom border
drawRect.origin.y += drawRect.size.height;
drawRect.size.height = 1.0f;
DrawNativeGreyColorInRect(cgContext, toolbarBottomBorderGrey, drawRect, aIsMain);
}
static bool
ToolbarCanBeUnified(const HIRect& inBoxRect, NSWindow* aWindow)
{
@ -3104,21 +3125,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(gfxContext* aContext,
UnifiedToolbarParams{unifiedHeight, isMain});
break;
}
CGRect drawRect = macRect;
// top border
drawRect.size.height = 1.0f;
DrawNativeGreyColorInRect(cgContext, toolbarTopBorderGrey, drawRect, isMain);
// background
drawRect.origin.y += drawRect.size.height;
drawRect.size.height = macRect.size.height - 2.0f;
DrawNativeGreyColorInRect(cgContext, toolbarFillGrey, drawRect, isMain);
// bottom border
drawRect.origin.y += drawRect.size.height;
drawRect.size.height = 1.0f;
DrawNativeGreyColorInRect(cgContext, toolbarBottomBorderGrey, drawRect, isMain);
DrawToolbar(cgContext, macRect, isMain);
}
break;