1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsProgressFrame_h___
7 #define nsProgressFrame_h___
9 #include "mozilla/Attributes.h"
10 #include "nsContainerFrame.h"
11 #include "nsIAnonymousContentCreator.h"
14 class nsBaseContentList
;
16 class nsProgressFrame
: public nsContainerFrame
,
17 public nsIAnonymousContentCreator
19 typedef mozilla::dom::Element Element
;
22 NS_DECL_QUERYFRAME_TARGET(nsProgressFrame
)
24 NS_DECL_FRAMEARENA_HELPERS
26 nsProgressFrame(nsStyleContext
* aContext
);
27 virtual ~nsProgressFrame();
29 virtual void DestroyFrom(nsIFrame
* aDestructRoot
) MOZ_OVERRIDE
;
31 virtual void BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
32 const nsRect
& aDirtyRect
,
33 const nsDisplayListSet
& aLists
) MOZ_OVERRIDE
;
35 NS_IMETHOD
Reflow(nsPresContext
* aCX
,
36 nsHTMLReflowMetrics
& aDesiredSize
,
37 const nsHTMLReflowState
& aReflowState
,
38 nsReflowStatus
& aStatus
) MOZ_OVERRIDE
;
40 #ifdef DEBUG_FRAME_DUMP
41 NS_IMETHOD
GetFrameName(nsAString
& aResult
) const MOZ_OVERRIDE
{
42 return MakeFrameName(NS_LITERAL_STRING("Progress"), aResult
);
46 virtual bool IsLeaf() const MOZ_OVERRIDE
{ return true; }
48 // nsIAnonymousContentCreator
49 virtual nsresult
CreateAnonymousContent(nsTArray
<ContentInfo
>& aElements
) MOZ_OVERRIDE
;
50 virtual void AppendAnonymousContentTo(nsBaseContentList
& aElements
,
51 uint32_t aFilter
) MOZ_OVERRIDE
;
53 NS_IMETHOD
AttributeChanged(int32_t aNameSpaceID
,
55 int32_t aModType
) MOZ_OVERRIDE
;
57 virtual nsSize
ComputeAutoSize(nsRenderingContext
*aRenderingContext
,
58 nsSize aCBSize
, nscoord aAvailableWidth
,
59 nsSize aMargin
, nsSize aBorder
,
60 nsSize aPadding
, bool aShrinkWrap
) MOZ_OVERRIDE
;
62 virtual nscoord
GetMinWidth(nsRenderingContext
*aRenderingContext
) MOZ_OVERRIDE
;
63 virtual nscoord
GetPrefWidth(nsRenderingContext
*aRenderingContext
) MOZ_OVERRIDE
;
65 virtual bool IsFrameOfType(uint32_t aFlags
) const MOZ_OVERRIDE
67 return nsContainerFrame::IsFrameOfType(aFlags
&
68 ~(nsIFrame::eReplaced
| nsIFrame::eReplacedContainsBlock
));
72 * Returns whether the frame and its child should use the native style.
74 bool ShouldUseNativeStyle() const;
76 virtual Element
* GetPseudoElement(nsCSSPseudoElements::Type aType
) MOZ_OVERRIDE
;
79 // Helper function which reflow the anonymous div frame.
80 void ReflowBarFrame(nsIFrame
* aBarFrame
,
81 nsPresContext
* aPresContext
,
82 const nsHTMLReflowState
& aReflowState
,
83 nsReflowStatus
& aStatus
);
86 * The div used to show the progress bar.
87 * @see nsProgressFrame::CreateAnonymousContent
89 nsCOMPtr
<Element
> mBarDiv
;