layout/mathml/nsMathMLmencloseFrame.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/mathml/nsMathMLmencloseFrame.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,124 @@
     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 +
    1.10 +#ifndef nsMathMLmencloseFrame_h___
    1.11 +#define nsMathMLmencloseFrame_h___
    1.12 +
    1.13 +#include "mozilla/Attributes.h"
    1.14 +#include "nsMathMLContainerFrame.h"
    1.15 +
    1.16 +//
    1.17 +// <menclose> -- enclose content with a stretching symbol such
    1.18 +// as a long division sign.
    1.19 +//
    1.20 +
    1.21 +/*
    1.22 +  The MathML REC describes:
    1.23 +
    1.24 +  The menclose element renders its content inside the enclosing notation
    1.25 +  specified by its notation attribute. menclose accepts any number of arguments;
    1.26 +  if this number is not 1, its contents are treated as a single "inferred mrow"
    1.27 +  containing its arguments, as described in Section 3.1.3 Required Arguments. 
    1.28 +*/
    1.29 +
    1.30 +enum nsMencloseNotation
    1.31 +  {
    1.32 +    NOTATION_LONGDIV = 0x1,
    1.33 +    NOTATION_RADICAL = 0x2,
    1.34 +    NOTATION_ROUNDEDBOX = 0x4,
    1.35 +    NOTATION_CIRCLE = 0x8,
    1.36 +    NOTATION_LEFT = 0x10,
    1.37 +    NOTATION_RIGHT = 0x20,
    1.38 +    NOTATION_TOP = 0x40,
    1.39 +    NOTATION_BOTTOM = 0x80,
    1.40 +    NOTATION_UPDIAGONALSTRIKE = 0x100,
    1.41 +    NOTATION_DOWNDIAGONALSTRIKE = 0x200,
    1.42 +    NOTATION_VERTICALSTRIKE = 0x400,
    1.43 +    NOTATION_HORIZONTALSTRIKE = 0x800,
    1.44 +    NOTATION_UPDIAGONALARROW = 0x1000
    1.45 +  };
    1.46 +
    1.47 +class nsMathMLmencloseFrame : public nsMathMLContainerFrame {
    1.48 +public:
    1.49 +  NS_DECL_FRAMEARENA_HELPERS
    1.50 +
    1.51 +  friend nsIFrame* NS_NewMathMLmencloseFrame(nsIPresShell*   aPresShell,
    1.52 +                                             nsStyleContext* aContext);
    1.53 +  
    1.54 +  virtual nsresult
    1.55 +  Place(nsRenderingContext& aRenderingContext,
    1.56 +        bool                 aPlaceOrigin,
    1.57 +        nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE;
    1.58 +  
    1.59 +  virtual nsresult
    1.60 +  MeasureForWidth(nsRenderingContext& aRenderingContext,
    1.61 +                  nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE;
    1.62 +  
    1.63 +  virtual nsresult
    1.64 +  AttributeChanged(int32_t         aNameSpaceID,
    1.65 +                   nsIAtom*        aAttribute,
    1.66 +                   int32_t         aModType) MOZ_OVERRIDE;
    1.67 +  
    1.68 +  virtual void
    1.69 +  SetAdditionalStyleContext(int32_t          aIndex, 
    1.70 +                            nsStyleContext*  aStyleContext) MOZ_OVERRIDE;
    1.71 +  virtual nsStyleContext*
    1.72 +  GetAdditionalStyleContext(int32_t aIndex) const MOZ_OVERRIDE;
    1.73 +
    1.74 +  virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
    1.75 +                                const nsRect&           aDirtyRect,
    1.76 +                                const nsDisplayListSet& aLists) MOZ_OVERRIDE;
    1.77 +
    1.78 +  NS_IMETHOD
    1.79 +  InheritAutomaticData(nsIFrame* aParent) MOZ_OVERRIDE;
    1.80 +
    1.81 +  NS_IMETHOD
    1.82 +  TransmitAutomaticData() MOZ_OVERRIDE;
    1.83 +
    1.84 +  virtual nscoord
    1.85 +  FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE;
    1.86 +
    1.87 +  bool
    1.88 +  IsMrowLike() MOZ_OVERRIDE {
    1.89 +    return mFrames.FirstChild() != mFrames.LastChild() ||
    1.90 +           !mFrames.FirstChild();
    1.91 +  }
    1.92 +
    1.93 +protected:
    1.94 +  nsMathMLmencloseFrame(nsStyleContext* aContext);
    1.95 +  virtual ~nsMathMLmencloseFrame();
    1.96 +
    1.97 +  nsresult PlaceInternal(nsRenderingContext& aRenderingContext,
    1.98 +                         bool                 aPlaceOrigin,
    1.99 +                         nsHTMLReflowMetrics& aDesiredSize,
   1.100 +                         bool                 aWidthOnly);
   1.101 +  
   1.102 +  // functions to parse the "notation" attribute.
   1.103 +  nsresult AddNotation(const nsAString& aNotation);
   1.104 +  void InitNotations();
   1.105 +
   1.106 +  // Description of the notations to draw
   1.107 +  uint32_t mNotationsToDraw;
   1.108 +  bool IsToDraw(nsMencloseNotation mask)
   1.109 +  {
   1.110 +    return mask & mNotationsToDraw;
   1.111 +  }
   1.112 +
   1.113 +  nscoord mRuleThickness;
   1.114 +  nsTArray<nsMathMLChar> mMathMLChar;
   1.115 +  int8_t mLongDivCharIndex, mRadicalCharIndex;
   1.116 +  nscoord mContentWidth;
   1.117 +  nsresult AllocateMathMLChar(nsMencloseNotation mask);
   1.118 +
   1.119 +  // Display a frame of the specified type.
   1.120 +  // @param aType Type of frame to display
   1.121 +  void DisplayNotation(nsDisplayListBuilder* aBuilder,
   1.122 +                       nsIFrame* aFrame, const nsRect& aRect,
   1.123 +                       const nsDisplayListSet& aLists,
   1.124 +                       nscoord aThickness, nsMencloseNotation aType);
   1.125 +};
   1.126 +
   1.127 +#endif /* nsMathMLmencloseFrame_h___ */

mercurial