diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /widget/cocoa/nsNativeThemeCocoa.mm | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'widget/cocoa/nsNativeThemeCocoa.mm')
-rw-r--r-- | widget/cocoa/nsNativeThemeCocoa.mm | 70 |
1 files changed, 3 insertions, 67 deletions
diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm index ff715ac57c..18913facea 100644 --- a/widget/cocoa/nsNativeThemeCocoa.mm +++ b/widget/cocoa/nsNativeThemeCocoa.mm @@ -399,9 +399,8 @@ static BOOL FrameIsInActiveWindow(nsIFrame* aFrame) { // Toolbar controls and content controls respond to different window // activeness states. -static BOOL IsActive(nsIFrame* aFrame, BOOL aIsToolbarControl) { - if (aIsToolbarControl) return [NativeWindowForFrame(aFrame) isMainWindow]; - return FrameIsInActiveWindow(aFrame); +static BOOL IsActiveToolbarControl(nsIFrame* aFrame) { + return NativeWindowForFrame(aFrame).isMainWindow; } NS_IMPL_ISUPPORTS_INHERITED(nsNativeThemeCocoa, nsNativeTheme, nsITheme) @@ -1021,7 +1020,6 @@ static bool IsToolbarStyleContainer(nsIFrame* aFrame) { } switch (aFrame->StyleDisplay()->EffectiveAppearance()) { - case StyleAppearance::Toolbar: case StyleAppearance::Statusbar: return true; default: @@ -2078,35 +2076,6 @@ void nsNativeThemeCocoa::DrawSegment(CGContextRef cgContext, RenderWithCoreUI(drawRect, cgContext, dict); } -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 gfx::Rect& aRect, NSWindow* aWindow) { - if (![aWindow isKindOfClass:[ToolbarWindow class]]) return false; - - ToolbarWindow* win = (ToolbarWindow*)aWindow; - float unifiedToolbarHeight = [win unifiedToolbarHeight]; - return aRect.X() == 0 && aRect.Width() >= [win frame].size.width && - aRect.YMost() <= unifiedToolbarHeight; -} - void nsNativeThemeCocoa::DrawStatusBar(CGContextRef cgContext, const HIRect& inBoxRect, bool aIsMain) { NS_OBJC_BEGIN_TRY_IGNORE_BLOCK; @@ -2329,25 +2298,12 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo( case StyleAppearance::Separator: return Some(WidgetInfo::Separator()); - case StyleAppearance::Toolbar: { - NSWindow* win = NativeWindowForFrame(aFrame); - bool isMain = [win isMainWindow]; - if (ToolbarCanBeUnified(nativeWidgetRect, win)) { - // Unified toolbars are drawn similar to vibrancy; we communicate their - // extents via the theme geometry mechanism and then place native views - // under Gecko's rendering. So Gecko just needs to be transparent in the - // place where the toolbar should be visible. - return Nothing(); - } - return Some(WidgetInfo::Toolbar(isMain)); - } - case StyleAppearance::MozWindowTitlebar: { return Nothing(); } case StyleAppearance::Statusbar: - return Some(WidgetInfo::StatusBar(IsActive(aFrame, YES))); + return Some(WidgetInfo::StatusBar(IsActiveToolbarControl(aFrame))); case StyleAppearance::MenulistButton: case StyleAppearance::Menulist: { @@ -2594,11 +2550,6 @@ void nsNativeThemeCocoa::RenderWidget(const WidgetInfo& aWidgetInfo, HIThemeDrawSeparator(&macRect, &sdi, cgContext, HITHEME_ORIENTATION); break; } - case Widget::eToolbar: { - bool isMain = aWidgetInfo.Params<bool>(); - DrawToolbar(cgContext, macRect, isMain); - break; - } case Widget::eStatusBar: { bool isMain = aWidgetInfo.Params<bool>(); DrawStatusBar(cgContext, macRect, isMain); @@ -2710,7 +2661,6 @@ bool nsNativeThemeCocoa::CreateWebRenderCommandsForWidget( case StyleAppearance::SpinnerDownbutton: case StyleAppearance::Toolbarbutton: case StyleAppearance::Separator: - case StyleAppearance::Toolbar: case StyleAppearance::MozWindowTitlebar: case StyleAppearance::Statusbar: case StyleAppearance::Menulist: @@ -3091,8 +3041,6 @@ nsNativeThemeCocoa::WidgetStateChanged(nsIFrame* aFrame, // Some widget types just never change state. switch (aAppearance) { case StyleAppearance::MozWindowTitlebar: - case StyleAppearance::Toolbox: - case StyleAppearance::Toolbar: case StyleAppearance::Statusbar: case StyleAppearance::Tooltip: case StyleAppearance::Tabpanels: @@ -3178,13 +3126,11 @@ bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, case StyleAppearance::Spinner: case StyleAppearance::SpinnerUpbutton: case StyleAppearance::SpinnerDownbutton: - case StyleAppearance::Toolbar: case StyleAppearance::Statusbar: case StyleAppearance::NumberInput: case StyleAppearance::Textfield: case StyleAppearance::Textarea: case StyleAppearance::Searchfield: - case StyleAppearance::Toolbox: case StyleAppearance::ProgressBar: case StyleAppearance::Progresschunk: case StyleAppearance::Meter: @@ -3265,7 +3211,6 @@ bool nsNativeThemeCocoa::WidgetAppearanceDependsOnWindowFocus( case StyleAppearance::SpinnerUpbutton: case StyleAppearance::SpinnerDownbutton: case StyleAppearance::Separator: - case StyleAppearance::Toolbox: case StyleAppearance::NumberInput: case StyleAppearance::Textfield: case StyleAppearance::Treeview: @@ -3283,16 +3228,8 @@ nsITheme::ThemeGeometryType nsNativeThemeCocoa::ThemeGeometryTypeForWidget( switch (aAppearance) { case StyleAppearance::MozWindowTitlebar: return eThemeGeometryTypeTitlebar; - case StyleAppearance::Toolbar: - return eThemeGeometryTypeToolbar; - case StyleAppearance::Toolbox: - return eThemeGeometryTypeToolbox; case StyleAppearance::MozWindowButtonBox: return eThemeGeometryTypeWindowButtons; - case StyleAppearance::Tooltip: - return eThemeGeometryTypeTooltip; - case StyleAppearance::Menupopup: - return eThemeGeometryTypeMenu; default: return eThemeGeometryTypeUnknown; } @@ -3307,7 +3244,6 @@ nsITheme::Transparency nsNativeThemeCocoa::GetWidgetTransparency( switch (aAppearance) { case StyleAppearance::Menupopup: case StyleAppearance::Tooltip: - case StyleAppearance::Toolbar: return eTransparent; case StyleAppearance::MozMacUnifiedToolbarWindow: // We want these to be treated as opaque by Gecko. We ensure there's an |