LCOV - code coverage report
Current view: top level - layout/mathml - nsMathMLmfracFrame.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 5 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef nsMathMLmfracFrame_h___
       7             : #define nsMathMLmfracFrame_h___
       8             : 
       9             : #include "mozilla/Attributes.h"
      10             : #include "nsMathMLContainerFrame.h"
      11             : 
      12             : //
      13             : // <mfrac> -- form a fraction from two subexpressions
      14             : //
      15             : 
      16             : /*
      17             : The MathML REC describes:
      18             : 
      19             : The <mfrac> element is used for fractions. It can also be used to mark up
      20             : fraction-like objects such as binomial coefficients and Legendre symbols.
      21             : The syntax for <mfrac> is:
      22             :   <mfrac> numerator denominator </mfrac>
      23             : 
      24             : Attributes of <mfrac>:
      25             :      Name                      values                     default
      26             :   linethickness  number [ v-unit ] | thin | medium | thick  1
      27             : 
      28             : E.g.,
      29             : linethickness=2 actually means that linethickness=2*DEFAULT_THICKNESS
      30             : (DEFAULT_THICKNESS is not specified by MathML, see below.)
      31             : 
      32             : The linethickness attribute indicates the thickness of the horizontal
      33             : "fraction bar", or "rule", typically used to render fractions. A fraction
      34             : with linethickness="0" renders without the bar, and might be used within
      35             : binomial coefficients. A linethickness greater than one might be used with
      36             : nested fractions.
      37             : 
      38             : In general, the value of linethickness can be a number, as a multiplier
      39             : of the default thickness of the fraction bar (the default thickness is
      40             : not specified by MathML), or a number with a unit of vertical length (see
      41             : Section 2.3.3), or one of the keywords medium (same as 1), thin (thinner
      42             : than 1, otherwise up to the renderer), or thick (thicker than 1, otherwise
      43             : up to the renderer).
      44             : 
      45             : The <mfrac> element sets displaystyle to "false", or if it was already
      46             : false increments scriptlevel by 1, within numerator and denominator.
      47             : These attributes are inherited by every element from its rendering
      48             : environment, but can be set explicitly only on the <mstyle>
      49             : element.
      50             : */
      51             : 
      52             : class nsMathMLmfracFrame : public nsMathMLContainerFrame {
      53             : public:
      54           0 :   NS_DECL_FRAMEARENA_HELPERS(nsMathMLmfracFrame)
      55             : 
      56             :   friend nsIFrame* NS_NewMathMLmfracFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
      57             : 
      58             :   virtual eMathMLFrameType GetMathMLFrameType() override;
      59             : 
      60             :   virtual nsresult
      61             :   MeasureForWidth(DrawTarget* aDrawTarget,
      62             :                   ReflowOutput& aDesiredSize) override;
      63             : 
      64             :   virtual nsresult
      65             :   Place(DrawTarget*          aDrawTarget,
      66             :         bool                 aPlaceOrigin,
      67             :         ReflowOutput& aDesiredSize) override;
      68             : 
      69             :   virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
      70             :                                 const nsRect&           aDirtyRect,
      71             :                                 const nsDisplayListSet& aLists) override;
      72             : 
      73             :   virtual nsresult
      74             :   AttributeChanged(int32_t  aNameSpaceID,
      75             :                    nsIAtom* aAttribute,
      76             :                    int32_t  aModType) override;
      77             : 
      78             :   NS_IMETHOD
      79             :   TransmitAutomaticData() override;
      80             : 
      81             :   // override the base method so that we can deal with the fraction line
      82             :   virtual nscoord
      83             :   FixInterFrameSpacing(ReflowOutput& aDesiredSize) override;
      84             : 
      85             :   // helper to translate the thickness attribute into a usable form
      86             :   static nscoord
      87             :   CalcLineThickness(nsPresContext*  aPresContext,
      88             :                     nsStyleContext*  aStyleContext,
      89             :                     nsString&        aThicknessAttribute,
      90             :                     nscoord          onePixel,
      91             :                     nscoord          aDefaultRuleThickness,
      92             :                     float            aFontSizeInflation);
      93             : 
      94             :   uint8_t
      95             :   ScriptIncrement(nsIFrame* aFrame) override;
      96             : 
      97             : protected:
      98           0 :   explicit nsMathMLmfracFrame(nsStyleContext* aContext)
      99           0 :     : nsMathMLContainerFrame(aContext, kClassID)
     100             :     , mLineRect()
     101             :     , mSlashChar(nullptr)
     102             :     , mLineThickness(0)
     103           0 :     , mIsBevelled(false)
     104           0 :   {}
     105             :   virtual ~nsMathMLmfracFrame();
     106             : 
     107             :   nsresult PlaceInternal(DrawTarget*          aDrawTarget,
     108             :                          bool                 aPlaceOrigin,
     109             :                          ReflowOutput& aDesiredSize,
     110             :                          bool                 aWidthOnly);
     111             : 
     112             :   // Display a slash
     113             :   void DisplaySlash(nsDisplayListBuilder* aBuilder,
     114             :                     nsIFrame* aFrame, const nsRect& aRect,
     115             :                     nscoord aThickness,
     116             :                     const nsDisplayListSet& aLists);
     117             : 
     118             :   nsRect        mLineRect;
     119             :   nsMathMLChar* mSlashChar;
     120             :   nscoord       mLineThickness;
     121             :   bool          mIsBevelled;
     122             : };
     123             : 
     124             : #endif /* nsMathMLmfracFrame_h___ */

Generated by: LCOV version 1.13