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_ScrollbarDrawingCocoa_h
8 #define mozilla_widget_ScrollbarDrawingCocoa_h
10 #include "ScrollbarDrawing.h"
12 #include "mozilla/Array.h"
14 namespace mozilla::widget
{
16 class ScrollbarDrawingCocoa final
: public ScrollbarDrawing
{
18 ScrollbarDrawingCocoa() : ScrollbarDrawing(Kind::Cocoa
) {}
19 virtual ~ScrollbarDrawingCocoa() = default;
21 LayoutDeviceIntSize
GetMinimumWidgetSize(nsPresContext
*,
22 StyleAppearance aAppearance
,
23 nsIFrame
* aFrame
) override
;
25 static CSSIntCoord
GetScrollbarSize(StyleScrollbarWidth aWidth
,
27 static LayoutDeviceIntCoord
GetScrollbarSize(StyleScrollbarWidth aWidth
,
30 ScrollbarSizes
GetScrollbarSizes(nsPresContext
*, StyleScrollbarWidth
,
33 template <typename PaintBackendData
>
34 void DoPaintScrollbarThumb(PaintBackendData
&, const LayoutDeviceRect
& aRect
,
35 bool aHorizontal
, nsIFrame
* aFrame
,
36 const ComputedStyle
& aStyle
,
37 const EventStates
& aElementState
,
38 const EventStates
& aDocumentState
,
40 bool PaintScrollbarThumb(DrawTarget
&, const LayoutDeviceRect
&,
41 bool aHorizontal
, nsIFrame
*, const ComputedStyle
&,
42 const EventStates
& aElementState
,
43 const EventStates
& aDocumentState
, const Colors
&,
44 const DPIRatio
&) override
;
45 bool PaintScrollbarThumb(WebRenderBackendData
&, const LayoutDeviceRect
&,
46 bool aHorizontal
, nsIFrame
*, const ComputedStyle
&,
47 const EventStates
& aElementState
,
48 const EventStates
& aDocumentState
, const Colors
&,
49 const DPIRatio
&) override
;
51 template <typename PaintBackendData
>
52 void DoPaintScrollbarTrack(PaintBackendData
&, const LayoutDeviceRect
&, bool,
53 nsIFrame
*, const ComputedStyle
&,
54 const EventStates
&, const DPIRatio
&);
55 bool PaintScrollbarTrack(DrawTarget
&, const LayoutDeviceRect
& aRect
,
56 bool aHorizontal
, nsIFrame
* aFrame
,
57 const ComputedStyle
& aStyle
,
58 const EventStates
& aDocumentState
, const Colors
&,
59 const DPIRatio
&) override
;
60 bool PaintScrollbarTrack(WebRenderBackendData
&, const LayoutDeviceRect
& aRect
,
61 bool aHorizontal
, nsIFrame
* aFrame
,
62 const ComputedStyle
& aStyle
,
63 const EventStates
& aDocumentState
, const Colors
&,
64 const DPIRatio
&) override
;
66 template <typename PaintBackendData
>
67 void DoPaintScrollCorner(PaintBackendData
&, const LayoutDeviceRect
&,
68 nsIFrame
*, const ComputedStyle
&, const EventStates
&,
70 bool PaintScrollCorner(DrawTarget
&, const LayoutDeviceRect
& aRect
,
71 nsIFrame
* aFrame
, const ComputedStyle
& aStyle
,
72 const EventStates
& aDocumentState
, const Colors
&,
73 const DPIRatio
&) override
;
74 bool PaintScrollCorner(WebRenderBackendData
&, const LayoutDeviceRect
& aRect
,
75 nsIFrame
* aFrame
, const ComputedStyle
& aStyle
,
76 const EventStates
& aDocumentState
, const Colors
&,
77 const DPIRatio
&) override
;
79 void RecomputeScrollbarParams() override
;
81 bool ShouldDrawScrollbarButtons() override
{ return false; }
84 } // namespace mozilla::widget