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