michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: #ifndef nsMathMLmencloseFrame_h___ michael@0: #define nsMathMLmencloseFrame_h___ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsMathMLContainerFrame.h" michael@0: michael@0: // michael@0: // -- enclose content with a stretching symbol such michael@0: // as a long division sign. michael@0: // michael@0: michael@0: /* michael@0: The MathML REC describes: michael@0: michael@0: The menclose element renders its content inside the enclosing notation michael@0: specified by its notation attribute. menclose accepts any number of arguments; michael@0: if this number is not 1, its contents are treated as a single "inferred mrow" michael@0: containing its arguments, as described in Section 3.1.3 Required Arguments. michael@0: */ michael@0: michael@0: enum nsMencloseNotation michael@0: { michael@0: NOTATION_LONGDIV = 0x1, michael@0: NOTATION_RADICAL = 0x2, michael@0: NOTATION_ROUNDEDBOX = 0x4, michael@0: NOTATION_CIRCLE = 0x8, michael@0: NOTATION_LEFT = 0x10, michael@0: NOTATION_RIGHT = 0x20, michael@0: NOTATION_TOP = 0x40, michael@0: NOTATION_BOTTOM = 0x80, michael@0: NOTATION_UPDIAGONALSTRIKE = 0x100, michael@0: NOTATION_DOWNDIAGONALSTRIKE = 0x200, michael@0: NOTATION_VERTICALSTRIKE = 0x400, michael@0: NOTATION_HORIZONTALSTRIKE = 0x800, michael@0: NOTATION_UPDIAGONALARROW = 0x1000 michael@0: }; michael@0: michael@0: class nsMathMLmencloseFrame : public nsMathMLContainerFrame { michael@0: public: michael@0: NS_DECL_FRAMEARENA_HELPERS michael@0: michael@0: friend nsIFrame* NS_NewMathMLmencloseFrame(nsIPresShell* aPresShell, michael@0: nsStyleContext* aContext); michael@0: michael@0: virtual nsresult michael@0: Place(nsRenderingContext& aRenderingContext, michael@0: bool aPlaceOrigin, michael@0: nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult michael@0: MeasureForWidth(nsRenderingContext& aRenderingContext, michael@0: nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult michael@0: AttributeChanged(int32_t aNameSpaceID, michael@0: nsIAtom* aAttribute, michael@0: int32_t aModType) MOZ_OVERRIDE; michael@0: michael@0: virtual void michael@0: SetAdditionalStyleContext(int32_t aIndex, michael@0: nsStyleContext* aStyleContext) MOZ_OVERRIDE; michael@0: virtual nsStyleContext* michael@0: GetAdditionalStyleContext(int32_t aIndex) const MOZ_OVERRIDE; michael@0: michael@0: virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, michael@0: const nsRect& aDirtyRect, michael@0: const nsDisplayListSet& aLists) MOZ_OVERRIDE; michael@0: michael@0: NS_IMETHOD michael@0: InheritAutomaticData(nsIFrame* aParent) MOZ_OVERRIDE; michael@0: michael@0: NS_IMETHOD michael@0: TransmitAutomaticData() MOZ_OVERRIDE; michael@0: michael@0: virtual nscoord michael@0: FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE; michael@0: michael@0: bool michael@0: IsMrowLike() MOZ_OVERRIDE { michael@0: return mFrames.FirstChild() != mFrames.LastChild() || michael@0: !mFrames.FirstChild(); michael@0: } michael@0: michael@0: protected: michael@0: nsMathMLmencloseFrame(nsStyleContext* aContext); michael@0: virtual ~nsMathMLmencloseFrame(); michael@0: michael@0: nsresult PlaceInternal(nsRenderingContext& aRenderingContext, michael@0: bool aPlaceOrigin, michael@0: nsHTMLReflowMetrics& aDesiredSize, michael@0: bool aWidthOnly); michael@0: michael@0: // functions to parse the "notation" attribute. michael@0: nsresult AddNotation(const nsAString& aNotation); michael@0: void InitNotations(); michael@0: michael@0: // Description of the notations to draw michael@0: uint32_t mNotationsToDraw; michael@0: bool IsToDraw(nsMencloseNotation mask) michael@0: { michael@0: return mask & mNotationsToDraw; michael@0: } michael@0: michael@0: nscoord mRuleThickness; michael@0: nsTArray mMathMLChar; michael@0: int8_t mLongDivCharIndex, mRadicalCharIndex; michael@0: nscoord mContentWidth; michael@0: nsresult AllocateMathMLChar(nsMencloseNotation mask); michael@0: michael@0: // Display a frame of the specified type. michael@0: // @param aType Type of frame to display michael@0: void DisplayNotation(nsDisplayListBuilder* aBuilder, michael@0: nsIFrame* aFrame, const nsRect& aRect, michael@0: const nsDisplayListSet& aLists, michael@0: nscoord aThickness, nsMencloseNotation aType); michael@0: }; michael@0: michael@0: #endif /* nsMathMLmencloseFrame_h___ */