2012-05-16 15:47:10 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-06-10 23:44:50 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2012-05-16 15:47:10 +00:00
|
|
|
|
|
|
|
#ifndef nsMeterFrame_h___
|
|
|
|
#define nsMeterFrame_h___
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-05-16 15:47:10 +00:00
|
|
|
#include "nsContainerFrame.h"
|
|
|
|
#include "nsIAnonymousContentCreator.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
|
|
|
class nsMeterFrame : public nsContainerFrame,
|
|
|
|
public nsIAnonymousContentCreator
|
|
|
|
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsMeterFrame)
|
|
|
|
NS_DECL_QUERYFRAME
|
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
|
|
|
nsMeterFrame(nsStyleContext* aContext);
|
|
|
|
virtual ~nsMeterFrame();
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
|
2012-05-16 15:47:10 +00:00
|
|
|
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aCX,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2013-05-14 16:33:23 +00:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2012-05-16 15:47:10 +00:00
|
|
|
|
2012-06-25 19:59:42 +00:00
|
|
|
#ifdef DEBUG
|
2013-05-14 16:33:23 +00:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE {
|
2012-05-16 15:47:10 +00:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("Meter"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual bool IsLeaf() const MOZ_OVERRIDE { return true; }
|
2012-05-16 15:47:10 +00:00
|
|
|
|
|
|
|
// nsIAnonymousContentCreator
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
|
2012-05-16 15:47:10 +00:00
|
|
|
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
|
2012-09-14 16:10:08 +00:00
|
|
|
uint32_t aFilter) MOZ_OVERRIDE;
|
2012-05-16 15:47:10 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD AttributeChanged(int32_t aNameSpaceID,
|
2012-05-16 15:47:10 +00:00
|
|
|
nsIAtom* aAttribute,
|
2013-05-14 16:33:23 +00:00
|
|
|
int32_t aModType) MOZ_OVERRIDE;
|
2012-05-16 15:47:10 +00:00
|
|
|
|
|
|
|
virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
|
|
|
nsSize aCBSize, nscoord aAvailableWidth,
|
|
|
|
nsSize aMargin, nsSize aBorder,
|
2012-09-14 16:10:08 +00:00
|
|
|
nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE;
|
2012-05-16 15:47:10 +00:00
|
|
|
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
2012-06-05 20:15:46 +00:00
|
|
|
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
|
2012-05-16 15:47:10 +00:00
|
|
|
{
|
|
|
|
return nsContainerFrame::IsFrameOfType(aFlags &
|
|
|
|
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
|
|
|
|
}
|
|
|
|
|
2012-05-16 16:31:01 +00:00
|
|
|
/**
|
|
|
|
* Returns whether the frame and its child should use the native style.
|
|
|
|
*/
|
|
|
|
bool ShouldUseNativeStyle() const;
|
|
|
|
|
2013-12-02 23:57:50 +00:00
|
|
|
virtual nsIContent* GetPseudoElementContent(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
|
|
|
|
|
2012-05-16 15:47:10 +00:00
|
|
|
protected:
|
|
|
|
// Helper function which reflow the anonymous div frame.
|
|
|
|
void ReflowBarFrame(nsIFrame* aBarFrame,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
/**
|
|
|
|
* The div used to show the meter bar.
|
|
|
|
* @see nsMeterFrame::CreateAnonymousContent
|
|
|
|
*/
|
|
|
|
nsCOMPtr<nsIContent> mBarDiv;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|