From be6bc3a5757e38294bf1f0fae6ea5e89dbe7048a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 7 Dec 2022 18:47:53 +0000 Subject: [PATCH] Bug 1802314 - Use non-native tooltips in the cocoa non-native theme too. r=spohl We implemented a basic ThemeGeometry-based tooltip in https://hg.mozilla.org/integration/autoland/rev/e8d65866112f, but now that we have non-native theme support for these it seems ok to just use it. Differential Revision: https://phabricator.services.mozilla.com/D163023 --- widget/Theme.cpp | 12 +++++++++--- widget/ThemeCocoa.cpp | 22 ---------------------- widget/ThemeCocoa.h | 4 ---- 3 files changed, 9 insertions(+), 29 deletions(-) diff --git a/widget/Theme.cpp b/widget/Theme.cpp index 439f9217f988..594a994054a8 100644 --- a/widget/Theme.cpp +++ b/widget/Theme.cpp @@ -1580,9 +1580,15 @@ LayoutDeviceIntSize Theme::GetMinimumWidgetSize(nsPresContext* aPresContext, nsITheme::Transparency Theme::GetWidgetTransparency( nsIFrame* aFrame, StyleAppearance aAppearance) { - return GetScrollbarDrawing() - .GetScrollbarPartTransparency(aFrame, aAppearance) - .valueOr(eUnknownTransparency); + if (auto scrollbar = GetScrollbarDrawing().GetScrollbarPartTransparency( + aFrame, aAppearance)) { + return *scrollbar; + } + if (aAppearance == StyleAppearance::Tooltip) { + // We draw a rounded rect, so we need transparency. + return eTransparent; + } + return eUnknownTransparency; } NS_IMETHODIMP diff --git a/widget/ThemeCocoa.cpp b/widget/ThemeCocoa.cpp index dd8655454f02..f095d9802be4 100644 --- a/widget/ThemeCocoa.cpp +++ b/widget/ThemeCocoa.cpp @@ -26,26 +26,4 @@ LayoutDeviceIntSize ThemeCocoa::GetMinimumWidgetSize( return Theme::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance); } -nsITheme::ThemeGeometryType ThemeCocoa::ThemeGeometryTypeForWidget( - nsIFrame* aFrame, StyleAppearance aAppearance) { - switch (aAppearance) { - case StyleAppearance::Tooltip: - return eThemeGeometryTypeTooltip; - default: - break; - } - return Theme::ThemeGeometryTypeForWidget(aFrame, aAppearance); -} - -bool ThemeCocoa::ThemeSupportsWidget(nsPresContext* aPc, nsIFrame* aFrame, - StyleAppearance aAppearance) { - switch (aAppearance) { - case StyleAppearance::Tooltip: - return true; - default: - break; - } - return Theme::ThemeSupportsWidget(aPc, aFrame, aAppearance); -} - } // namespace mozilla::widget diff --git a/widget/ThemeCocoa.h b/widget/ThemeCocoa.h index 44b00425bccf..1e27faae8242 100644 --- a/widget/ThemeCocoa.h +++ b/widget/ThemeCocoa.h @@ -22,10 +22,6 @@ class ThemeCocoa : public Theme { nsPresContext* aPresContext, nsIFrame* aFrame, StyleAppearance aAppearance) override; - ThemeGeometryType ThemeGeometryTypeForWidget(nsIFrame*, - StyleAppearance) override; - bool ThemeSupportsWidget(nsPresContext*, nsIFrame*, StyleAppearance) override; - protected: virtual ~ThemeCocoa() = default; };