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"
|
2016-04-29 23:23:17 +00:00
|
|
|
#include "nsCSSPseudoElements.h"
|
2012-05-16 15:47:10 +00:00
|
|
|
|
|
|
|
class nsMeterFrame : public nsContainerFrame,
|
|
|
|
public nsIAnonymousContentCreator
|
|
|
|
|
|
|
|
{
|
2013-12-03 04:49:03 +00:00
|
|
|
typedef mozilla::dom::Element Element;
|
|
|
|
|
2012-05-16 15:47:10 +00:00
|
|
|
public:
|
|
|
|
NS_DECL_QUERYFRAME
|
2017-05-26 10:11:11 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsMeterFrame)
|
2012-05-16 15:47:10 +00:00
|
|
|
|
2014-09-01 03:36:37 +00:00
|
|
|
explicit nsMeterFrame(nsStyleContext* aContext);
|
2012-05-16 15:47:10 +00:00
|
|
|
virtual ~nsMeterFrame();
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
2012-05-16 15:47:10 +00:00
|
|
|
|
2014-05-13 00:47:52 +00:00
|
|
|
virtual void Reflow(nsPresContext* aCX,
|
2016-07-21 10:36:38 +00:00
|
|
|
ReflowOutput& aDesiredSize,
|
2016-07-21 10:36:39 +00:00
|
|
|
const ReflowInput& aReflowInput,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsReflowStatus& aStatus) override;
|
2012-05-16 15:47:10 +00:00
|
|
|
|
2014-01-05 23:31:14 +00:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override {
|
2012-05-16 15:47:10 +00:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("Meter"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// nsIAnonymousContentCreator
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
|
2014-07-16 18:41:57 +00:00
|
|
|
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
|
2015-03-21 16:28:04 +00:00
|
|
|
uint32_t aFilter) override;
|
2012-05-16 15:47:10 +00:00
|
|
|
|
2014-02-18 07:47:48 +00:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
|
2014-02-18 08:36:33 +00:00
|
|
|
nsIAtom* aAttribute,
|
2015-03-21 16:28:04 +00:00
|
|
|
int32_t aModType) override;
|
2012-05-16 15:47:10 +00:00
|
|
|
|
2014-08-24 14:34:51 +00:00
|
|
|
virtual mozilla::LogicalSize
|
2017-06-09 19:14:53 +00:00
|
|
|
ComputeAutoSize(gfxContext* aRenderingContext,
|
2016-11-05 01:57:06 +00:00
|
|
|
mozilla::WritingMode aWM,
|
2014-08-24 14:34:51 +00:00
|
|
|
const mozilla::LogicalSize& aCBSize,
|
2016-11-05 01:57:06 +00:00
|
|
|
nscoord aAvailableISize,
|
2014-08-24 14:34:51 +00:00
|
|
|
const mozilla::LogicalSize& aMargin,
|
|
|
|
const mozilla::LogicalSize& aBorder,
|
|
|
|
const mozilla::LogicalSize& aPadding,
|
2016-11-05 01:57:06 +00:00
|
|
|
ComputeSizeFlags aFlags) override;
|
2012-05-16 15:47:10 +00:00
|
|
|
|
2017-06-09 19:14:53 +00:00
|
|
|
virtual nscoord GetMinISize(gfxContext *aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override;
|
2012-06-05 20:15:46 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const 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;
|
|
|
|
|
2016-04-29 23:23:17 +00:00
|
|
|
virtual Element* GetPseudoElement(mozilla::CSSPseudoElementType aType) override;
|
2013-12-02 23:57:50 +00:00
|
|
|
|
2012-05-16 15:47:10 +00:00
|
|
|
protected:
|
|
|
|
// Helper function which reflow the anonymous div frame.
|
|
|
|
void ReflowBarFrame(nsIFrame* aBarFrame,
|
|
|
|
nsPresContext* aPresContext,
|
2016-07-21 10:36:39 +00:00
|
|
|
const ReflowInput& aReflowInput,
|
2012-05-16 15:47:10 +00:00
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
/**
|
|
|
|
* The div used to show the meter bar.
|
|
|
|
* @see nsMeterFrame::CreateAnonymousContent
|
|
|
|
*/
|
2013-12-03 04:49:03 +00:00
|
|
|
nsCOMPtr<Element> mBarDiv;
|
2012-05-16 15:47:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|