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: #ifndef nsMathMLmfencedFrame_h michael@0: #define nsMathMLmfencedFrame_h michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsMathMLContainerFrame.h" michael@0: michael@0: // michael@0: // -- surround content with a pair of fences michael@0: // michael@0: michael@0: class nsMathMLmfencedFrame : public nsMathMLContainerFrame { michael@0: public: michael@0: NS_DECL_FRAMEARENA_HELPERS michael@0: michael@0: friend nsIFrame* NS_NewMathMLmfencedFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); 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: NS_IMETHOD michael@0: InheritAutomaticData(nsIFrame* aParent) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult michael@0: SetInitialChildList(ChildListID aListID, michael@0: nsFrameList& aChildList) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult michael@0: Reflow(nsPresContext* aPresContext, michael@0: nsHTMLReflowMetrics& aDesiredSize, michael@0: const nsHTMLReflowState& aReflowState, michael@0: nsReflowStatus& aStatus) 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: virtual void michael@0: GetIntrinsicWidthMetrics(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: // override the base method because we must keep separators in sync michael@0: virtual nsresult michael@0: ChildListChanged(int32_t aModType) MOZ_OVERRIDE; michael@0: michael@0: // override the base method so that we can deal with fences and separators michael@0: virtual nscoord michael@0: FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE; michael@0: michael@0: // helper routines to format the MathMLChars involved here michael@0: static nsresult michael@0: ReflowChar(nsPresContext* aPresContext, michael@0: nsRenderingContext& aRenderingContext, michael@0: nsMathMLChar* aMathMLChar, michael@0: nsOperatorFlags aForm, michael@0: int32_t aScriptLevel, michael@0: nscoord axisHeight, michael@0: nscoord leading, michael@0: nscoord em, michael@0: nsBoundingMetrics& aContainerSize, michael@0: nscoord& aAscent, michael@0: nscoord& aDescent, michael@0: bool aRTL); michael@0: michael@0: static void michael@0: PlaceChar(nsMathMLChar* aMathMLChar, michael@0: nscoord aDesiredSize, michael@0: nsBoundingMetrics& bm, michael@0: nscoord& dx); michael@0: michael@0: virtual bool michael@0: IsMrowLike() MOZ_OVERRIDE michael@0: { michael@0: // Always treated as an mrow with > 1 child as michael@0: // % michael@0: // renders equivalently to michael@0: // ( % ) michael@0: // This also holds with multiple children. (MathML3 3.3.8.1) michael@0: return true; michael@0: } michael@0: michael@0: protected: michael@0: nsMathMLmfencedFrame(nsStyleContext* aContext) : nsMathMLContainerFrame(aContext) {} michael@0: virtual ~nsMathMLmfencedFrame(); michael@0: michael@0: nsMathMLChar* mOpenChar; michael@0: nsMathMLChar* mCloseChar; michael@0: nsMathMLChar* mSeparatorsChar; michael@0: int32_t mSeparatorsCount; michael@0: michael@0: // clean up michael@0: void michael@0: RemoveFencesAndSeparators(); michael@0: michael@0: // add fences and separators when all child frames are known michael@0: void michael@0: CreateFencesAndSeparators(nsPresContext* aPresContext); michael@0: }; michael@0: michael@0: #endif /* nsMathMLmfencedFrame_h */