diff options
author | Moonchild <moonchild@palemoon.org> | 2020-11-20 09:47:03 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-11-20 09:47:03 +0000 |
commit | 5165ed02285315cc0bed7977c7bac6d0a90ca43c (patch) | |
tree | 9b761a21eb924915e51c2d803208e6c01b505a45 /widget/cocoa/nsNativeThemeCocoa.mm | |
parent | e1db27e19989db11fef70f439cf95821316535b3 (diff) | |
parent | ca9abcdf1702c37bf00048dab3f460b2252873a3 (diff) | |
download | UXP-RELBASE_20201120.tar UXP-RELBASE_20201120.tar.gz UXP-RELBASE_20201120.tar.lz UXP-RELBASE_20201120.tar.xz UXP-RELBASE_20201120.zip |
Merge branch 'redwood' into releaseRELBASE_20201124RELBASE_20201120RC_20201120
Diffstat (limited to 'widget/cocoa/nsNativeThemeCocoa.mm')
-rw-r--r-- | widget/cocoa/nsNativeThemeCocoa.mm | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm index fc4f7f2e9..f93e40f7b 100644 --- a/widget/cocoa/nsNativeThemeCocoa.mm +++ b/widget/cocoa/nsNativeThemeCocoa.mm @@ -443,8 +443,8 @@ static ChildView* ChildViewForFrame(nsIFrame* aFrame) if (!widget) return nil; - NSView* view = (NSView*)widget->GetNativeData(NS_NATIVE_WIDGET); - return [view isKindOfClass:[ChildView class]] ? (ChildView*)view : nil; + NSWindow* window = (NSWindow*)widget->GetNativeData(NS_NATIVE_WINDOW); + return [window isKindOfClass:[BaseWindow class]] ? [(BaseWindow*)window mainChildView] : nil; } static NSWindow* NativeWindowForFrame(nsIFrame* aFrame, @@ -2437,17 +2437,30 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext, break; case NS_THEME_MENUSEPARATOR: { - ThemeMenuState menuState; - if (IsDisabled(aFrame, eventState)) { - menuState = kThemeMenuDisabled; + // Workaround for visual artifacts issues with + // HIThemeDrawMenuSeparator on macOS Big Sur. + if (nsCocoaFeatures::OnBigSurOrLater()) { + CGRect separatorRect = macRect; + separatorRect.size.height = 1; + separatorRect.size.width -= 42; + separatorRect.origin.x += 21; + // Use a gray color similar to the native separator + CGContextSetRGBFillColor(cgContext, 0.816, 0.816, 0.816, 1.0); + CGContextFillRect(cgContext, separatorRect); } - else { - menuState = CheckBooleanAttr(aFrame, nsGkAtoms::menuactive) ? - kThemeMenuSelected : kThemeMenuActive; + else + { + ThemeMenuState menuState; + if (IsDisabled(aFrame, eventState)) { + menuState = kThemeMenuDisabled; + } + else { + menuState = CheckBooleanAttr(aFrame, nsGkAtoms::menuactive) ? + kThemeMenuSelected : kThemeMenuActive; + } + HIThemeMenuItemDrawInfo midi = { 0, kThemeMenuItemPlain, menuState }; + HIThemeDrawMenuSeparator(&macRect, &macRect, &midi, cgContext, HITHEME_ORIENTATION); } - - HIThemeMenuItemDrawInfo midi = { 0, kThemeMenuItemPlain, menuState }; - HIThemeDrawMenuSeparator(&macRect, &macRect, &midi, cgContext, HITHEME_ORIENTATION); } break; |