michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsMathMLmsqrtFrame.h" michael@0: #include "mozilla/gfx/2D.h" michael@0: michael@0: // michael@0: // -- form a radical - implementation michael@0: // michael@0: michael@0: //NOTE: michael@0: // The code assumes that TeX fonts are picked. michael@0: // There is no fall-back to draw the branches of the sqrt explicitly michael@0: // in the case where TeX fonts are not there. In general, there are no michael@0: // fall-back(s) in MathML when some (freely-downloadable) fonts are missing. michael@0: // Otherwise, this will add much work and unnecessary complexity to the core michael@0: // MathML engine. Assuming that authors have the free fonts is part of the michael@0: // deal. We are not responsible for cases of misconfigurations out there. michael@0: michael@0: nsIFrame* michael@0: NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) michael@0: { michael@0: return new (aPresShell) nsMathMLmsqrtFrame(aContext); michael@0: } michael@0: michael@0: NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmsqrtFrame) michael@0: michael@0: nsMathMLmsqrtFrame::nsMathMLmsqrtFrame(nsStyleContext* aContext) : michael@0: nsMathMLmencloseFrame(aContext) michael@0: { michael@0: } michael@0: michael@0: nsMathMLmsqrtFrame::~nsMathMLmsqrtFrame() michael@0: { michael@0: } michael@0: michael@0: void michael@0: nsMathMLmsqrtFrame::Init(nsIContent* aContent, michael@0: nsIFrame* aParent, michael@0: nsIFrame* aPrevInFlow) michael@0: { michael@0: nsMathMLContainerFrame::Init(aContent, aParent, aPrevInFlow); michael@0: AllocateMathMLChar(NOTATION_RADICAL); michael@0: mNotationsToDraw |= NOTATION_RADICAL; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsMathMLmsqrtFrame::InheritAutomaticData(nsIFrame* aParent) michael@0: { michael@0: nsMathMLContainerFrame::InheritAutomaticData(aParent); michael@0: michael@0: mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY; michael@0: michael@0: return NS_OK; michael@0: } michael@0: michael@0: nsresult michael@0: nsMathMLmsqrtFrame::AttributeChanged(int32_t aNameSpaceID, michael@0: nsIAtom* aAttribute, michael@0: int32_t aModType) michael@0: { michael@0: return nsMathMLContainerFrame:: michael@0: AttributeChanged(aNameSpaceID, aAttribute, aModType); michael@0: }