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