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 nsMathMLmpaddedFrame_h___
7 : #define nsMathMLmpaddedFrame_h___
8 :
9 : #include "mozilla/Attributes.h"
10 : #include "nsMathMLContainerFrame.h"
11 :
12 : //
13 : // <mpadded> -- adjust space around content
14 : //
15 :
16 : class nsMathMLmpaddedFrame : public nsMathMLContainerFrame {
17 : public:
18 0 : NS_DECL_FRAMEARENA_HELPERS(nsMathMLmpaddedFrame)
19 :
20 : friend nsIFrame* NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
21 :
22 : NS_IMETHOD
23 : InheritAutomaticData(nsIFrame* aParent) override;
24 :
25 : NS_IMETHOD
26 0 : TransmitAutomaticData() override {
27 0 : return TransmitAutomaticDataForMrowLikeElement();
28 : }
29 :
30 : virtual void
31 : Reflow(nsPresContext* aPresContext,
32 : ReflowOutput& aDesiredSize,
33 : const ReflowInput& aReflowInput,
34 : nsReflowStatus& aStatus) override;
35 :
36 : virtual nsresult
37 : Place(DrawTarget* aDrawTarget,
38 : bool aPlaceOrigin,
39 : ReflowOutput& aDesiredSize) override;
40 :
41 : bool
42 0 : IsMrowLike() override {
43 0 : return mFrames.FirstChild() != mFrames.LastChild() ||
44 0 : !mFrames.FirstChild();
45 : }
46 :
47 : protected:
48 0 : explicit nsMathMLmpaddedFrame(nsStyleContext* aContext)
49 0 : : nsMathMLContainerFrame(aContext, kClassID)
50 : , mWidthSign(0)
51 : , mHeightSign(0)
52 : , mDepthSign(0)
53 : , mLeadingSpaceSign(0)
54 : , mVerticalOffsetSign(0)
55 : , mWidthPseudoUnit(0)
56 : , mHeightPseudoUnit(0)
57 : , mDepthPseudoUnit(0)
58 : , mLeadingSpacePseudoUnit(0)
59 0 : , mVerticalOffsetPseudoUnit(0)
60 0 : {}
61 :
62 : virtual ~nsMathMLmpaddedFrame();
63 :
64 : virtual nsresult
65 : MeasureForWidth(DrawTarget* aDrawTarget,
66 : ReflowOutput& aDesiredSize) override;
67 :
68 : private:
69 : nsCSSValue mWidth;
70 : nsCSSValue mHeight;
71 : nsCSSValue mDepth;
72 : nsCSSValue mLeadingSpace;
73 : nsCSSValue mVerticalOffset;
74 :
75 : int32_t mWidthSign;
76 : int32_t mHeightSign;
77 : int32_t mDepthSign;
78 : int32_t mLeadingSpaceSign;
79 : int32_t mVerticalOffsetSign;
80 :
81 : int32_t mWidthPseudoUnit;
82 : int32_t mHeightPseudoUnit;
83 : int32_t mDepthPseudoUnit;
84 : int32_t mLeadingSpacePseudoUnit;
85 : int32_t mVerticalOffsetPseudoUnit;
86 :
87 : // helpers to process the attributes
88 : void
89 : ProcessAttributes();
90 :
91 : static bool
92 : ParseAttribute(nsString& aString,
93 : int32_t& aSign,
94 : nsCSSValue& aCSSValue,
95 : int32_t& aPseudoUnit);
96 :
97 : void
98 : UpdateValue(int32_t aSign,
99 : int32_t aPseudoUnit,
100 : const nsCSSValue& aCSSValue,
101 : const ReflowOutput& aDesiredSize,
102 : nscoord& aValueToUpdate,
103 : float aFontSizeInflation) const;
104 : };
105 :
106 : #endif /* nsMathMLmpaddedFrame_h___ */
|