1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsMathMLmpaddedFrame_h___
8 #define nsMathMLmpaddedFrame_h___
10 #include "mozilla/Attributes.h"
11 #include "nsCSSValue.h"
12 #include "nsMathMLContainerFrame.h"
16 } // namespace mozilla
19 // <mpadded> -- adjust space around content
22 class nsMathMLmpaddedFrame final
: public nsMathMLContainerFrame
{
24 NS_DECL_FRAMEARENA_HELPERS(nsMathMLmpaddedFrame
)
26 friend nsIFrame
* NS_NewMathMLmpaddedFrame(mozilla::PresShell
* aPresShell
,
27 ComputedStyle
* aStyle
);
30 InheritAutomaticData(nsIFrame
* aParent
) override
;
33 TransmitAutomaticData() override
{
34 return TransmitAutomaticDataForMrowLikeElement();
37 virtual void Reflow(nsPresContext
* aPresContext
, ReflowOutput
& aDesiredSize
,
38 const ReflowInput
& aReflowInput
,
39 nsReflowStatus
& aStatus
) override
;
41 nsresult
Place(DrawTarget
* aDrawTarget
, const PlaceFlags
& aFlags
,
42 ReflowOutput
& aDesiredSize
) override
;
44 bool IsMrowLike() override
{
45 return mFrames
.FirstChild() != mFrames
.LastChild() || !mFrames
.FirstChild();
49 explicit nsMathMLmpaddedFrame(ComputedStyle
* aStyle
,
50 nsPresContext
* aPresContext
)
51 : nsMathMLContainerFrame(aStyle
, aPresContext
, kClassID
),
56 mVerticalOffsetSign(0),
60 mLeadingSpacePseudoUnit(0),
61 mVerticalOffsetPseudoUnit(0) {}
63 virtual ~nsMathMLmpaddedFrame();
65 virtual nsresult
MeasureForWidth(DrawTarget
* aDrawTarget
,
66 ReflowOutput
& aDesiredSize
) override
;
72 nsCSSValue mLeadingSpace
;
73 nsCSSValue mVerticalOffset
;
78 int32_t mLeadingSpaceSign
;
79 int32_t mVerticalOffsetSign
;
81 int32_t mWidthPseudoUnit
;
82 int32_t mHeightPseudoUnit
;
83 int32_t mDepthPseudoUnit
;
84 int32_t mLeadingSpacePseudoUnit
;
85 int32_t mVerticalOffsetPseudoUnit
;
87 // helpers to process the attributes
88 void ProcessAttributes();
90 bool ParseAttribute(nsString
& aString
, int32_t& aSign
, nsCSSValue
& aCSSValue
,
91 int32_t& aPseudoUnit
);
93 void UpdateValue(int32_t aSign
, int32_t aPseudoUnit
,
94 const nsCSSValue
& aCSSValue
,
95 const ReflowOutput
& aDesiredSize
, nscoord
& aValueToUpdate
,
96 float aFontSizeInflation
) const;
99 #endif /* nsMathMLmpaddedFrame_h___ */