Bug 1769547 - Do not MOZ_CRASH() on missing process r=nika
[gecko.git] / widget / ThemeCocoa.cpp
blobd29e76123dc0d0f2dca53e0f58f54a0003f3c4d0
1 /* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "ThemeCocoa.h"
8 #include "cocoa/MacThemeGeometryType.h"
9 #include "gfxPlatform.h"
10 #include "mozilla/ClearOnShutdown.h"
11 #include "mozilla/gfx/Helpers.h"
12 #include "mozilla/LookAndFeel.h"
13 #include "mozilla/ServoStyleConsts.h"
15 namespace mozilla::widget {
17 NS_IMETHODIMP
18 ThemeCocoa::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame* aFrame,
19 StyleAppearance aAppearance,
20 LayoutDeviceIntSize* aResult,
21 bool* aIsOverridable) {
22 if (aAppearance == StyleAppearance::MozMenulistArrowButton) {
23 auto size = ScrollbarDrawingCocoa::GetScrollbarSize(
24 StyleScrollbarWidth::Auto, /* aOverlay = */ false,
25 GetDPIRatio(aFrame, aAppearance));
26 aResult->SizeTo(size, size);
27 return NS_OK;
30 return Theme::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance, aResult,
31 aIsOverridable);
34 nsITheme::ThemeGeometryType ThemeCocoa::ThemeGeometryTypeForWidget(
35 nsIFrame* aFrame, StyleAppearance aAppearance) {
36 switch (aAppearance) {
37 case StyleAppearance::Tooltip:
38 return eThemeGeometryTypeTooltip;
39 default:
40 break;
42 return Theme::ThemeGeometryTypeForWidget(aFrame, aAppearance);
45 bool ThemeCocoa::ThemeSupportsWidget(nsPresContext* aPc, nsIFrame* aFrame,
46 StyleAppearance aAppearance) {
47 switch (aAppearance) {
48 case StyleAppearance::Tooltip:
49 return true;
50 default:
51 break;
53 return Theme::ThemeSupportsWidget(aPc, aFrame, aAppearance);
56 } // namespace mozilla::widget