Bug 427928 - part 3, Add NS_THEME_FOCUS_OUTLINE support for Cocoa widgets. r=mstange

This commit is contained in:
Mats Palmgren 2014-06-14 12:48:08 +00:00
Родитель da55af8807
Коммит 0bbce3629e
2 изменённых файлов: 37 добавлений и 0 удалений

Просмотреть файл

@ -102,6 +102,9 @@ protected:
const HIRect& inBoxRect, bool inIsDefault,
ThemeButtonValue inValue, ThemeButtonAdornment inAdornment,
mozilla::EventStates inState, nsIFrame* aFrame);
void DrawFocusOutline(CGContextRef cgContext, const HIRect& inBoxRect,
mozilla::EventStates inState, uint8_t aWidgetType,
nsIFrame* aFrame);
void DrawDropdown(CGContextRef context, const HIRect& inBoxRect,
mozilla::EventStates inState, uint8_t aWidgetType,
nsIFrame* aFrame);

Просмотреть файл

@ -1036,6 +1036,29 @@ nsNativeThemeCocoa::DrawPushButton(CGContextRef cgContext, const HIRect& inBoxRe
NS_OBJC_END_TRY_ABORT_BLOCK;
}
void
nsNativeThemeCocoa::DrawFocusOutline(CGContextRef cgContext, const HIRect& inBoxRect,
EventStates inState, uint8_t aWidgetType,
nsIFrame* aFrame)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
HIThemeFrameDrawInfo fdi;
fdi.version = 0;
fdi.kind = kHIThemeFrameTextFieldSquare;
fdi.state = kThemeStateActive;
fdi.isFocused = TRUE;
#if DRAW_IN_FRAME_DEBUG
CGContextSetRGBFillColor(cgContext, 0.0, 0.0, 0.5, 0.25);
CGContextFillRect(cgContext, inBoxRect);
#endif
HIThemeDrawFrame(&inBoxRect, &fdi, cgContext, HITHEME_ORIENTATION);
NS_OBJC_END_TRY_ABORT_BLOCK;
}
typedef void (*RenderHIThemeControlFunction)(CGContextRef cgContext, const HIRect& aRenderRect, void* aData);
static void
@ -2268,6 +2291,10 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
}
break;
case NS_THEME_FOCUS_OUTLINE:
DrawFocusOutline(cgContext, macRect, eventState, aWidgetType, aFrame);
break;
case NS_THEME_MOZ_MAC_HELP_BUTTON:
DrawPushButton(cgContext, macRect, eventState, aWidgetType, aFrame);
break;
@ -2892,6 +2919,11 @@ nsNativeThemeCocoa::GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFram
aOverflowRect->Inflate(m);
return true;
}
case NS_THEME_FOCUS_OUTLINE:
{
aOverflowRect->Inflate(NSIntPixelsToAppUnits(2, p2a));
return true;
}
}
return false;
@ -3387,6 +3419,8 @@ nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* a
scrollFrame && scrollFrame->GetScrollbarVisibility());
break;
}
case NS_THEME_FOCUS_OUTLINE:
return true;
}
return false;