layout/mathml/nsMathMLmsqrtFrame.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/mathml/nsMathMLmsqrtFrame.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,66 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsMathMLmsqrtFrame.h"
    1.10 +#include "mozilla/gfx/2D.h"
    1.11 +
    1.12 +//
    1.13 +// <msqrt> -- form a radical - implementation
    1.14 +//
    1.15 +
    1.16 +//NOTE:
    1.17 +//  The code assumes that TeX fonts are picked.
    1.18 +//  There is no fall-back to draw the branches of the sqrt explicitly
    1.19 +//  in the case where TeX fonts are not there. In general, there are no
    1.20 +//  fall-back(s) in MathML when some (freely-downloadable) fonts are missing.
    1.21 +//  Otherwise, this will add much work and unnecessary complexity to the core
    1.22 +//  MathML  engine. Assuming that authors have the free fonts is part of the
    1.23 +//  deal. We are not responsible for cases of misconfigurations out there.
    1.24 +
    1.25 +nsIFrame*
    1.26 +NS_NewMathMLmsqrtFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
    1.27 +{
    1.28 +  return new (aPresShell) nsMathMLmsqrtFrame(aContext);
    1.29 +}
    1.30 +
    1.31 +NS_IMPL_FRAMEARENA_HELPERS(nsMathMLmsqrtFrame)
    1.32 +
    1.33 +nsMathMLmsqrtFrame::nsMathMLmsqrtFrame(nsStyleContext* aContext) :
    1.34 +  nsMathMLmencloseFrame(aContext)
    1.35 +{
    1.36 +}
    1.37 +
    1.38 +nsMathMLmsqrtFrame::~nsMathMLmsqrtFrame()
    1.39 +{
    1.40 +}
    1.41 +
    1.42 +void
    1.43 +nsMathMLmsqrtFrame::Init(nsIContent*      aContent,
    1.44 +                         nsIFrame*        aParent,
    1.45 +                         nsIFrame*        aPrevInFlow)
    1.46 +{
    1.47 +  nsMathMLContainerFrame::Init(aContent, aParent, aPrevInFlow);
    1.48 +  AllocateMathMLChar(NOTATION_RADICAL);
    1.49 +  mNotationsToDraw |= NOTATION_RADICAL;
    1.50 +}
    1.51 +
    1.52 +NS_IMETHODIMP
    1.53 +nsMathMLmsqrtFrame::InheritAutomaticData(nsIFrame* aParent)
    1.54 +{
    1.55 +  nsMathMLContainerFrame::InheritAutomaticData(aParent);
    1.56 +
    1.57 +  mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
    1.58 +
    1.59 +  return NS_OK;
    1.60 +}
    1.61 +
    1.62 +nsresult
    1.63 +nsMathMLmsqrtFrame::AttributeChanged(int32_t         aNameSpaceID,
    1.64 +                                     nsIAtom*        aAttribute,
    1.65 +                                     int32_t         aModType)
    1.66 +{
    1.67 +  return nsMathMLContainerFrame::
    1.68 +    AttributeChanged(aNameSpaceID, aAttribute, aModType);
    1.69 +}

mercurial