Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
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/. */
6 #include "nsMathMLmsqrtFrame.h"
7 #include "mozilla/gfx/2D.h"
9 //
10 // <msqrt> -- form a radical - implementation
11 //
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.
22 nsIFrame*
23 NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
24 {
25 return new (aPresShell) nsMathMLmsqrtFrame(aContext);
26 }
28 NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmsqrtFrame)
30 nsMathMLmsqrtFrame::nsMathMLmsqrtFrame(nsStyleContext* aContext) :
31 nsMathMLmencloseFrame(aContext)
32 {
33 }
35 nsMathMLmsqrtFrame::~nsMathMLmsqrtFrame()
36 {
37 }
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 }
49 NS_IMETHODIMP
50 nsMathMLmsqrtFrame::InheritAutomaticData(nsIFrame* aParent)
51 {
52 nsMathMLContainerFrame::InheritAutomaticData(aParent);
54 mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
56 return NS_OK;
57 }
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 }