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 nsMathMLContainerFrame_h___ michael@0: #define nsMathMLContainerFrame_h___ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsContainerFrame.h" michael@0: #include "nsBlockFrame.h" michael@0: #include "nsInlineFrame.h" michael@0: #include "nsMathMLOperators.h" michael@0: #include "nsMathMLFrame.h" michael@0: #include "mozilla/Likely.h" michael@0: michael@0: /* michael@0: * Base class for MathML container frames. It acts like an inferred michael@0: * mrow. By default, this frame uses its Reflow() method to lay its michael@0: * children horizontally and ensure that their baselines are aligned. michael@0: * The Reflow() method relies upon Place() to position children. michael@0: * By overloading Place() in derived classes, it is therefore possible michael@0: * to position children in various customized ways. michael@0: */ michael@0: michael@0: // Options for the preferred size at which to stretch our stretchy children michael@0: #define STRETCH_CONSIDER_ACTUAL_SIZE 0x00000001 // just use our current size michael@0: #define STRETCH_CONSIDER_EMBELLISHMENTS 0x00000002 // size calculations include embellishments michael@0: michael@0: class nsMathMLContainerFrame : public nsContainerFrame, michael@0: public nsMathMLFrame { michael@0: friend class nsMathMLmfencedFrame; michael@0: public: michael@0: nsMathMLContainerFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {} michael@0: michael@0: NS_DECL_QUERYFRAME_TARGET(nsMathMLContainerFrame) michael@0: NS_DECL_QUERYFRAME michael@0: NS_DECL_FRAMEARENA_HELPERS michael@0: michael@0: // -------------------------------------------------------------------------- michael@0: // Overloaded nsMathMLFrame methods -- see documentation in nsIMathMLFrame.h michael@0: michael@0: NS_IMETHOD michael@0: Stretch(nsRenderingContext& aRenderingContext, michael@0: nsStretchDirection aStretchDirection, michael@0: nsBoundingMetrics& aContainerSize, michael@0: nsHTMLReflowMetrics& aDesiredStretchSize) MOZ_OVERRIDE; michael@0: michael@0: NS_IMETHOD michael@0: UpdatePresentationDataFromChildAt(int32_t aFirstIndex, michael@0: int32_t aLastIndex, michael@0: uint32_t aFlagsValues, michael@0: uint32_t aFlagsToUpdate) MOZ_OVERRIDE michael@0: { michael@0: PropagatePresentationDataFromChildAt(this, aFirstIndex, aLastIndex, michael@0: aFlagsValues, aFlagsToUpdate); michael@0: return NS_OK; michael@0: } michael@0: michael@0: // helper to set the "increment script level" flag on the element belonging michael@0: // to a child frame given by aChildIndex. michael@0: // When this flag is set, the style system will increment the scriptlevel michael@0: // for the child element. This is needed for situations where the style system michael@0: // cannot itself determine the scriptlevel (mfrac, munder, mover, munderover). michael@0: // This should be called during reflow. We set the flag and if it changed, michael@0: // we request appropriate restyling and also queue a post-reflow callback michael@0: // to ensure that restyle and reflow happens immediately after the current michael@0: // reflow. michael@0: void michael@0: SetIncrementScriptLevel(int32_t aChildIndex, bool aIncrement); michael@0: michael@0: // -------------------------------------------------------------------------- michael@0: // Overloaded nsContainerFrame methods -- see documentation in nsIFrame.h michael@0: michael@0: virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE michael@0: { michael@0: return !(aFlags & nsIFrame::eLineParticipant) && michael@0: nsContainerFrame::IsFrameOfType(aFlags & michael@0: ~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace)); michael@0: } michael@0: michael@0: virtual nsresult michael@0: AppendFrames(ChildListID aListID, michael@0: nsFrameList& aFrameList) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult michael@0: InsertFrames(ChildListID aListID, michael@0: nsIFrame* aPrevFrame, michael@0: nsFrameList& aFrameList) MOZ_OVERRIDE; michael@0: michael@0: virtual nsresult michael@0: RemoveFrame(ChildListID aListID, michael@0: nsIFrame* aOldFrame) MOZ_OVERRIDE; michael@0: michael@0: /** michael@0: * Both GetMinWidth and GetPrefWidth use the intrinsic width metrics michael@0: * returned by GetIntrinsicMetrics, including ink overflow. michael@0: */ michael@0: virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; michael@0: virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; michael@0: michael@0: /** michael@0: * Return the intrinsic horizontal metrics of the frame's content area. michael@0: */ michael@0: virtual void michael@0: GetIntrinsicWidthMetrics(nsRenderingContext* aRenderingContext, michael@0: nsHTMLReflowMetrics& aDesiredSize); 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 nsresult michael@0: WillReflow(nsPresContext* aPresContext) MOZ_OVERRIDE michael@0: { michael@0: mPresentationData.flags &= ~NS_MATHML_ERROR; michael@0: return nsContainerFrame::WillReflow(aPresContext); michael@0: } michael@0: michael@0: virtual nsresult michael@0: DidReflow(nsPresContext* aPresContext, michael@0: const nsHTMLReflowState* aReflowState, michael@0: nsDidReflowStatus aStatus) MOZ_OVERRIDE michael@0: michael@0: { michael@0: mPresentationData.flags &= ~NS_MATHML_STRETCH_DONE; michael@0: return nsContainerFrame::DidReflow(aPresContext, aReflowState, aStatus); michael@0: } 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 bool UpdateOverflow() MOZ_OVERRIDE; michael@0: michael@0: // Notification when an attribute is changed. The MathML module uses the michael@0: // following paradigm: michael@0: // michael@0: // 1. If the MathML frame class doesn't have any cached automatic data that michael@0: // depends on the attribute: we just reflow (e.g., this happens with , michael@0: // , , etc). This is the default behavior implemented michael@0: // by this base class. michael@0: // michael@0: // 2. If the MathML frame class has cached automatic data that depends on michael@0: // the attribute: michael@0: // 2a. If the automatic data to update resides only within the descendants, michael@0: // we just re-layout them using ReLayoutChildren(this); michael@0: // (e.g., this happens with ). michael@0: // 2b. If the automatic data to update affects us in some way, we ask our parent michael@0: // to re-layout its children using ReLayoutChildren(mParent); michael@0: // Therefore, there is an overhead here in that our siblings are re-laid michael@0: // too (e.g., this happens with , , ). 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: // helper function to apply mirroring to a horizontal coordinate, if needed. michael@0: nscoord michael@0: MirrorIfRTL(nscoord aParentWidth, nscoord aChildWidth, nscoord aChildLeading) michael@0: { michael@0: return (StyleVisibility()->mDirection ? michael@0: aParentWidth - aChildWidth - aChildLeading : aChildLeading); michael@0: } michael@0: michael@0: // -------------------------------------------------------------------------- michael@0: // Additional methods michael@0: michael@0: protected: michael@0: /* Place : michael@0: * This method is used to measure or position child frames and other michael@0: * elements. It may be called any number of times with aPlaceOrigin michael@0: * false to measure, and the final call of the Reflow process before michael@0: * returning from Reflow() or Stretch() will have aPlaceOrigin true michael@0: * to position the elements. michael@0: * michael@0: * IMPORTANT: This method uses GetReflowAndBoundingMetricsFor() which must michael@0: * have been set up with SaveReflowAndBoundingMetricsFor(). michael@0: * michael@0: * The Place() method will use this information to compute the desired size michael@0: * of the frame. michael@0: * michael@0: * @param aPlaceOrigin [in] michael@0: * If aPlaceOrigin is false, compute your desired size using the michael@0: * information from GetReflowAndBoundingMetricsFor. However, child michael@0: * frames or other elements should not be repositioned. michael@0: * michael@0: * If aPlaceOrigin is true, reflow is finished. You should position michael@0: * all your children, and return your desired size. You should now michael@0: * use FinishReflowChild() on your children to complete post-reflow michael@0: * operations. michael@0: * michael@0: * @param aDesiredSize [out] parameter where you should return your desired michael@0: * size and your ascent/descent info. Compute your desired size using michael@0: * the information from GetReflowAndBoundingMetricsFor, and include michael@0: * any space you want for border/padding in the desired size you michael@0: * return. michael@0: */ michael@0: virtual nsresult michael@0: Place(nsRenderingContext& aRenderingContext, michael@0: bool aPlaceOrigin, michael@0: nsHTMLReflowMetrics& aDesiredSize); michael@0: michael@0: // MeasureForWidth: michael@0: // michael@0: // A method used by nsMathMLContainerFrame::GetIntrinsicWidth to get the michael@0: // width that a particular Place method desires. For most frames, this will michael@0: // just call the object's Place method. However and use michael@0: // nsMathMLContainerFrame::GetIntrinsicWidth to measure the child frames as michael@0: // if in an , and so their frames implement MeasureForWidth to use michael@0: // nsMathMLContainerFrame::Place. michael@0: virtual nsresult michael@0: MeasureForWidth(nsRenderingContext& aRenderingContext, michael@0: nsHTMLReflowMetrics& aDesiredSize); michael@0: michael@0: michael@0: // helper to re-sync the automatic data in our children and notify our parent to michael@0: // reflow us when changes (e.g., append/insert/remove) happen in our child list michael@0: virtual nsresult michael@0: ChildListChanged(int32_t aModType); michael@0: michael@0: // helper to get the preferred size that a container frame should use to fire michael@0: // the stretch on its stretchy child frames. michael@0: void michael@0: GetPreferredStretchSize(nsRenderingContext& aRenderingContext, michael@0: uint32_t aOptions, michael@0: nsStretchDirection aStretchDirection, michael@0: nsBoundingMetrics& aPreferredStretchSize); michael@0: michael@0: // helper used by mstyle, mphantom, mpadded and mrow in their implementation michael@0: // of TransmitAutomaticData() to determine whether they are space-like. michael@0: nsresult michael@0: TransmitAutomaticDataForMrowLikeElement(); michael@0: michael@0: public: michael@0: // error handlers to provide a visual feedback to the user when an error michael@0: // (typically invalid markup) was encountered during reflow. michael@0: nsresult michael@0: ReflowError(nsRenderingContext& aRenderingContext, michael@0: nsHTMLReflowMetrics& aDesiredSize); michael@0: /* michael@0: * Helper to call ReportErrorToConsole for parse errors involving michael@0: * attribute/value pairs. michael@0: * @param aAttribute The attribute for which the parse error occured. michael@0: * @param aValue The value for which the parse error occured. michael@0: */ michael@0: nsresult michael@0: ReportParseError(const char16_t* aAttribute, michael@0: const char16_t* aValue); michael@0: michael@0: /* michael@0: * Helper to call ReportErrorToConsole when certain tags michael@0: * have more than the expected amount of children. michael@0: */ michael@0: nsresult michael@0: ReportChildCountError(); michael@0: michael@0: /* michael@0: * Helper to call ReportErrorToConsole when certain tags have michael@0: * invalid child tags michael@0: * @param aChildTag The tag which is forbidden in this context michael@0: */ michael@0: nsresult michael@0: ReportInvalidChildError(nsIAtom* aChildTag); michael@0: michael@0: /* michael@0: * Helper to call ReportToConsole when an error occurs. michael@0: * @param aParams see nsContentUtils::ReportToConsole michael@0: */ michael@0: nsresult michael@0: ReportErrorToConsole(const char* aErrorMsgId, michael@0: const char16_t** aParams = nullptr, michael@0: uint32_t aParamCount = 0); michael@0: michael@0: // helper method to reflow a child frame. We are inline frames, and we don't michael@0: // know our positions until reflow is finished. That's why we ask the michael@0: // base method not to worry about our position. michael@0: nsresult michael@0: ReflowChild(nsIFrame* aKidFrame, michael@0: nsPresContext* aPresContext, michael@0: nsHTMLReflowMetrics& aDesiredSize, michael@0: const nsHTMLReflowState& aReflowState, michael@0: nsReflowStatus& aStatus); michael@0: michael@0: protected: michael@0: // helper to add the inter-spacing when is the immediate parent. michael@0: // Since we don't (yet) handle the root element ourselves, we need to michael@0: // take special care of the inter-frame spacing on elements for which michael@0: // is the direct xml parent. This function will be repeatedly called from michael@0: // left to right on the childframes of , and by so doing it will michael@0: // emulate the spacing that would have been done by a container. michael@0: // e.g., it fixes f q f I michael@0: virtual nscoord michael@0: FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize); michael@0: michael@0: // helper method to complete the post-reflow hook and ensure that embellished michael@0: // operators don't terminate their Reflow without receiving a Stretch command. michael@0: virtual nsresult michael@0: FinalizeReflow(nsRenderingContext& aRenderingContext, michael@0: nsHTMLReflowMetrics& aDesiredSize); michael@0: michael@0: // Record metrics of a child frame for recovery through the following method michael@0: static void michael@0: SaveReflowAndBoundingMetricsFor(nsIFrame* aFrame, michael@0: const nsHTMLReflowMetrics& aReflowMetrics, michael@0: const nsBoundingMetrics& aBoundingMetrics); michael@0: michael@0: // helper method to facilitate getting the reflow and bounding metrics of a michael@0: // child frame. The argument aMathMLFrameType, when non null, will return michael@0: // the 'type' of the frame, which is used to determine the inter-frame michael@0: // spacing. michael@0: // IMPORTANT: This function is only meant to be called in Place() methods as michael@0: // the information is available only when set up with the above method michael@0: // during Reflow/Stretch() and GetPrefWidth(). michael@0: static void michael@0: GetReflowAndBoundingMetricsFor(nsIFrame* aFrame, michael@0: nsHTMLReflowMetrics& aReflowMetrics, michael@0: nsBoundingMetrics& aBoundingMetrics, michael@0: eMathMLFrameType* aMathMLFrameType = nullptr); michael@0: michael@0: // helper method to clear metrics saved with michael@0: // SaveReflowAndBoundingMetricsFor() from all child frames. michael@0: void ClearSavedChildMetrics(); michael@0: michael@0: // helper to let the update of presentation data pass through michael@0: // a subtree that may contain non-MathML container frames michael@0: static void michael@0: PropagatePresentationDataFor(nsIFrame* aFrame, michael@0: uint32_t aFlagsValues, michael@0: uint32_t aFlagsToUpdate); michael@0: michael@0: public: michael@0: static void michael@0: PropagatePresentationDataFromChildAt(nsIFrame* aParentFrame, michael@0: int32_t aFirstChildIndex, michael@0: int32_t aLastChildIndex, michael@0: uint32_t aFlagsValues, michael@0: uint32_t aFlagsToUpdate); michael@0: michael@0: // Sets flags on aFrame and all descendant frames michael@0: static void michael@0: PropagateFrameFlagFor(nsIFrame* aFrame, michael@0: nsFrameState aFlags); michael@0: michael@0: // helper to let the rebuild of automatic data (presentation data michael@0: // and embellishement data) walk through a subtree that may contain michael@0: // non-MathML container frames. Note that this method re-builds the michael@0: // automatic data in the children -- not in aParentFrame itself (except michael@0: // for those particular operations that the parent frame may do in its michael@0: // TransmitAutomaticData()). The reason it works this way is because michael@0: // a container frame knows what it wants for its children, whereas children michael@0: // have no clue who their parent is. For example, it is who knows michael@0: // that its children have to be in scriptsizes, and has to transmit this michael@0: // information to them. Hence, when changes occur in a child frame, the child michael@0: // has to request the re-build from its parent. Unfortunately, the extra cost michael@0: // for this is that it will re-sync in the siblings of the child as well. michael@0: static void michael@0: RebuildAutomaticDataForChildren(nsIFrame* aParentFrame); michael@0: michael@0: // helper to blow away the automatic data cached in a frame's subtree and michael@0: // re-layout its subtree to reflect changes that may have happen. In the michael@0: // event where aParentFrame isn't a MathML frame, it will first walk up to michael@0: // the ancestor that is a MathML frame, and re-layout from there -- this is michael@0: // to guarantee that automatic data will be rebuilt properly. Note that this michael@0: // method re-builds the automatic data in the children -- not in the parent michael@0: // frame itself (except for those particular operations that the parent frame michael@0: // may do do its TransmitAutomaticData()). @see RebuildAutomaticDataForChildren michael@0: // michael@0: // aBits are the bits to pass to FrameNeedsReflow() when we call it. michael@0: static nsresult michael@0: ReLayoutChildren(nsIFrame* aParentFrame); michael@0: michael@0: protected: michael@0: // Helper method which positions child frames as an on given baseline michael@0: // y = aBaseline starting from x = aOffsetX, calling FinishReflowChild() michael@0: // on the frames. michael@0: void michael@0: PositionRowChildFrames(nscoord aOffsetX, nscoord aBaseline); michael@0: michael@0: // A variant on FinishAndStoreOverflow() that uses the union of child michael@0: // overflows, the frame bounds, and mBoundingMetrics to set and store the michael@0: // overflow. michael@0: void GatherAndStoreOverflow(nsHTMLReflowMetrics* aMetrics); michael@0: michael@0: /** michael@0: * Call DidReflow() if the NS_FRAME_IN_REFLOW frame bit is set on aFirst and michael@0: * all its next siblings up to, but not including, aStop. michael@0: * aStop == nullptr meaning all next siblings with the bit set. michael@0: * The method does nothing if aFirst == nullptr. michael@0: */ michael@0: static void DidReflowChildren(nsIFrame* aFirst, nsIFrame* aStop = nullptr); michael@0: michael@0: private: michael@0: class RowChildFrameIterator; michael@0: friend class RowChildFrameIterator; michael@0: }; michael@0: michael@0: michael@0: // -------------------------------------------------------------------------- michael@0: // Currently, to benefit from line-breaking inside the element, is michael@0: // simply mapping to nsBlockFrame or nsInlineFrame. michael@0: // A separate implemention needs to provide: michael@0: // 1) line-breaking michael@0: // 2) proper inter-frame spacing michael@0: // 3) firing of Stretch() (in which case FinalizeReflow() would have to be cleaned) michael@0: // Issues: If/when mathml becomes a pluggable component, the separation will be needed. michael@0: class nsMathMLmathBlockFrame : public nsBlockFrame { michael@0: public: michael@0: NS_DECL_QUERYFRAME_TARGET(nsMathMLmathBlockFrame) michael@0: NS_DECL_QUERYFRAME michael@0: NS_DECL_FRAMEARENA_HELPERS michael@0: michael@0: friend nsIFrame* NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell, michael@0: nsStyleContext* aContext, nsFrameState aFlags); michael@0: michael@0: // beware, mFrames is not set by nsBlockFrame michael@0: // cannot use mFrames{.FirstChild()|.etc} since the block code doesn't set mFrames michael@0: virtual nsresult michael@0: SetInitialChildList(ChildListID aListID, michael@0: nsFrameList& aChildList) MOZ_OVERRIDE michael@0: { michael@0: NS_ASSERTION(aListID == kPrincipalList, "unexpected frame list"); michael@0: nsresult rv = nsBlockFrame::SetInitialChildList(aListID, aChildList); michael@0: // re-resolve our subtree to set any mathml-expected data michael@0: nsMathMLContainerFrame::RebuildAutomaticDataForChildren(this); michael@0: return rv; michael@0: } michael@0: michael@0: virtual nsresult michael@0: AppendFrames(ChildListID aListID, michael@0: nsFrameList& aFrameList) MOZ_OVERRIDE michael@0: { michael@0: NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList, michael@0: "unexpected frame list"); michael@0: nsresult rv = nsBlockFrame::AppendFrames(aListID, aFrameList); michael@0: if (MOZ_LIKELY(aListID == kPrincipalList)) michael@0: nsMathMLContainerFrame::ReLayoutChildren(this); michael@0: return rv; michael@0: } michael@0: michael@0: virtual nsresult michael@0: InsertFrames(ChildListID aListID, michael@0: nsIFrame* aPrevFrame, michael@0: nsFrameList& aFrameList) MOZ_OVERRIDE michael@0: { michael@0: NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList, michael@0: "unexpected frame list"); michael@0: nsresult rv = nsBlockFrame::InsertFrames(aListID, aPrevFrame, aFrameList); michael@0: if (MOZ_LIKELY(aListID == kPrincipalList)) michael@0: nsMathMLContainerFrame::ReLayoutChildren(this); michael@0: return rv; michael@0: } michael@0: michael@0: virtual nsresult michael@0: RemoveFrame(ChildListID aListID, michael@0: nsIFrame* aOldFrame) MOZ_OVERRIDE michael@0: { michael@0: NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList, michael@0: "unexpected frame list"); michael@0: nsresult rv = nsBlockFrame::RemoveFrame(aListID, aOldFrame); michael@0: if (MOZ_LIKELY(aListID == kPrincipalList)) michael@0: nsMathMLContainerFrame::ReLayoutChildren(this); michael@0: return rv; michael@0: } michael@0: michael@0: virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE { michael@0: return nsBlockFrame::IsFrameOfType(aFlags & michael@0: ~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace)); michael@0: } michael@0: michael@0: // See nsIMathMLFrame.h michael@0: bool IsMrowLike() { michael@0: return mFrames.FirstChild() != mFrames.LastChild() || michael@0: !mFrames.FirstChild(); michael@0: } michael@0: michael@0: protected: michael@0: nsMathMLmathBlockFrame(nsStyleContext* aContext) : nsBlockFrame(aContext) { michael@0: // We should always have a float manager. Not that things can really try michael@0: // to float out of us anyway, but we need one for line layout. michael@0: AddStateBits(NS_BLOCK_FLOAT_MGR); michael@0: } michael@0: virtual ~nsMathMLmathBlockFrame() {} michael@0: }; michael@0: michael@0: // -------------- michael@0: michael@0: class nsMathMLmathInlineFrame : public nsInlineFrame, michael@0: public nsMathMLFrame { michael@0: public: michael@0: NS_DECL_QUERYFRAME_TARGET(nsMathMLmathInlineFrame) michael@0: NS_DECL_QUERYFRAME michael@0: NS_DECL_FRAMEARENA_HELPERS michael@0: michael@0: friend nsIFrame* NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); michael@0: michael@0: virtual nsresult michael@0: SetInitialChildList(ChildListID aListID, michael@0: nsFrameList& aChildList) MOZ_OVERRIDE michael@0: { michael@0: NS_ASSERTION(aListID == kPrincipalList, "unexpected frame list"); michael@0: nsresult rv = nsInlineFrame::SetInitialChildList(aListID, aChildList); michael@0: // re-resolve our subtree to set any mathml-expected data michael@0: nsMathMLContainerFrame::RebuildAutomaticDataForChildren(this); michael@0: return rv; michael@0: } michael@0: michael@0: virtual nsresult michael@0: AppendFrames(ChildListID aListID, michael@0: nsFrameList& aFrameList) MOZ_OVERRIDE michael@0: { michael@0: NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList, michael@0: "unexpected frame list"); michael@0: nsresult rv = nsInlineFrame::AppendFrames(aListID, aFrameList); michael@0: if (MOZ_LIKELY(aListID == kPrincipalList)) michael@0: nsMathMLContainerFrame::ReLayoutChildren(this); michael@0: return rv; michael@0: } michael@0: michael@0: virtual nsresult michael@0: InsertFrames(ChildListID aListID, michael@0: nsIFrame* aPrevFrame, michael@0: nsFrameList& aFrameList) MOZ_OVERRIDE michael@0: { michael@0: NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList, michael@0: "unexpected frame list"); michael@0: nsresult rv = nsInlineFrame::InsertFrames(aListID, aPrevFrame, aFrameList); michael@0: if (MOZ_LIKELY(aListID == kPrincipalList)) michael@0: nsMathMLContainerFrame::ReLayoutChildren(this); michael@0: return rv; michael@0: } michael@0: michael@0: virtual nsresult michael@0: RemoveFrame(ChildListID aListID, michael@0: nsIFrame* aOldFrame) MOZ_OVERRIDE michael@0: { michael@0: NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList, michael@0: "unexpected frame list"); michael@0: nsresult rv = nsInlineFrame::RemoveFrame(aListID, aOldFrame); michael@0: if (MOZ_LIKELY(aListID == kPrincipalList)) michael@0: nsMathMLContainerFrame::ReLayoutChildren(this); michael@0: return rv; michael@0: } michael@0: michael@0: virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE { michael@0: return nsInlineFrame::IsFrameOfType(aFlags & michael@0: ~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace)); michael@0: } 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: nsMathMLmathInlineFrame(nsStyleContext* aContext) : nsInlineFrame(aContext) {} michael@0: virtual ~nsMathMLmathInlineFrame() {} michael@0: }; michael@0: michael@0: #endif /* nsMathMLContainerFrame_h___ */