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 nsMathMLmencloseFrame_h___
8 #define nsMathMLmencloseFrame_h___
10 #include "mozilla/Attributes.h"
11 #include "mozilla/EnumSet.h"
12 #include "nsMathMLChar.h"
13 #include "nsMathMLContainerFrame.h"
17 } // namespace mozilla
20 // <menclose> -- enclose content with a stretching symbol such
21 // as a long division sign.
25 The MathML REC describes:
27 The menclose element renders its content inside the enclosing notation
28 specified by its notation attribute. menclose accepts any number of arguments;
29 if this number is not 1, its contents are treated as a single "inferred mrow"
30 containing its arguments, as described in Section 3.1.3 Required Arguments.
33 enum nsMencloseNotation
{
42 NOTATION_UPDIAGONALSTRIKE
,
43 NOTATION_DOWNDIAGONALSTRIKE
,
44 NOTATION_VERTICALSTRIKE
,
45 NOTATION_HORIZONTALSTRIKE
,
46 NOTATION_UPDIAGONALARROW
,
50 class nsMathMLmencloseFrame
: public nsMathMLContainerFrame
{
52 NS_DECL_FRAMEARENA_HELPERS(nsMathMLmencloseFrame
)
54 friend nsIFrame
* NS_NewMathMLmencloseFrame(mozilla::PresShell
* aPresShell
,
55 ComputedStyle
* aStyle
);
57 virtual nsresult
Place(DrawTarget
* aDrawTarget
, bool aPlaceOrigin
,
58 ReflowOutput
& aDesiredSize
) override
;
60 virtual nsresult
MeasureForWidth(DrawTarget
* aDrawTarget
,
61 ReflowOutput
& aDesiredSize
) override
;
63 virtual nsresult
AttributeChanged(int32_t aNameSpaceID
, nsAtom
* aAttribute
,
64 int32_t aModType
) override
;
66 void DidSetComputedStyle(ComputedStyle
* aOldStyle
) override
;
68 virtual void BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
69 const nsDisplayListSet
& aLists
) override
;
72 InheritAutomaticData(nsIFrame
* aParent
) override
;
75 TransmitAutomaticData() override
;
77 virtual nscoord
FixInterFrameSpacing(ReflowOutput
& aDesiredSize
) override
;
79 bool IsMrowLike() override
{
80 return mFrames
.FirstChild() != mFrames
.LastChild() || !mFrames
.FirstChild();
84 explicit nsMathMLmencloseFrame(ComputedStyle
* aStyle
,
85 nsPresContext
* aPresContext
,
86 ClassID aID
= kClassID
);
87 virtual ~nsMathMLmencloseFrame();
89 nsresult
PlaceInternal(DrawTarget
* aDrawTarget
, bool aPlaceOrigin
,
90 ReflowOutput
& aDesiredSize
, bool aWidthOnly
);
92 // functions to parse the "notation" attribute.
93 nsresult
AddNotation(const nsAString
& aNotation
);
96 // Description of the notations to draw
97 mozilla::EnumSet
<nsMencloseNotation
> mNotationsToDraw
;
98 bool IsToDraw(nsMencloseNotation notation
) {
99 return mNotationsToDraw
.contains(notation
);
102 nscoord mRuleThickness
;
103 nscoord mRadicalRuleThickness
;
104 nsTArray
<nsMathMLChar
> mMathMLChar
;
105 int8_t mLongDivCharIndex
, mRadicalCharIndex
;
106 nscoord mContentWidth
;
107 nsresult
AllocateMathMLChar(nsMencloseNotation mask
);
109 // Display a frame of the specified type.
110 // @param aType Type of frame to display
111 void DisplayNotation(nsDisplayListBuilder
* aBuilder
, nsIFrame
* aFrame
,
112 const nsRect
& aRect
, const nsDisplayListSet
& aLists
,
113 nscoord aThickness
, nsMencloseNotation aType
);
116 #endif /* nsMathMLmencloseFrame_h___ */