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 virtual void DestroyFrom(nsIFrame
* aDestructRoot
,
32 PostDestroyData
& aPostDestroyData
) override
;
34 virtual void BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
35 const nsDisplayListSet
& aLists
) override
;
37 virtual void Reflow(nsPresContext
* aCX
, ReflowOutput
& aDesiredSize
,
38 const ReflowInput
& aReflowInput
,
39 nsReflowStatus
& aStatus
) override
;
41 #ifdef DEBUG_FRAME_DUMP
42 virtual nsresult
GetFrameName(nsAString
& aResult
) const override
{
43 return MakeFrameName(NS_LITERAL_STRING("Progress"), aResult
);
47 // nsIAnonymousContentCreator
48 virtual nsresult
CreateAnonymousContent(
49 nsTArray
<ContentInfo
>& aElements
) override
;
50 virtual void AppendAnonymousContentTo(nsTArray
<nsIContent
*>& aElements
,
51 uint32_t aFilter
) override
;
53 virtual nsresult
AttributeChanged(int32_t aNameSpaceID
, nsAtom
* aAttribute
,
54 int32_t aModType
) override
;
56 virtual mozilla::LogicalSize
ComputeAutoSize(
57 gfxContext
* aRenderingContext
, mozilla::WritingMode aWM
,
58 const mozilla::LogicalSize
& aCBSize
, nscoord aAvailableISize
,
59 const mozilla::LogicalSize
& aMargin
, const mozilla::LogicalSize
& aBorder
,
60 const mozilla::LogicalSize
& aPadding
, ComputeSizeFlags aFlags
) override
;
62 virtual nscoord
GetMinISize(gfxContext
* aRenderingContext
) override
;
63 virtual nscoord
GetPrefISize(gfxContext
* aRenderingContext
) override
;
65 virtual bool IsFrameOfType(uint32_t aFlags
) const override
{
66 return nsContainerFrame::IsFrameOfType(
67 aFlags
& ~(nsIFrame::eReplaced
| nsIFrame::eReplacedContainsBlock
));
71 * Returns whether the frame and its child should use the native style.
73 bool ShouldUseNativeStyle() const;
76 // Helper function to reflow a child frame.
77 void ReflowChildFrame(nsIFrame
* aChild
, nsPresContext
* aPresContext
,
78 const ReflowInput
& aReflowInput
,
79 nsReflowStatus
& aStatus
);
82 * The div used to show the progress bar.
83 * @see nsProgressFrame::CreateAnonymousContent
85 nsCOMPtr
<Element
> mBarDiv
;