layout/mathml/nsMathMLmfencedFrame.h

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

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 #ifndef nsMathMLmfencedFrame_h
     7 #define nsMathMLmfencedFrame_h
     9 #include "mozilla/Attributes.h"
    10 #include "nsMathMLContainerFrame.h"
    12 //
    13 // <mfenced> -- surround content with a pair of fences
    14 //
    16 class nsMathMLmfencedFrame : public nsMathMLContainerFrame {
    17 public:
    18   NS_DECL_FRAMEARENA_HELPERS
    20   friend nsIFrame* NS_NewMathMLmfencedFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
    22   virtual void
    23   SetAdditionalStyleContext(int32_t          aIndex, 
    24                             nsStyleContext*  aStyleContext) MOZ_OVERRIDE;
    25   virtual nsStyleContext*
    26   GetAdditionalStyleContext(int32_t aIndex) const MOZ_OVERRIDE;
    28   NS_IMETHOD
    29   InheritAutomaticData(nsIFrame* aParent) MOZ_OVERRIDE;
    31   virtual nsresult
    32   SetInitialChildList(ChildListID     aListID,
    33                       nsFrameList&    aChildList) MOZ_OVERRIDE;
    35   virtual nsresult
    36   Reflow(nsPresContext*          aPresContext,
    37          nsHTMLReflowMetrics&     aDesiredSize,
    38          const nsHTMLReflowState& aReflowState,
    39          nsReflowStatus&          aStatus) MOZ_OVERRIDE;
    41   virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
    42                                 const nsRect&           aDirtyRect,
    43                                 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
    45   virtual void
    46   GetIntrinsicWidthMetrics(nsRenderingContext* aRenderingContext,
    47                            nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE;
    49   virtual nsresult
    50   AttributeChanged(int32_t         aNameSpaceID,
    51                    nsIAtom*        aAttribute,
    52                    int32_t         aModType) MOZ_OVERRIDE;
    54   // override the base method because we must keep separators in sync
    55   virtual nsresult
    56   ChildListChanged(int32_t aModType) MOZ_OVERRIDE;
    58   // override the base method so that we can deal with fences and separators
    59   virtual nscoord
    60   FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE;
    62   // helper routines to format the MathMLChars involved here
    63   static nsresult
    64   ReflowChar(nsPresContext*      aPresContext,
    65              nsRenderingContext& aRenderingContext,
    66              nsMathMLChar*        aMathMLChar,
    67              nsOperatorFlags      aForm,
    68              int32_t              aScriptLevel,
    69              nscoord              axisHeight,
    70              nscoord              leading,
    71              nscoord              em,
    72              nsBoundingMetrics&   aContainerSize,
    73              nscoord&             aAscent,
    74              nscoord&             aDescent,
    75              bool                 aRTL);
    77   static void
    78   PlaceChar(nsMathMLChar*      aMathMLChar,
    79             nscoord            aDesiredSize,
    80             nsBoundingMetrics& bm,
    81             nscoord&           dx);
    83   virtual bool
    84   IsMrowLike() MOZ_OVERRIDE
    85   {
    86     // Always treated as an mrow with > 1 child as
    87     // <mfenced> <mo>%</mo> </mfenced>
    88     // renders equivalently to
    89     // <mrow> <mo> ( </mo> <mo>%</mo> <mo> ) </mo> </mrow>
    90     // This also holds with multiple children.  (MathML3 3.3.8.1)
    91     return true;
    92   }
    94 protected:
    95   nsMathMLmfencedFrame(nsStyleContext* aContext) : nsMathMLContainerFrame(aContext) {}
    96   virtual ~nsMathMLmfencedFrame();
    98   nsMathMLChar* mOpenChar;
    99   nsMathMLChar* mCloseChar;
   100   nsMathMLChar* mSeparatorsChar;
   101   int32_t       mSeparatorsCount;
   103   // clean up
   104   void
   105   RemoveFencesAndSeparators();
   107   // add fences and separators when all child frames are known
   108   void
   109   CreateFencesAndSeparators(nsPresContext* aPresContext);
   110 };
   112 #endif /* nsMathMLmfencedFrame_h */

mercurial