bug 523370 - fixing bogus OOM with empty double free lists. r=dmandelin
[mozilla-central.git] / layout / mathml / nsMathMLmfracFrame.h
blobd245f2fe5be9a3eac623e073c7f11c1b74bad66b
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is Mozilla MathML Project.
17 * The Initial Developer of the Original Code is
18 * The University Of Queensland.
19 * Portions created by the Initial Developer are Copyright (C) 1999
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * Roger B. Sidje <rbs@maths.uq.edu.au>
24 * David J. Fiddes <D.J.Fiddes@hw.ac.uk>
25 * Shyjan Mahamud <mahamud@cs.cmu.edu>
27 * Alternatively, the contents of this file may be used under the terms of
28 * either of the GNU General Public License Version 2 or later (the "GPL"),
29 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
39 * ***** END LICENSE BLOCK ***** */
41 #ifndef nsMathMLmfracFrame_h___
42 #define nsMathMLmfracFrame_h___
44 #include "nsCOMPtr.h"
45 #include "nsMathMLContainerFrame.h"
48 // <mfrac> -- form a fraction from two subexpressions
52 The MathML REC describes:
54 The <mfrac> element is used for fractions. It can also be used to mark up
55 fraction-like objects such as binomial coefficients and Legendre symbols.
56 The syntax for <mfrac> is:
57 <mfrac> numerator denominator </mfrac>
59 Attributes of <mfrac>:
60 Name values default
61 linethickness number [ v-unit ] | thin | medium | thick 1
63 E.g.,
64 linethickness=2 actually means that linethickness=2*DEFAULT_THICKNESS
65 (DEFAULT_THICKNESS is not specified by MathML, see below.)
67 The linethickness attribute indicates the thickness of the horizontal
68 "fraction bar", or "rule", typically used to render fractions. A fraction
69 with linethickness="0" renders without the bar, and might be used within
70 binomial coefficients. A linethickness greater than one might be used with
71 nested fractions.
73 In general, the value of linethickness can be a number, as a multiplier
74 of the default thickness of the fraction bar (the default thickness is
75 not specified by MathML), or a number with a unit of vertical length (see
76 Section 2.3.3), or one of the keywords medium (same as 1), thin (thinner
77 than 1, otherwise up to the renderer), or thick (thicker than 1, otherwise
78 up to the renderer).
80 The <mfrac> element sets displaystyle to "false", or if it was already
81 false increments scriptlevel by 1, within numerator and denominator.
82 These attributes are inherited by every element from its rendering
83 environment, but can be set explicitly only on the <mstyle>
84 element.
87 class nsMathMLmfracFrame : public nsMathMLContainerFrame {
88 public:
89 NS_DECL_FRAMEARENA_HELPERS
91 friend nsIFrame* NS_NewMathMLmfracFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
93 virtual void
94 SetAdditionalStyleContext(PRInt32 aIndex,
95 nsStyleContext* aStyleContext);
96 virtual nsStyleContext*
97 GetAdditionalStyleContext(PRInt32 aIndex) const;
99 virtual eMathMLFrameType GetMathMLFrameType();
101 NS_IMETHOD
102 AttributeChanged(PRInt32 aNameSpaceID,
103 nsIAtom* aAttribute,
104 PRInt32 aModType);
106 NS_IMETHOD
107 Init(nsIContent* aContent,
108 nsIFrame* aParent,
109 nsIFrame* aPrevInFlow);
111 NS_IMETHOD
112 Reflow(nsPresContext* aPresContext,
113 nsHTMLReflowMetrics& aDesiredSize,
114 const nsHTMLReflowState& aReflowState,
115 nsReflowStatus& aStatus);
117 virtual nscoord
118 GetIntrinsicWidth(nsIRenderingContext* aRenderingContext);
120 virtual nsresult
121 Place(nsIRenderingContext& aRenderingContext,
122 PRBool aPlaceOrigin,
123 nsHTMLReflowMetrics& aDesiredSize);
125 NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
126 const nsRect& aDirtyRect,
127 const nsDisplayListSet& aLists);
129 NS_IMETHOD
130 TransmitAutomaticData();
132 NS_IMETHOD
133 UpdatePresentationDataFromChildAt(PRInt32 aFirstIndex,
134 PRInt32 aLastIndex,
135 PRUint32 aFlagsValues,
136 PRUint32 aFlagsToUpdate);
138 // override the base method so that we can deal with the fraction line
139 virtual nscoord
140 FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize);
142 // helper to translate the thickness attribute into a usable form
143 static nscoord
144 CalcLineThickness(nsPresContext* aPresContext,
145 nsStyleContext* aStyleContext,
146 nsString& aThicknessAttribute,
147 nscoord onePixel,
148 nscoord aDefaultRuleThickness);
150 protected:
151 nsMathMLmfracFrame(nsStyleContext* aContext) : nsMathMLContainerFrame(aContext) {}
152 virtual ~nsMathMLmfracFrame();
154 virtual PRIntn GetSkipSides() const { return 0; }
156 PRBool
157 IsBevelled();
159 nsRect mLineRect;
160 nsMathMLChar* mSlashChar;
163 #endif /* nsMathMLmfracFrame_h___ */