1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/forms/nsProgressFrame.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,93 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsProgressFrame_h___ 1.10 +#define nsProgressFrame_h___ 1.11 + 1.12 +#include "mozilla/Attributes.h" 1.13 +#include "nsContainerFrame.h" 1.14 +#include "nsIAnonymousContentCreator.h" 1.15 +#include "nsCOMPtr.h" 1.16 + 1.17 +class nsBaseContentList; 1.18 + 1.19 +class nsProgressFrame : public nsContainerFrame, 1.20 + public nsIAnonymousContentCreator 1.21 +{ 1.22 + typedef mozilla::dom::Element Element; 1.23 + 1.24 +public: 1.25 + NS_DECL_QUERYFRAME_TARGET(nsProgressFrame) 1.26 + NS_DECL_QUERYFRAME 1.27 + NS_DECL_FRAMEARENA_HELPERS 1.28 + 1.29 + nsProgressFrame(nsStyleContext* aContext); 1.30 + virtual ~nsProgressFrame(); 1.31 + 1.32 + virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; 1.33 + 1.34 + virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, 1.35 + const nsRect& aDirtyRect, 1.36 + const nsDisplayListSet& aLists) MOZ_OVERRIDE; 1.37 + 1.38 + virtual nsresult Reflow(nsPresContext* aCX, 1.39 + nsHTMLReflowMetrics& aDesiredSize, 1.40 + const nsHTMLReflowState& aReflowState, 1.41 + nsReflowStatus& aStatus) MOZ_OVERRIDE; 1.42 + 1.43 +#ifdef DEBUG_FRAME_DUMP 1.44 + virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { 1.45 + return MakeFrameName(NS_LITERAL_STRING("Progress"), aResult); 1.46 + } 1.47 +#endif 1.48 + 1.49 + virtual bool IsLeaf() const MOZ_OVERRIDE { return true; } 1.50 + 1.51 + // nsIAnonymousContentCreator 1.52 + virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE; 1.53 + virtual void AppendAnonymousContentTo(nsBaseContentList& aElements, 1.54 + uint32_t aFilter) MOZ_OVERRIDE; 1.55 + 1.56 + virtual nsresult AttributeChanged(int32_t aNameSpaceID, 1.57 + nsIAtom* aAttribute, 1.58 + int32_t aModType) MOZ_OVERRIDE; 1.59 + 1.60 + virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext, 1.61 + nsSize aCBSize, nscoord aAvailableWidth, 1.62 + nsSize aMargin, nsSize aBorder, 1.63 + nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE; 1.64 + 1.65 + virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; 1.66 + virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; 1.67 + 1.68 + virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE 1.69 + { 1.70 + return nsContainerFrame::IsFrameOfType(aFlags & 1.71 + ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock)); 1.72 + } 1.73 + 1.74 + /** 1.75 + * Returns whether the frame and its child should use the native style. 1.76 + */ 1.77 + bool ShouldUseNativeStyle() const; 1.78 + 1.79 + virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE; 1.80 + 1.81 +protected: 1.82 + // Helper function which reflow the anonymous div frame. 1.83 + void ReflowBarFrame(nsIFrame* aBarFrame, 1.84 + nsPresContext* aPresContext, 1.85 + const nsHTMLReflowState& aReflowState, 1.86 + nsReflowStatus& aStatus); 1.87 + 1.88 + /** 1.89 + * The div used to show the progress bar. 1.90 + * @see nsProgressFrame::CreateAnonymousContent 1.91 + */ 1.92 + nsCOMPtr<Element> mBarDiv; 1.93 +}; 1.94 + 1.95 +#endif 1.96 +