layout/forms/nsProgressFrame.h

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:5785f62ff3a3
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/. */
5
6 #ifndef nsProgressFrame_h___
7 #define nsProgressFrame_h___
8
9 #include "mozilla/Attributes.h"
10 #include "nsContainerFrame.h"
11 #include "nsIAnonymousContentCreator.h"
12 #include "nsCOMPtr.h"
13
14 class nsBaseContentList;
15
16 class nsProgressFrame : public nsContainerFrame,
17 public nsIAnonymousContentCreator
18 {
19 typedef mozilla::dom::Element Element;
20
21 public:
22 NS_DECL_QUERYFRAME_TARGET(nsProgressFrame)
23 NS_DECL_QUERYFRAME
24 NS_DECL_FRAMEARENA_HELPERS
25
26 nsProgressFrame(nsStyleContext* aContext);
27 virtual ~nsProgressFrame();
28
29 virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
30
31 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
32 const nsRect& aDirtyRect,
33 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
34
35 virtual nsresult Reflow(nsPresContext* aCX,
36 nsHTMLReflowMetrics& aDesiredSize,
37 const nsHTMLReflowState& aReflowState,
38 nsReflowStatus& aStatus) MOZ_OVERRIDE;
39
40 #ifdef DEBUG_FRAME_DUMP
41 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE {
42 return MakeFrameName(NS_LITERAL_STRING("Progress"), aResult);
43 }
44 #endif
45
46 virtual bool IsLeaf() const MOZ_OVERRIDE { return true; }
47
48 // nsIAnonymousContentCreator
49 virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
50 virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
51 uint32_t aFilter) MOZ_OVERRIDE;
52
53 virtual nsresult AttributeChanged(int32_t aNameSpaceID,
54 nsIAtom* aAttribute,
55 int32_t aModType) MOZ_OVERRIDE;
56
57 virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
58 nsSize aCBSize, nscoord aAvailableWidth,
59 nsSize aMargin, nsSize aBorder,
60 nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE;
61
62 virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
63 virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
64
65 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
66 {
67 return nsContainerFrame::IsFrameOfType(aFlags &
68 ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
69 }
70
71 /**
72 * Returns whether the frame and its child should use the native style.
73 */
74 bool ShouldUseNativeStyle() const;
75
76 virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
77
78 protected:
79 // Helper function which reflow the anonymous div frame.
80 void ReflowBarFrame(nsIFrame* aBarFrame,
81 nsPresContext* aPresContext,
82 const nsHTMLReflowState& aReflowState,
83 nsReflowStatus& aStatus);
84
85 /**
86 * The div used to show the progress bar.
87 * @see nsProgressFrame::CreateAnonymousContent
88 */
89 nsCOMPtr<Element> mBarDiv;
90 };
91
92 #endif
93

mercurial