Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsMathMLmsqrtFrame.h" |
michael@0 | 7 | #include "mozilla/gfx/2D.h" |
michael@0 | 8 | |
michael@0 | 9 | // |
michael@0 | 10 | // <msqrt> -- form a radical - implementation |
michael@0 | 11 | // |
michael@0 | 12 | |
michael@0 | 13 | //NOTE: |
michael@0 | 14 | // The code assumes that TeX fonts are picked. |
michael@0 | 15 | // There is no fall-back to draw the branches of the sqrt explicitly |
michael@0 | 16 | // in the case where TeX fonts are not there. In general, there are no |
michael@0 | 17 | // fall-back(s) in MathML when some (freely-downloadable) fonts are missing. |
michael@0 | 18 | // Otherwise, this will add much work and unnecessary complexity to the core |
michael@0 | 19 | // MathML engine. Assuming that authors have the free fonts is part of the |
michael@0 | 20 | // deal. We are not responsible for cases of misconfigurations out there. |
michael@0 | 21 | |
michael@0 | 22 | nsIFrame* |
michael@0 | 23 | NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) |
michael@0 | 24 | { |
michael@0 | 25 | return new (aPresShell) nsMathMLmsqrtFrame(aContext); |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmsqrtFrame) |
michael@0 | 29 | |
michael@0 | 30 | nsMathMLmsqrtFrame::nsMathMLmsqrtFrame(nsStyleContext* aContext) : |
michael@0 | 31 | nsMathMLmencloseFrame(aContext) |
michael@0 | 32 | { |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | nsMathMLmsqrtFrame::~nsMathMLmsqrtFrame() |
michael@0 | 36 | { |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | void |
michael@0 | 40 | nsMathMLmsqrtFrame::Init(nsIContent* aContent, |
michael@0 | 41 | nsIFrame* aParent, |
michael@0 | 42 | nsIFrame* aPrevInFlow) |
michael@0 | 43 | { |
michael@0 | 44 | nsMathMLContainerFrame::Init(aContent, aParent, aPrevInFlow); |
michael@0 | 45 | AllocateMathMLChar(NOTATION_RADICAL); |
michael@0 | 46 | mNotationsToDraw |= NOTATION_RADICAL; |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | NS_IMETHODIMP |
michael@0 | 50 | nsMathMLmsqrtFrame::InheritAutomaticData(nsIFrame* aParent) |
michael@0 | 51 | { |
michael@0 | 52 | nsMathMLContainerFrame::InheritAutomaticData(aParent); |
michael@0 | 53 | |
michael@0 | 54 | mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY; |
michael@0 | 55 | |
michael@0 | 56 | return NS_OK; |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | nsresult |
michael@0 | 60 | nsMathMLmsqrtFrame::AttributeChanged(int32_t aNameSpaceID, |
michael@0 | 61 | nsIAtom* aAttribute, |
michael@0 | 62 | int32_t aModType) |
michael@0 | 63 | { |
michael@0 | 64 | return nsMathMLContainerFrame:: |
michael@0 | 65 | AttributeChanged(aNameSpaceID, aAttribute, aModType); |
michael@0 | 66 | } |