1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_widget_ScrollbarDrawing_h
8 #define mozilla_widget_ScrollbarDrawing_h
13 #include "mozilla/Array.h"
22 struct ScrollbarParams
{
24 bool rolledOver
= false;
26 bool horizontal
= false;
28 bool onDarkBackground
= false;
30 // Two colors only used when custom is true.
31 nscolor trackColor
= NS_RGBA(0, 0, 0, 0);
32 nscolor faceColor
= NS_RGBA(0, 0, 0, 0);
35 class ScrollbarDrawingMac final
{
42 static CSSIntCoord
GetScrollbarSize(StyleScrollbarWidth
, bool aOverlay
);
44 static LayoutDeviceIntCoord
GetScrollbarSize(StyleScrollbarWidth
,
45 bool aOverlay
, float aDpiRatio
);
46 static LayoutDeviceIntSize
GetMinimumWidgetSize(StyleAppearance aAppearance
,
49 static ScrollbarParams
ComputeScrollbarParams(nsIFrame
* aFrame
,
50 const ComputedStyle
& aStyle
,
53 // The caller can draw this rectangle with rounded corners as appropriate.
62 static ThumbRect
GetThumbRect(const gfx::Rect
& aRect
,
63 const ScrollbarParams
& aParams
, float aScale
);
65 using ScrollbarTrackRects
= Array
<FillRect
, 4>;
66 static bool GetScrollbarTrackRects(const gfx::Rect
& aRect
,
67 const ScrollbarParams
& aParams
,
68 float aScale
, ScrollbarTrackRects
&);
70 using ScrollCornerRects
= Array
<FillRect
, 7>;
71 static bool GetScrollCornerRects(const gfx::Rect
& aRect
,
72 const ScrollbarParams
& aParams
, float aScale
,
77 } // namespace mozilla