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 nsMathMLmoFrame_h___
7 : #define nsMathMLmoFrame_h___
8 :
9 : #include "mozilla/Attributes.h"
10 : #include "nsMathMLTokenFrame.h"
11 : #include "nsMathMLChar.h"
12 :
13 : //
14 : // <mo> -- operator, fence, or separator
15 : //
16 :
17 : class nsMathMLmoFrame : public nsMathMLTokenFrame {
18 : public:
19 0 : NS_DECL_FRAMEARENA_HELPERS(nsMathMLmoFrame)
20 :
21 : friend nsIFrame* NS_NewMathMLmoFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
22 :
23 : virtual eMathMLFrameType GetMathMLFrameType() override;
24 :
25 : virtual void
26 : SetAdditionalStyleContext(int32_t aIndex,
27 : nsStyleContext* aStyleContext) override;
28 : virtual nsStyleContext*
29 : GetAdditionalStyleContext(int32_t aIndex) const override;
30 :
31 : virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
32 : const nsRect& aDirtyRect,
33 : const nsDisplayListSet& aLists) override;
34 :
35 : NS_IMETHOD
36 : InheritAutomaticData(nsIFrame* aParent) override;
37 :
38 : NS_IMETHOD
39 : TransmitAutomaticData() override;
40 :
41 : virtual void
42 : SetInitialChildList(ChildListID aListID,
43 : nsFrameList& aChildList) override;
44 :
45 : virtual void
46 : Reflow(nsPresContext* aPresContext,
47 : ReflowOutput& aDesiredSize,
48 : const ReflowInput& aReflowInput,
49 : nsReflowStatus& aStatus) override;
50 :
51 : virtual nsresult
52 : Place(DrawTarget* aDrawTarget,
53 : bool aPlaceOrigin,
54 : ReflowOutput& aDesiredSize) override;
55 :
56 : virtual void MarkIntrinsicISizesDirty() override;
57 :
58 : virtual void
59 : GetIntrinsicISizeMetrics(gfxContext* aRenderingContext,
60 : ReflowOutput& aDesiredSize) override;
61 :
62 : virtual nsresult
63 : AttributeChanged(int32_t aNameSpaceID,
64 : nsIAtom* aAttribute,
65 : int32_t aModType) override;
66 :
67 : // This method is called by the parent frame to ask <mo>
68 : // to stretch itself.
69 : NS_IMETHOD
70 : Stretch(DrawTarget* aDrawTarget,
71 : nsStretchDirection aStretchDirection,
72 : nsBoundingMetrics& aContainerSize,
73 : ReflowOutput& aDesiredStretchSize) override;
74 :
75 : virtual nsresult
76 0 : ChildListChanged(int32_t aModType) override
77 : {
78 0 : ProcessTextData();
79 0 : return nsMathMLContainerFrame::ChildListChanged(aModType);
80 : }
81 :
82 : protected:
83 0 : explicit nsMathMLmoFrame(nsStyleContext* aContext) :
84 0 : nsMathMLTokenFrame(aContext, kClassID), mFlags(0), mMinSize(0), mMaxSize(0) {}
85 : virtual ~nsMathMLmoFrame();
86 :
87 : nsMathMLChar mMathMLChar; // Here is the MathMLChar that will deal with the operator.
88 : nsOperatorFlags mFlags;
89 : float mMinSize;
90 : float mMaxSize;
91 :
92 : bool UseMathMLChar();
93 :
94 : // overload the base method so that we can setup our nsMathMLChar
95 : void ProcessTextData();
96 :
97 : // helper to get our 'form' and lookup in the Operator Dictionary to fetch
98 : // our default data that may come from there, and to complete the setup
99 : // using attributes that we may have
100 : void
101 : ProcessOperatorData();
102 :
103 : // helper to double check thar our char should be rendered as a selected char
104 : bool
105 : IsFrameInSelection(nsIFrame* aFrame);
106 : };
107 :
108 : #endif /* nsMathMLmoFrame_h___ */
|