Line data Source code
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 : namespace mozilla {
15 : enum class CSSPseudoElementType : uint8_t;
16 : } // namespace mozilla
17 :
18 : class nsProgressFrame final
19 : : public nsContainerFrame
20 : , public nsIAnonymousContentCreator
21 : {
22 : typedef mozilla::CSSPseudoElementType CSSPseudoElementType;
23 : typedef mozilla::dom::Element Element;
24 :
25 : public:
26 : NS_DECL_QUERYFRAME
27 0 : NS_DECL_FRAMEARENA_HELPERS(nsProgressFrame)
28 :
29 : explicit nsProgressFrame(nsStyleContext* aContext);
30 : virtual ~nsProgressFrame();
31 :
32 : virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
33 :
34 : virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
35 : const nsRect& aDirtyRect,
36 : const nsDisplayListSet& aLists) override;
37 :
38 : virtual void Reflow(nsPresContext* aCX,
39 : ReflowOutput& aDesiredSize,
40 : const ReflowInput& aReflowInput,
41 : nsReflowStatus& aStatus) override;
42 :
43 : #ifdef DEBUG_FRAME_DUMP
44 0 : virtual nsresult GetFrameName(nsAString& aResult) const override {
45 0 : return MakeFrameName(NS_LITERAL_STRING("Progress"), aResult);
46 : }
47 : #endif
48 :
49 : // nsIAnonymousContentCreator
50 : virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
51 : virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
52 : uint32_t aFilter) override;
53 :
54 : virtual nsresult AttributeChanged(int32_t aNameSpaceID,
55 : nsIAtom* aAttribute,
56 : int32_t aModType) override;
57 :
58 : virtual mozilla::LogicalSize
59 : ComputeAutoSize(gfxContext* aRenderingContext,
60 : mozilla::WritingMode aWM,
61 : const mozilla::LogicalSize& aCBSize,
62 : nscoord aAvailableISize,
63 : const mozilla::LogicalSize& aMargin,
64 : const mozilla::LogicalSize& aBorder,
65 : const mozilla::LogicalSize& aPadding,
66 : ComputeSizeFlags aFlags) override;
67 :
68 : virtual nscoord GetMinISize(gfxContext *aRenderingContext) override;
69 : virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override;
70 :
71 0 : virtual bool IsFrameOfType(uint32_t aFlags) const override
72 : {
73 0 : return nsContainerFrame::IsFrameOfType(aFlags &
74 0 : ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
75 : }
76 :
77 : /**
78 : * Returns whether the frame and its child should use the native style.
79 : */
80 : bool ShouldUseNativeStyle() const;
81 :
82 : virtual Element* GetPseudoElement(CSSPseudoElementType aType) override;
83 :
84 : protected:
85 : // Helper function to reflow a child frame.
86 : void ReflowChildFrame(nsIFrame* aChild,
87 : nsPresContext* aPresContext,
88 : const ReflowInput& aReflowInput,
89 : nsReflowStatus& aStatus);
90 :
91 : /**
92 : * The div used to show the progress bar.
93 : * @see nsProgressFrame::CreateAnonymousContent
94 : */
95 : nsCOMPtr<Element> mBarDiv;
96 : };
97 :
98 : #endif
|