Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsMeterFrame_h___
7 #define nsMeterFrame_h___
9 #include "mozilla/Attributes.h"
10 #include "nsContainerFrame.h"
11 #include "nsIAnonymousContentCreator.h"
12 #include "nsCOMPtr.h"
14 class nsMeterFrame : public nsContainerFrame,
15 public nsIAnonymousContentCreator
17 {
18 typedef mozilla::dom::Element Element;
20 public:
21 NS_DECL_QUERYFRAME_TARGET(nsMeterFrame)
22 NS_DECL_QUERYFRAME
23 NS_DECL_FRAMEARENA_HELPERS
25 nsMeterFrame(nsStyleContext* aContext);
26 virtual ~nsMeterFrame();
28 virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
30 virtual nsresult Reflow(nsPresContext* aCX,
31 nsHTMLReflowMetrics& aDesiredSize,
32 const nsHTMLReflowState& aReflowState,
33 nsReflowStatus& aStatus) MOZ_OVERRIDE;
35 #ifdef DEBUG_FRAME_DUMP
36 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE {
37 return MakeFrameName(NS_LITERAL_STRING("Meter"), aResult);
38 }
39 #endif
41 virtual bool IsLeaf() const MOZ_OVERRIDE { return true; }
43 // nsIAnonymousContentCreator
44 virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
45 virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
46 uint32_t aFilter) MOZ_OVERRIDE;
48 virtual nsresult AttributeChanged(int32_t aNameSpaceID,
49 nsIAtom* aAttribute,
50 int32_t aModType) MOZ_OVERRIDE;
52 virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
53 nsSize aCBSize, nscoord aAvailableWidth,
54 nsSize aMargin, nsSize aBorder,
55 nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE;
57 virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
58 virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
60 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
61 {
62 return nsContainerFrame::IsFrameOfType(aFlags &
63 ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
64 }
66 /**
67 * Returns whether the frame and its child should use the native style.
68 */
69 bool ShouldUseNativeStyle() const;
71 virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
73 protected:
74 // Helper function which reflow the anonymous div frame.
75 void ReflowBarFrame(nsIFrame* aBarFrame,
76 nsPresContext* aPresContext,
77 const nsHTMLReflowState& aReflowState,
78 nsReflowStatus& aStatus);
79 /**
80 * The div used to show the meter bar.
81 * @see nsMeterFrame::CreateAnonymousContent
82 */
83 nsCOMPtr<Element> mBarDiv;
84 };
86 #endif