|
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 #include "nsMathMLmsqrtFrame.h" |
|
7 #include "mozilla/gfx/2D.h" |
|
8 |
|
9 // |
|
10 // <msqrt> -- form a radical - implementation |
|
11 // |
|
12 |
|
13 //NOTE: |
|
14 // The code assumes that TeX fonts are picked. |
|
15 // There is no fall-back to draw the branches of the sqrt explicitly |
|
16 // in the case where TeX fonts are not there. In general, there are no |
|
17 // fall-back(s) in MathML when some (freely-downloadable) fonts are missing. |
|
18 // Otherwise, this will add much work and unnecessary complexity to the core |
|
19 // MathML engine. Assuming that authors have the free fonts is part of the |
|
20 // deal. We are not responsible for cases of misconfigurations out there. |
|
21 |
|
22 nsIFrame* |
|
23 NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) |
|
24 { |
|
25 return new (aPresShell) nsMathMLmsqrtFrame(aContext); |
|
26 } |
|
27 |
|
28 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmsqrtFrame) |
|
29 |
|
30 nsMathMLmsqrtFrame::nsMathMLmsqrtFrame(nsStyleContext* aContext) : |
|
31 nsMathMLmencloseFrame(aContext) |
|
32 { |
|
33 } |
|
34 |
|
35 nsMathMLmsqrtFrame::~nsMathMLmsqrtFrame() |
|
36 { |
|
37 } |
|
38 |
|
39 void |
|
40 nsMathMLmsqrtFrame::Init(nsIContent* aContent, |
|
41 nsIFrame* aParent, |
|
42 nsIFrame* aPrevInFlow) |
|
43 { |
|
44 nsMathMLContainerFrame::Init(aContent, aParent, aPrevInFlow); |
|
45 AllocateMathMLChar(NOTATION_RADICAL); |
|
46 mNotationsToDraw |= NOTATION_RADICAL; |
|
47 } |
|
48 |
|
49 NS_IMETHODIMP |
|
50 nsMathMLmsqrtFrame::InheritAutomaticData(nsIFrame* aParent) |
|
51 { |
|
52 nsMathMLContainerFrame::InheritAutomaticData(aParent); |
|
53 |
|
54 mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY; |
|
55 |
|
56 return NS_OK; |
|
57 } |
|
58 |
|
59 nsresult |
|
60 nsMathMLmsqrtFrame::AttributeChanged(int32_t aNameSpaceID, |
|
61 nsIAtom* aAttribute, |
|
62 int32_t aModType) |
|
63 { |
|
64 return nsMathMLContainerFrame:: |
|
65 AttributeChanged(aNameSpaceID, aAttribute, aModType); |
|
66 } |