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
{
41 NOTATION_UPDIAGONALSTRIKE
,
42 NOTATION_DOWNDIAGONALSTRIKE
,
43 NOTATION_VERTICALSTRIKE
,
44 NOTATION_HORIZONTALSTRIKE
,
45 NOTATION_UPDIAGONALARROW
,
49 class nsMathMLmencloseFrame
: public nsMathMLContainerFrame
{
51 NS_DECL_FRAMEARENA_HELPERS(nsMathMLmencloseFrame
)
53 friend nsIFrame
* NS_NewMathMLmencloseFrame(mozilla::PresShell
* aPresShell
,
54 ComputedStyle
* aStyle
);
56 nsresult
Place(DrawTarget
* aDrawTarget
, const PlaceFlags
& aFlags
,
57 ReflowOutput
& aDesiredSize
) override
;
59 nsresult
AttributeChanged(int32_t aNameSpaceID
, nsAtom
* aAttribute
,
60 int32_t aModType
) override
;
62 void DidSetComputedStyle(ComputedStyle
* aOldStyle
) override
;
64 void BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
65 const nsDisplayListSet
& aLists
) override
;
68 InheritAutomaticData(nsIFrame
* aParent
) override
;
70 nscoord
FixInterFrameSpacing(ReflowOutput
& aDesiredSize
) override
;
72 bool IsMrowLike() override
{
73 return mFrames
.FirstChild() != mFrames
.LastChild() || !mFrames
.FirstChild();
77 explicit nsMathMLmencloseFrame(ComputedStyle
* aStyle
,
78 nsPresContext
* aPresContext
);
79 virtual ~nsMathMLmencloseFrame();
81 // functions to parse the "notation" attribute.
82 nsresult
AddNotation(const nsAString
& aNotation
);
85 // Description of the notations to draw
86 mozilla::EnumSet
<nsMencloseNotation
> mNotationsToDraw
;
87 bool IsToDraw(nsMencloseNotation notation
) {
88 return mNotationsToDraw
.contains(notation
);
91 nscoord mRuleThickness
;
92 nsTArray
<nsMathMLChar
> mMathMLChar
;
93 int8_t mLongDivCharIndex
;
94 nscoord mContentWidth
;
95 nsresult
AllocateMathMLChar(nsMencloseNotation mask
);
97 // Display a frame of the specified type.
98 // @param aType Type of frame to display
99 void DisplayNotation(nsDisplayListBuilder
* aBuilder
, nsIFrame
* aFrame
,
100 const nsRect
& aRect
, const nsDisplayListSet
& aLists
,
101 nscoord aThickness
, nsMencloseNotation aType
);
104 #endif /* nsMathMLmencloseFrame_h___ */