2011-05-10 05:59:07 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2011-05-10 05:59:07 -07:00
|
|
|
|
|
|
|
#ifndef nsProgressFrame_h___
|
|
|
|
#define nsProgressFrame_h___
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-12-27 12:18:48 -08:00
|
|
|
#include "nsContainerFrame.h"
|
2011-05-10 05:59:07 -07:00
|
|
|
#include "nsIAnonymousContentCreator.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
2011-12-27 12:18:48 -08:00
|
|
|
class nsProgressFrame : public nsContainerFrame,
|
2011-05-10 05:59:07 -07:00
|
|
|
public nsIAnonymousContentCreator
|
|
|
|
{
|
2013-12-02 20:49:03 -08:00
|
|
|
typedef mozilla::dom::Element Element;
|
|
|
|
|
2011-05-10 05:59:07 -07:00
|
|
|
public:
|
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsProgressFrame)
|
|
|
|
NS_DECL_QUERYFRAME
|
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2014-08-31 20:36:37 -07:00
|
|
|
explicit nsProgressFrame(nsStyleContext* aContext);
|
2011-05-10 05:59:07 -07:00
|
|
|
virtual ~nsProgressFrame();
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
2011-05-10 05:59:07 -07:00
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 09:28:04 -07:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2011-12-27 12:18:48 -08:00
|
|
|
|
2014-05-12 17:47:52 -07:00
|
|
|
virtual void Reflow(nsPresContext* aCX,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsReflowStatus& aStatus) override;
|
2011-05-10 05:59:07 -07:00
|
|
|
|
2014-01-05 15:31:14 -08:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override {
|
2011-05-10 05:59:07 -07:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("Progress"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsLeaf() const override { return true; }
|
2011-05-10 05:59:07 -07:00
|
|
|
|
|
|
|
// nsIAnonymousContentCreator
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
|
2014-07-16 11:41:57 -07:00
|
|
|
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
|
2015-03-21 09:28:04 -07:00
|
|
|
uint32_t aFilter) override;
|
2011-05-10 05:59:07 -07:00
|
|
|
|
2014-02-17 23:47:48 -08:00
|
|
|
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
|
2014-02-18 00:36:33 -08:00
|
|
|
nsIAtom* aAttribute,
|
2015-03-21 09:28:04 -07:00
|
|
|
int32_t aModType) override;
|
2011-05-10 05:59:07 -07:00
|
|
|
|
2014-08-24 07:34:51 -07:00
|
|
|
virtual mozilla::LogicalSize
|
|
|
|
ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
|
|
|
mozilla::WritingMode aWritingMode,
|
|
|
|
const mozilla::LogicalSize& aCBSize,
|
|
|
|
nscoord aAvailableISize,
|
|
|
|
const mozilla::LogicalSize& aMargin,
|
|
|
|
const mozilla::LogicalSize& aBorder,
|
|
|
|
const mozilla::LogicalSize& aPadding,
|
2015-03-21 09:28:04 -07:00
|
|
|
bool aShrinkWrap) override;
|
2011-05-10 05:59:07 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
|
2011-08-22 15:30:33 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
2011-05-10 05:59:07 -07:00
|
|
|
{
|
2011-12-27 12:18:48 -08:00
|
|
|
return nsContainerFrame::IsFrameOfType(aFlags &
|
2011-05-10 05:59:07 -07:00
|
|
|
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
|
|
|
|
}
|
|
|
|
|
2011-05-06 03:00:30 -07:00
|
|
|
/**
|
|
|
|
* Returns whether the frame and its child should use the native style.
|
|
|
|
*/
|
|
|
|
bool ShouldUseNativeStyle() const;
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) override;
|
2013-12-02 15:57:50 -08:00
|
|
|
|
2011-05-10 05:59:07 -07: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 progress bar.
|
|
|
|
* @see nsProgressFrame::CreateAnonymousContent
|
|
|
|
*/
|
2013-12-02 20:49:03 -08:00
|
|
|
nsCOMPtr<Element> mBarDiv;
|
2011-05-10 05:59:07 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|