Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / layout / mathml / nsMathMLmencloseFrame.h
blob25329eafadd24280c2b9ede0cd48dd17d843f3da
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"
15 namespace mozilla {
16 class PresShell;
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 {
34 NOTATION_LONGDIV,
35 NOTATION_ROUNDEDBOX,
36 NOTATION_CIRCLE,
37 NOTATION_LEFT,
38 NOTATION_RIGHT,
39 NOTATION_TOP,
40 NOTATION_BOTTOM,
41 NOTATION_UPDIAGONALSTRIKE,
42 NOTATION_DOWNDIAGONALSTRIKE,
43 NOTATION_VERTICALSTRIKE,
44 NOTATION_HORIZONTALSTRIKE,
45 NOTATION_UPDIAGONALARROW,
46 NOTATION_PHASORANGLE
49 class nsMathMLmencloseFrame : public nsMathMLContainerFrame {
50 public:
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;
67 NS_IMETHOD
68 InheritAutomaticData(nsIFrame* aParent) override;
70 nscoord FixInterFrameSpacing(ReflowOutput& aDesiredSize) override;
72 bool IsMrowLike() override {
73 return mFrames.FirstChild() != mFrames.LastChild() || !mFrames.FirstChild();
76 protected:
77 explicit nsMathMLmencloseFrame(ComputedStyle* aStyle,
78 nsPresContext* aPresContext);
79 virtual ~nsMathMLmencloseFrame();
81 // functions to parse the "notation" attribute.
82 nsresult AddNotation(const nsAString& aNotation);
83 void InitNotations();
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___ */