--- a/widget/cocoa/nsNativeThemeCocoa.h
+++ b/widget/cocoa/nsNativeThemeCocoa.h
@@ -387,16 +387,18 @@ protected:
bool aIsMain);
void DrawResizer(CGContextRef cgContext, const HIRect& aRect, bool aIsRTL);
void DrawScrollbarThumb(CGContextRef cgContext, const CGRect& inBoxRect,
ScrollbarParams aParams);
void DrawScrollbarTrack(CGContextRef cgContext, const CGRect& inBoxRect,
ScrollbarParams aParams);
void DrawMultilineTextField(CGContextRef cgContext, const CGRect& inBoxRect,
bool aIsFocused);
+ void DrawSourceList(CGContextRef cgContext, const CGRect& inBoxRect,
+ bool aIsActive);
// Scrollbars
nsIFrame* GetParentScrollbarFrame(nsIFrame *aFrame);
bool IsParentScrollbarRolledOver(nsIFrame* aFrame);
private:
NSButtonCell* mDisclosureButtonCell;
NSButtonCell* mHelpButtonCell;
--- a/widget/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/cocoa/nsNativeThemeCocoa.mm
@@ -2791,16 +2791,38 @@ nsNativeThemeCocoa::DrawMultilineTextFie
CGContextSaveGState(cgContext);
NSSetFocusRingStyle(NSFocusRingOnly);
NSRectFill(NSRectFromCGRect(inBoxRect));
CGContextRestoreGState(cgContext);
[NSGraphicsContext setCurrentContext:savedContext];
}
}
+void
+nsNativeThemeCocoa::DrawSourceList(CGContextRef cgContext,
+ const CGRect& inBoxRect,
+ bool aIsActive)
+{
+ CGGradientRef backgroundGradient;
+ CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
+ CGFloat activeGradientColors[8] = { 0.9137, 0.9294, 0.9490, 1.0,
+ 0.8196, 0.8471, 0.8784, 1.0 };
+ CGFloat inactiveGradientColors[8] = { 0.9686, 0.9686, 0.9686, 1.0,
+ 0.9216, 0.9216, 0.9216, 1.0 };
+ CGPoint start = inBoxRect.origin;
+ CGPoint end = CGPointMake(inBoxRect.origin.x,
+ inBoxRect.origin.y + inBoxRect.size.height);
+ backgroundGradient =
+ CGGradientCreateWithColorComponents(rgb, aIsActive ? activeGradientColors
+ : inactiveGradientColors, NULL, 2);
+ CGContextDrawLinearGradient(cgContext, backgroundGradient, start, end, 0);
+ CGGradientRelease(backgroundGradient);
+ CGColorSpaceRelease(rgb);
+}
+
static void
DrawVibrancyBackground(CGContextRef cgContext, CGRect inBoxRect,
nsIFrame* aFrame, nsITheme::ThemeGeometryType aThemeGeometryType)
{
DrawVibrancyBackground(cgContext, inBoxRect,
VibrancyFillColor(aFrame, aThemeGeometryType), 0);
}
@@ -3331,32 +3353,17 @@ nsNativeThemeCocoa::DrawWidgetBackground
}
break;
case NS_THEME_MAC_SOURCE_LIST: {
if (VibrancyManager::SystemSupportsVibrancy()) {
ThemeGeometryType type = ThemeGeometryTypeForWidget(aFrame, aWidgetType);
DrawVibrancyBackground(cgContext, macRect, aFrame, type);
} else {
- CGGradientRef backgroundGradient;
- CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
- CGFloat activeGradientColors[8] = { 0.9137, 0.9294, 0.9490, 1.0,
- 0.8196, 0.8471, 0.8784, 1.0 };
- CGFloat inactiveGradientColors[8] = { 0.9686, 0.9686, 0.9686, 1.0,
- 0.9216, 0.9216, 0.9216, 1.0 };
- CGPoint start = macRect.origin;
- CGPoint end = CGPointMake(macRect.origin.x,
- macRect.origin.y + macRect.size.height);
- BOOL isActive = FrameIsInActiveWindow(aFrame);
- backgroundGradient =
- CGGradientCreateWithColorComponents(rgb, isActive ? activeGradientColors
- : inactiveGradientColors, NULL, 2);
- CGContextDrawLinearGradient(cgContext, backgroundGradient, start, end, 0);
- CGGradientRelease(backgroundGradient);
- CGColorSpaceRelease(rgb);
+ DrawSourceList(cgContext, macRect, FrameIsInActiveWindow(aFrame));
}
}
break;
case NS_THEME_MAC_SOURCE_LIST_SELECTION:
case NS_THEME_MAC_ACTIVE_SOURCE_LIST_SELECTION: {
// If we're in XUL tree, we need to rely on the source list's clear
// background display item. If we cleared the background behind the