michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsMeterFrame_h___ michael@0: #define nsMeterFrame_h___ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsContainerFrame.h" michael@0: #include "nsIAnonymousContentCreator.h" michael@0: #include "nsCOMPtr.h" michael@0: michael@0: class nsMeterFrame : public nsContainerFrame, michael@0: public nsIAnonymousContentCreator michael@0: michael@0: { michael@0: typedef mozilla::dom::Element Element; michael@0: michael@0: public: michael@0: NS_DECL_QUERYFRAME_TARGET(nsMeterFrame) michael@0: NS_DECL_QUERYFRAME michael@0: NS_DECL_FRAMEARENA_HELPERS michael@0: michael@0: nsMeterFrame(nsStyleContext* aContext); michael@0: virtual ~nsMeterFrame(); michael@0: michael@0: virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult Reflow(nsPresContext* aCX, michael@0: nsHTMLReflowMetrics& aDesiredSize, michael@0: const nsHTMLReflowState& aReflowState, michael@0: nsReflowStatus& aStatus) MOZ_OVERRIDE; michael@0: michael@0: #ifdef DEBUG_FRAME_DUMP michael@0: virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { michael@0: return MakeFrameName(NS_LITERAL_STRING("Meter"), aResult); michael@0: } michael@0: #endif michael@0: michael@0: virtual bool IsLeaf() const MOZ_OVERRIDE { return true; } michael@0: michael@0: // nsIAnonymousContentCreator michael@0: virtual nsresult CreateAnonymousContent(nsTArray& aElements) MOZ_OVERRIDE; michael@0: virtual void AppendAnonymousContentTo(nsBaseContentList& aElements, michael@0: uint32_t aFilter) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult AttributeChanged(int32_t aNameSpaceID, michael@0: nsIAtom* aAttribute, michael@0: int32_t aModType) MOZ_OVERRIDE; michael@0: michael@0: virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext, michael@0: nsSize aCBSize, nscoord aAvailableWidth, michael@0: nsSize aMargin, nsSize aBorder, michael@0: nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE; michael@0: michael@0: virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; michael@0: virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; michael@0: michael@0: virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE michael@0: { michael@0: return nsContainerFrame::IsFrameOfType(aFlags & michael@0: ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock)); michael@0: } michael@0: michael@0: /** michael@0: * Returns whether the frame and its child should use the native style. michael@0: */ michael@0: bool ShouldUseNativeStyle() const; michael@0: michael@0: virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE; michael@0: michael@0: protected: michael@0: // Helper function which reflow the anonymous div frame. michael@0: void ReflowBarFrame(nsIFrame* aBarFrame, michael@0: nsPresContext* aPresContext, michael@0: const nsHTMLReflowState& aReflowState, michael@0: nsReflowStatus& aStatus); michael@0: /** michael@0: * The div used to show the meter bar. michael@0: * @see nsMeterFrame::CreateAnonymousContent michael@0: */ michael@0: nsCOMPtr mBarDiv; michael@0: }; michael@0: michael@0: #endif