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___
11 #include "nsCSSRenderingBorders.h"
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
;
35 nsButtonFrameRenderer();
36 ~nsButtonFrameRenderer();
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
,
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
);
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
);
77 // cached style for optional inner focus outline (used on Windows).
78 RefPtr
<ComputedStyle
> mInnerFocusStyle
;