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 nsMeterFrame_h___
7 #define nsMeterFrame_h___
9 #include "mozilla/Attributes.h"
10 #include "nsContainerFrame.h"
11 #include "nsIAnonymousContentCreator.h"
14 class nsMeterFrame
: public nsContainerFrame
,
15 public nsIAnonymousContentCreator
18 typedef mozilla::dom::Element Element
;
21 NS_DECL_QUERYFRAME_TARGET(nsMeterFrame
)
23 NS_DECL_FRAMEARENA_HELPERS
25 explicit nsMeterFrame(nsStyleContext
* aContext
);
26 virtual ~nsMeterFrame();
28 virtual void DestroyFrom(nsIFrame
* aDestructRoot
) MOZ_OVERRIDE
;
30 virtual void Reflow(nsPresContext
* aCX
,
31 nsHTMLReflowMetrics
& aDesiredSize
,
32 const nsHTMLReflowState
& aReflowState
,
33 nsReflowStatus
& aStatus
) MOZ_OVERRIDE
;
35 #ifdef DEBUG_FRAME_DUMP
36 virtual nsresult
GetFrameName(nsAString
& aResult
) const MOZ_OVERRIDE
{
37 return MakeFrameName(NS_LITERAL_STRING("Meter"), aResult
);
41 virtual bool IsLeaf() const MOZ_OVERRIDE
{ return true; }
43 // nsIAnonymousContentCreator
44 virtual nsresult
CreateAnonymousContent(nsTArray
<ContentInfo
>& aElements
) MOZ_OVERRIDE
;
45 virtual void AppendAnonymousContentTo(nsTArray
<nsIContent
*>& aElements
,
46 uint32_t aFilter
) MOZ_OVERRIDE
;
48 virtual nsresult
AttributeChanged(int32_t aNameSpaceID
,
50 int32_t aModType
) MOZ_OVERRIDE
;
52 virtual mozilla::LogicalSize
53 ComputeAutoSize(nsRenderingContext
*aRenderingContext
,
54 mozilla::WritingMode aWritingMode
,
55 const mozilla::LogicalSize
& aCBSize
,
56 nscoord aAvailableISize
,
57 const mozilla::LogicalSize
& aMargin
,
58 const mozilla::LogicalSize
& aBorder
,
59 const mozilla::LogicalSize
& aPadding
,
60 bool aShrinkWrap
) MOZ_OVERRIDE
;
62 virtual nscoord
GetMinISize(nsRenderingContext
*aRenderingContext
) MOZ_OVERRIDE
;
63 virtual nscoord
GetPrefISize(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
);
85 * The div used to show the meter bar.
86 * @see nsMeterFrame::CreateAnonymousContent
88 nsCOMPtr
<Element
> mBarDiv
;