1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/forms/nsMeterFrame.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,86 @@ 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 nsMeterFrame_h___ 1.10 +#define nsMeterFrame_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 nsMeterFrame : public nsContainerFrame, 1.18 + public nsIAnonymousContentCreator 1.19 + 1.20 +{ 1.21 + typedef mozilla::dom::Element Element; 1.22 + 1.23 +public: 1.24 + NS_DECL_QUERYFRAME_TARGET(nsMeterFrame) 1.25 + NS_DECL_QUERYFRAME 1.26 + NS_DECL_FRAMEARENA_HELPERS 1.27 + 1.28 + nsMeterFrame(nsStyleContext* aContext); 1.29 + virtual ~nsMeterFrame(); 1.30 + 1.31 + virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE; 1.32 + 1.33 + virtual nsresult Reflow(nsPresContext* aCX, 1.34 + nsHTMLReflowMetrics& aDesiredSize, 1.35 + const nsHTMLReflowState& aReflowState, 1.36 + nsReflowStatus& aStatus) MOZ_OVERRIDE; 1.37 + 1.38 +#ifdef DEBUG_FRAME_DUMP 1.39 + virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE { 1.40 + return MakeFrameName(NS_LITERAL_STRING("Meter"), aResult); 1.41 + } 1.42 +#endif 1.43 + 1.44 + virtual bool IsLeaf() const MOZ_OVERRIDE { return true; } 1.45 + 1.46 + // nsIAnonymousContentCreator 1.47 + virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE; 1.48 + virtual void AppendAnonymousContentTo(nsBaseContentList& aElements, 1.49 + uint32_t aFilter) MOZ_OVERRIDE; 1.50 + 1.51 + virtual nsresult AttributeChanged(int32_t aNameSpaceID, 1.52 + nsIAtom* aAttribute, 1.53 + int32_t aModType) MOZ_OVERRIDE; 1.54 + 1.55 + virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext, 1.56 + nsSize aCBSize, nscoord aAvailableWidth, 1.57 + nsSize aMargin, nsSize aBorder, 1.58 + nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE; 1.59 + 1.60 + virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; 1.61 + virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; 1.62 + 1.63 + virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE 1.64 + { 1.65 + return nsContainerFrame::IsFrameOfType(aFlags & 1.66 + ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock)); 1.67 + } 1.68 + 1.69 + /** 1.70 + * Returns whether the frame and its child should use the native style. 1.71 + */ 1.72 + bool ShouldUseNativeStyle() const; 1.73 + 1.74 + virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE; 1.75 + 1.76 +protected: 1.77 + // Helper function which reflow the anonymous div frame. 1.78 + void ReflowBarFrame(nsIFrame* aBarFrame, 1.79 + nsPresContext* aPresContext, 1.80 + const nsHTMLReflowState& aReflowState, 1.81 + nsReflowStatus& aStatus); 1.82 + /** 1.83 + * The div used to show the meter bar. 1.84 + * @see nsMeterFrame::CreateAnonymousContent 1.85 + */ 1.86 + nsCOMPtr<Element> mBarDiv; 1.87 +}; 1.88 + 1.89 +#endif