Bug 1858509 add thread-safety annotations around MediaSourceDemuxer::mMonitor r=alwu
[gecko.git] / layout / forms / nsButtonFrameRenderer.h
blobea5a9cdea451cce4e123f20994011c5aff82290f
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 nsButtonFrameRenderer_h___
8 #define nsButtonFrameRenderer_h___
10 #include "nsMargin.h"
11 #include "nsCSSRenderingBorders.h"
13 class gfxContext;
14 class nsIFrame;
15 class nsPresContext;
16 struct nsRect;
18 namespace mozilla {
19 class nsDisplayList;
20 class nsDisplayListBuilder;
21 } // namespace mozilla
23 #define NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX 0
24 #define NS_BUTTON_RENDERER_LAST_CONTEXT_INDEX \
25 NS_BUTTON_RENDERER_FOCUS_INNER_CONTEXT_INDEX
27 class nsButtonFrameRenderer {
28 using nsDisplayList = mozilla::nsDisplayList;
29 using nsDisplayListBuilder = mozilla::nsDisplayListBuilder;
31 typedef mozilla::image::ImgDrawResult ImgDrawResult;
32 typedef mozilla::ComputedStyle ComputedStyle;
34 public:
35 nsButtonFrameRenderer();
36 ~nsButtonFrameRenderer();
38 /**
39 * Create display list items for the button
41 nsresult DisplayButton(nsDisplayListBuilder* aBuilder,
42 nsDisplayList* aBackground,
43 nsDisplayList* aForeground);
45 ImgDrawResult PaintInnerFocusBorder(nsDisplayListBuilder* aBuilder,
46 nsPresContext* aPresContext,
47 gfxContext& aRenderingContext,
48 const nsRect& aDirtyRect,
49 const nsRect& aRect);
51 mozilla::Maybe<nsCSSBorderRenderer> CreateInnerFocusBorderRenderer(
52 nsDisplayListBuilder* aBuilder, nsPresContext* aPresContext,
53 gfxContext* aRenderingContext, const nsRect& aDirtyRect,
54 const nsRect& aRect, bool* aBorderIsEmpty);
56 ImgDrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
57 nsPresContext* aPresContext,
58 gfxContext& aRenderingContext,
59 const nsRect& aDirtyRect, const nsRect& aRect);
61 void SetFrame(nsIFrame* aFrame, nsPresContext* aPresContext);
63 void SetDisabled(bool aDisabled, bool notify);
65 bool isActive();
66 bool isDisabled();
68 void GetButtonInnerFocusRect(const nsRect& aRect, nsRect& aResult);
70 ComputedStyle* GetComputedStyle(int32_t aIndex) const;
71 void SetComputedStyle(int32_t aIndex, ComputedStyle* aComputedStyle);
72 void ReResolveStyles(nsPresContext* aPresContext);
74 nsIFrame* GetFrame();
76 private:
77 // cached style for optional inner focus outline (used on Windows).
78 RefPtr<ComputedStyle> mInnerFocusStyle;
80 nsIFrame* mFrame;
83 #endif