Bug 1855360 - Fix the skip-if syntax. a=bustage-fix
[gecko.git] / widget / ThemeCocoa.cpp
blob733c215991f458a416ce5dd9d1be452d4d919ff2
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 LayoutDeviceIntSize ThemeCocoa::GetMinimumWidgetSize(
18 nsPresContext* aPresContext, nsIFrame* aFrame,
19 StyleAppearance aAppearance) {
20 if (aAppearance == StyleAppearance::MozMenulistArrowButton) {
21 auto size =
22 GetScrollbarSize(aPresContext, StyleScrollbarWidth::Auto, Overlay::No);
23 return {size, size};
25 return Theme::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance);
28 NS_IMETHODIMP
29 ThemeCocoa::DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame,
30 StyleAppearance aAppearance,
31 const nsRect& aRect, const nsRect& aDirtyRect,
32 DrawOverflow aDrawOverflow) {
33 switch (aAppearance) {
34 case StyleAppearance::Tooltip:
35 // Cocoa tooltip background and border are already drawn by the
36 // OS window server.
37 return NS_OK;
38 default:
39 break;
41 return Theme::DrawWidgetBackground(aContext, aFrame, aAppearance, aRect,
42 aDirtyRect, aDrawOverflow);
45 bool ThemeCocoa::CreateWebRenderCommandsForWidget(
46 mozilla::wr::DisplayListBuilder& aBuilder,
47 mozilla::wr::IpcResourceUpdateQueue& aResources,
48 const mozilla::layers::StackingContextHelper& aSc,
49 mozilla::layers::RenderRootStateManager* aManager, nsIFrame* aFrame,
50 StyleAppearance aAppearance, const nsRect& aRect) {
51 switch (aAppearance) {
52 case StyleAppearance::Tooltip:
53 // Cocoa tooltip background and border are already drawn by the
54 // OS window server.
55 return true;
56 default:
57 break;
59 return Theme::CreateWebRenderCommandsForWidget(
60 aBuilder, aResources, aSc, aManager, aFrame, aAppearance, aRect);
63 } // namespace mozilla::widget