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 nsProgressFrame_h___
8 #define nsProgressFrame_h___
10 #include "mozilla/Attributes.h"
11 #include "nsContainerFrame.h"
12 #include "nsIAnonymousContentCreator.h"
16 enum class PseudoStyleType
: uint8_t;
17 } // namespace mozilla
19 class nsProgressFrame final
: public nsContainerFrame
,
20 public nsIAnonymousContentCreator
{
21 typedef mozilla::PseudoStyleType PseudoStyleType
;
22 typedef mozilla::dom::Element Element
;
26 NS_DECL_FRAMEARENA_HELPERS(nsProgressFrame
)
28 explicit nsProgressFrame(ComputedStyle
* aStyle
, nsPresContext
* aPresContext
);
29 virtual ~nsProgressFrame();
31 void Destroy(DestroyContext
&) override
;
33 virtual void BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
34 const nsDisplayListSet
& aLists
) override
;
36 virtual void Reflow(nsPresContext
* aCX
, ReflowOutput
& aDesiredSize
,
37 const ReflowInput
& aReflowInput
,
38 nsReflowStatus
& aStatus
) override
;
40 #ifdef DEBUG_FRAME_DUMP
41 virtual nsresult
GetFrameName(nsAString
& aResult
) const override
{
42 return MakeFrameName(u
"Progress"_ns
, aResult
);
46 // nsIAnonymousContentCreator
47 virtual nsresult
CreateAnonymousContent(
48 nsTArray
<ContentInfo
>& aElements
) override
;
49 virtual void AppendAnonymousContentTo(nsTArray
<nsIContent
*>& aElements
,
50 uint32_t aFilter
) override
;
52 virtual nsresult
AttributeChanged(int32_t aNameSpaceID
, nsAtom
* aAttribute
,
53 int32_t aModType
) override
;
55 virtual mozilla::LogicalSize
ComputeAutoSize(
56 gfxContext
* aRenderingContext
, mozilla::WritingMode aWM
,
57 const mozilla::LogicalSize
& aCBSize
, nscoord aAvailableISize
,
58 const mozilla::LogicalSize
& aMargin
,
59 const mozilla::LogicalSize
& aBorderPadding
,
60 const mozilla::StyleSizeOverrides
& aSizeOverrides
,
61 mozilla::ComputeSizeFlags aFlags
) override
;
63 virtual nscoord
GetMinISize(gfxContext
* aRenderingContext
) override
;
64 virtual nscoord
GetPrefISize(gfxContext
* aRenderingContext
) override
;
67 * Returns whether the frame and its child should use the native style.
69 bool ShouldUseNativeStyle() const;
72 // Helper function to reflow a child frame.
73 void ReflowChildFrame(nsIFrame
* aChild
, nsPresContext
* aPresContext
,
74 const ReflowInput
& aReflowInput
,
75 nsReflowStatus
& aStatus
);
78 * The div used to show the progress bar.
79 * @see nsProgressFrame::CreateAnonymousContent
81 nsCOMPtr
<Element
> mBarDiv
;