Bug 1642343 - Fix Mac themed focus outline to not show white edges. r=mstange

This can be reproduced trivially on a MacBook on the test page with
layout.css.devPixelsPerPx = 1.

I wanted to fix this independently of following the outline radius.

Differential Revision: https://phabricator.services.mozilla.com/D77943
This commit is contained in:
Emilio Cobos Álvarez 2020-06-02 22:36:20 +00:00
Родитель 8cf9670c90
Коммит 4292aa557c
1 изменённых файлов: 8 добавлений и 13 удалений

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

@ -1331,19 +1331,14 @@ void nsNativeThemeCocoa::DrawDisclosureButton(CGContextRef cgContext, const HIRe
void nsNativeThemeCocoa::DrawFocusOutline(CGContextRef cgContext, const HIRect& inBoxRect) {
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);
NSGraphicsContext* savedContext = [NSGraphicsContext currentContext];
[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:cgContext
flipped:YES]];
CGContextSaveGState(cgContext);
NSSetFocusRingStyle(NSFocusRingOnly);
NSRectFill(NSRectFromCGRect(inBoxRect));
CGContextRestoreGState(cgContext);
[NSGraphicsContext setCurrentContext:savedContext];
NS_OBJC_END_TRY_ABORT_BLOCK;
}