LCOV - code coverage report
Current view: directory - layout/mathml - nsMathMLContainerFrame.h (source / functions) Found Hit Coverage
Test: app.info Lines: 73 0 0.0 %
Date: 2012-06-02 Functions: 25 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is Mozilla MathML Project.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * The University Of Queensland.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 1999
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Roger B. Sidje <rbs@maths.uq.edu.au>
      24                 :  *   David J. Fiddes <D.J.Fiddes@hw.ac.uk>
      25                 :  *   Shyjan Mahamud <mahamud@cs.cmu.edu> (added TeX rendering rules)
      26                 :  *   Karl Tomlinson <karlt+@karlt.net>, Mozilla Corporation
      27                 :  *   Frederic Wang <fred.wang@free.fr>
      28                 :  *
      29                 :  * Alternatively, the contents of this file may be used under the terms of
      30                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      31                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      32                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      33                 :  * of those above. If you wish to allow use of your version of this file only
      34                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      35                 :  * use your version of this file under the terms of the MPL, indicate your
      36                 :  * decision by deleting the provisions above and replace them with the notice
      37                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      38                 :  * the provisions above, a recipient may use your version of this file under
      39                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      40                 :  *
      41                 :  * ***** END LICENSE BLOCK ***** */
      42                 : 
      43                 : #ifndef nsMathMLContainerFrame_h___
      44                 : #define nsMathMLContainerFrame_h___
      45                 : 
      46                 : #include "nsCOMPtr.h"
      47                 : #include "nsContainerFrame.h"
      48                 : #include "nsBlockFrame.h"
      49                 : #include "nsInlineFrame.h"
      50                 : #include "nsMathMLAtoms.h"
      51                 : #include "nsMathMLOperators.h"
      52                 : #include "nsMathMLChar.h"
      53                 : #include "nsMathMLFrame.h"
      54                 : #include "nsMathMLParts.h"
      55                 : 
      56                 : /*
      57                 :  * Base class for MathML container frames. It acts like an inferred 
      58                 :  * mrow. By default, this frame uses its Reflow() method to lay its 
      59                 :  * children horizontally and ensure that their baselines are aligned.
      60                 :  * The Reflow() method relies upon Place() to position children.
      61                 :  * By overloading Place() in derived classes, it is therefore possible
      62                 :  * to position children in various customized ways.
      63                 :  */
      64                 : 
      65                 : // Options for the preferred size at which to stretch our stretchy children 
      66                 : #define STRETCH_CONSIDER_ACTUAL_SIZE    0x00000001 // just use our current size
      67                 : #define STRETCH_CONSIDER_EMBELLISHMENTS 0x00000002 // size calculations include embellishments
      68                 : 
      69                 : class nsMathMLContainerFrame : public nsContainerFrame,
      70               0 :                                public nsMathMLFrame {
      71                 :   friend class nsMathMLmfencedFrame;
      72                 : public:
      73               0 :   nsMathMLContainerFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
      74                 : 
      75                 :   NS_DECL_QUERYFRAME
      76                 :   NS_DECL_FRAMEARENA_HELPERS
      77                 : 
      78                 :   // --------------------------------------------------------------------------
      79                 :   // Overloaded nsMathMLFrame methods -- see documentation in nsIMathMLFrame.h
      80                 : 
      81                 :   NS_IMETHOD
      82                 :   Stretch(nsRenderingContext& aRenderingContext,
      83                 :           nsStretchDirection   aStretchDirection,
      84                 :           nsBoundingMetrics&   aContainerSize,
      85                 :           nsHTMLReflowMetrics& aDesiredStretchSize);
      86                 : 
      87                 :   NS_IMETHOD
      88               0 :   UpdatePresentationDataFromChildAt(PRInt32         aFirstIndex,
      89                 :                                     PRInt32         aLastIndex,
      90                 :                                     PRUint32        aFlagsValues,
      91                 :                                     PRUint32        aFlagsToUpdate)
      92                 :   {
      93                 :     PropagatePresentationDataFromChildAt(this, aFirstIndex, aLastIndex,
      94               0 :       aFlagsValues, aFlagsToUpdate);
      95               0 :     return NS_OK;
      96                 :   }
      97                 :   
      98                 :   // helper to set the "increment script level" flag on the element belonging
      99                 :   // to a child frame given by aChildIndex.
     100                 :   // When this flag is set, the style system will increment the scriptlevel
     101                 :   // for the child element. This is needed for situations where the style system
     102                 :   // cannot itself determine the scriptlevel (mfrac, munder, mover, munderover).
     103                 :   // This should be called during reflow. We set the flag and if it changed,
     104                 :   // we request appropriate restyling and also queue a post-reflow callback
     105                 :   // to ensure that restyle and reflow happens immediately after the current
     106                 :   // reflow.
     107                 :   void
     108                 :   SetIncrementScriptLevel(PRInt32 aChildIndex, bool aIncrement);
     109                 : 
     110                 :   // --------------------------------------------------------------------------
     111                 :   // Overloaded nsContainerFrame methods -- see documentation in nsIFrame.h
     112                 : 
     113               0 :   virtual bool IsFrameOfType(PRUint32 aFlags) const
     114                 :   {
     115               0 :     return !(aFlags & nsIFrame::eLineParticipant) &&
     116                 :       nsContainerFrame::IsFrameOfType(aFlags &
     117               0 :               ~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace));
     118                 :   }
     119                 : 
     120               0 :   virtual PRIntn GetSkipSides() const { return 0; }
     121                 : 
     122                 :   NS_IMETHOD
     123                 :   AppendFrames(ChildListID     aListID,
     124                 :                nsFrameList&    aFrameList);
     125                 : 
     126                 :   NS_IMETHOD
     127                 :   InsertFrames(ChildListID     aListID,
     128                 :                nsIFrame*       aPrevFrame,
     129                 :                nsFrameList&    aFrameList);
     130                 : 
     131                 :   NS_IMETHOD
     132                 :   RemoveFrame(ChildListID     aListID,
     133                 :               nsIFrame*       aOldFrame);
     134                 : 
     135                 :   /**
     136                 :    * Both GetMinWidth and GetPrefWidth return whatever
     137                 :    * GetIntrinsicWidth returns.
     138                 :    */
     139                 :   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
     140                 :   virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
     141                 : 
     142                 :   /**
     143                 :    * Return the intrinsic width of the frame's content area.
     144                 :    */
     145                 :   virtual nscoord GetIntrinsicWidth(nsRenderingContext *aRenderingContext);
     146                 : 
     147                 :   NS_IMETHOD
     148                 :   Reflow(nsPresContext*          aPresContext,
     149                 :          nsHTMLReflowMetrics&     aDesiredSize,
     150                 :          const nsHTMLReflowState& aReflowState,
     151                 :          nsReflowStatus&          aStatus);
     152                 : 
     153                 :   NS_IMETHOD
     154               0 :   WillReflow(nsPresContext* aPresContext)
     155                 :   {
     156               0 :     mPresentationData.flags &= ~NS_MATHML_ERROR;
     157               0 :     return nsContainerFrame::WillReflow(aPresContext);
     158                 :   }
     159                 : 
     160                 :   NS_IMETHOD
     161               0 :   DidReflow(nsPresContext*           aPresContext,
     162                 :             const nsHTMLReflowState*  aReflowState,
     163                 :             nsDidReflowStatus         aStatus)
     164                 : 
     165                 :   {
     166               0 :     mPresentationData.flags &= ~NS_MATHML_STRETCH_DONE;
     167               0 :     return nsContainerFrame::DidReflow(aPresContext, aReflowState, aStatus);
     168                 :   }
     169                 : 
     170                 :   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
     171                 :                               const nsRect&           aDirtyRect,
     172                 :                               const nsDisplayListSet& aLists);
     173                 : 
     174                 :   virtual bool UpdateOverflow();
     175                 : 
     176                 :   // Notification when an attribute is changed. The MathML module uses the
     177                 :   // following paradigm:
     178                 :   //
     179                 :   // 1. If the MathML frame class doesn't have any cached automatic data that
     180                 :   //    depends on the attribute: we just reflow (e.g., this happens with <msub>,
     181                 :   //    <msup>, <mmultiscripts>, etc). This is the default behavior implemented
     182                 :   //    by this base class.
     183                 :   //
     184                 :   // 2. If the MathML frame class has cached automatic data that depends on
     185                 :   //    the attribute:
     186                 :   //    2a. If the automatic data to update resides only within the descendants,
     187                 :   //        we just re-layout them using ReLayoutChildren(this);
     188                 :   //        (e.g., this happens with <ms>).
     189                 :   //    2b. If the automatic data to update affects us in some way, we ask our parent
     190                 :   //        to re-layout its children using ReLayoutChildren(mParent);
     191                 :   //        Therefore, there is an overhead here in that our siblings are re-laid
     192                 :   //        too (e.g., this happens with <mstyle>, <munder>, <mover>, <munderover>). 
     193                 :   NS_IMETHOD
     194                 :   AttributeChanged(PRInt32         aNameSpaceID,
     195                 :                    nsIAtom*        aAttribute,
     196                 :                    PRInt32         aModType);
     197                 : 
     198                 :   // helper function to apply mirroring to a horizontal coordinate, if needed.
     199                 :   nscoord
     200               0 :   MirrorIfRTL(nscoord aParentWidth, nscoord aChildWidth, nscoord aChildLeading)
     201                 :   {
     202                 :     return (NS_MATHML_IS_RTL(mPresentationData.flags) ?
     203               0 :             aParentWidth - aChildWidth - aChildLeading : aChildLeading);
     204                 :   }
     205                 : 
     206                 :   // --------------------------------------------------------------------------
     207                 :   // Additional methods 
     208                 : 
     209                 : protected:
     210                 :   /* Place :
     211                 :    * This method is used to measure or position child frames and other
     212                 :    * elements.  It may be called any number of times with aPlaceOrigin
     213                 :    * false to measure, and the final call of the Reflow process before
     214                 :    * returning from Reflow() or Stretch() will have aPlaceOrigin true
     215                 :    * to position the elements.
     216                 :    *
     217                 :    * IMPORTANT: This method uses GetReflowAndBoundingMetricsFor() which must
     218                 :    * have been set up with SaveReflowAndBoundingMetricsFor().
     219                 :    *
     220                 :    * The Place() method will use this information to compute the desired size
     221                 :    * of the frame.
     222                 :    *
     223                 :    * @param aPlaceOrigin [in]
     224                 :    *        If aPlaceOrigin is false, compute your desired size using the
     225                 :    *        information from GetReflowAndBoundingMetricsFor.  However, child
     226                 :    *        frames or other elements should not be repositioned.
     227                 :    *
     228                 :    *        If aPlaceOrigin is true, reflow is finished. You should position
     229                 :    *        all your children, and return your desired size. You should now
     230                 :    *        use FinishReflowChild() on your children to complete post-reflow
     231                 :    *        operations.
     232                 :    *
     233                 :    * @param aDesiredSize [out] parameter where you should return your desired
     234                 :    *        size and your ascent/descent info. Compute your desired size using
     235                 :    *        the information from GetReflowAndBoundingMetricsFor, and include
     236                 :    *        any space you want for border/padding in the desired size you
     237                 :    *        return.
     238                 :    */
     239                 :   virtual nsresult
     240                 :   Place(nsRenderingContext& aRenderingContext,
     241                 :         bool                 aPlaceOrigin,
     242                 :         nsHTMLReflowMetrics& aDesiredSize);
     243                 : 
     244                 :   // MeasureForWidth:
     245                 :   //
     246                 :   // A method used by nsMathMLContainerFrame::GetIntrinsicWidth to get the
     247                 :   // width that a particular Place method desires.  For most frames, this will
     248                 :   // just call the object's Place method.  However <msqrt> and <menclose> use
     249                 :   // nsMathMLContainerFrame::GetIntrinsicWidth to measure the child frames as
     250                 :   // if in an <mrow>, and so their frames implement MeasureForWidth to use
     251                 :   // nsMathMLContainerFrame::Place.
     252                 :   virtual nsresult
     253                 :   MeasureForWidth(nsRenderingContext& aRenderingContext,
     254                 :                   nsHTMLReflowMetrics& aDesiredSize);
     255                 : 
     256                 : 
     257                 :   // helper to re-sync the automatic data in our children and notify our parent to
     258                 :   // reflow us when changes (e.g., append/insert/remove) happen in our child list
     259                 :   virtual nsresult
     260                 :   ChildListChanged(PRInt32 aModType);
     261                 : 
     262                 :   // helper to get the preferred size that a container frame should use to fire
     263                 :   // the stretch on its stretchy child frames.
     264                 :   void
     265                 :   GetPreferredStretchSize(nsRenderingContext& aRenderingContext,
     266                 :                           PRUint32             aOptions,
     267                 :                           nsStretchDirection   aStretchDirection,
     268                 :                           nsBoundingMetrics&   aPreferredStretchSize);
     269                 : 
     270                 :   // helper used by mstyle, mphantom, mpadded and mrow in their implementation
     271                 :   // of TransmitAutomaticData() to determine whether they are space-like.
     272                 :   nsresult
     273                 :   TransmitAutomaticDataForMrowLikeElement();
     274                 : 
     275                 : public:
     276                 :   // error handlers to provide a visual feedback to the user when an error
     277                 :   // (typically invalid markup) was encountered during reflow.
     278                 :   nsresult
     279                 :   ReflowError(nsRenderingContext& aRenderingContext,
     280                 :               nsHTMLReflowMetrics& aDesiredSize);
     281                 : 
     282                 :   // helper method to reflow a child frame. We are inline frames, and we don't
     283                 :   // know our positions until reflow is finished. That's why we ask the
     284                 :   // base method not to worry about our position.
     285                 :   nsresult 
     286                 :   ReflowChild(nsIFrame*                aKidFrame,
     287                 :               nsPresContext*          aPresContext,
     288                 :               nsHTMLReflowMetrics&     aDesiredSize,
     289                 :               const nsHTMLReflowState& aReflowState,
     290                 :               nsReflowStatus&          aStatus);
     291                 : 
     292                 : protected:
     293                 :   // helper to add the inter-spacing when <math> is the immediate parent.
     294                 :   // Since we don't (yet) handle the root <math> element ourselves, we need to
     295                 :   // take special care of the inter-frame spacing on elements for which <math>
     296                 :   // is the direct xml parent. This function will be repeatedly called from
     297                 :   // left to right on the childframes of <math>, and by so doing it will
     298                 :   // emulate the spacing that would have been done by a <mrow> container.
     299                 :   // e.g., it fixes <math> <mi>f</mi> <mo>q</mo> <mi>f</mi> <mo>I</mo> </math>
     300                 :   virtual nscoord
     301                 :   FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize);
     302                 : 
     303                 :   // helper method to complete the post-reflow hook and ensure that embellished
     304                 :   // operators don't terminate their Reflow without receiving a Stretch command.
     305                 :   virtual nsresult
     306                 :   FinalizeReflow(nsRenderingContext& aRenderingContext,
     307                 :                  nsHTMLReflowMetrics& aDesiredSize);
     308                 : 
     309                 :   // Record metrics of a child frame for recovery through the following method
     310                 :   static void
     311                 :   SaveReflowAndBoundingMetricsFor(nsIFrame*                  aFrame,
     312                 :                                   const nsHTMLReflowMetrics& aReflowMetrics,
     313                 :                                   const nsBoundingMetrics&   aBoundingMetrics);
     314                 : 
     315                 :   // helper method to facilitate getting the reflow and bounding metrics of a
     316                 :   // child frame.  The argument aMathMLFrameType, when non null, will return
     317                 :   // the 'type' of the frame, which is used to determine the inter-frame
     318                 :   // spacing.
     319                 :   // IMPORTANT: This function is only meant to be called in Place() methods as
     320                 :   // the information is available only when set up with the above method
     321                 :   // during Reflow/Stretch() and GetPrefWidth().
     322                 :   static void
     323                 :   GetReflowAndBoundingMetricsFor(nsIFrame*            aFrame,
     324                 :                                  nsHTMLReflowMetrics& aReflowMetrics,
     325                 :                                  nsBoundingMetrics&   aBoundingMetrics,
     326                 :                                  eMathMLFrameType*    aMathMLFrameType = nsnull);
     327                 : 
     328                 :   // helper method to clear metrics saved with
     329                 :   // SaveReflowAndBoundingMetricsFor() from all child frames.
     330                 :   void ClearSavedChildMetrics();
     331                 : 
     332                 :   // helper to let the update of presentation data pass through
     333                 :   // a subtree that may contain non-MathML container frames
     334                 :   static void
     335                 :   PropagatePresentationDataFor(nsIFrame*       aFrame,
     336                 :                                PRUint32        aFlagsValues,
     337                 :                                PRUint32        aFlagsToUpdate);
     338                 : 
     339                 : public:
     340                 :   static void
     341                 :   PropagatePresentationDataFromChildAt(nsIFrame*       aParentFrame,
     342                 :                                        PRInt32         aFirstChildIndex,
     343                 :                                        PRInt32         aLastChildIndex,
     344                 :                                        PRUint32        aFlagsValues,
     345                 :                                        PRUint32        aFlagsToUpdate);
     346                 : 
     347                 :   // helper to let the rebuild of automatic data (presentation data
     348                 :   // and embellishement data) walk through a subtree that may contain
     349                 :   // non-MathML container frames. Note that this method re-builds the
     350                 :   // automatic data in the children -- not in aParentFrame itself (except
     351                 :   // for those particular operations that the parent frame may do in its
     352                 :   // TransmitAutomaticData()). The reason it works this way is because
     353                 :   // a container frame knows what it wants for its children, whereas children
     354                 :   // have no clue who their parent is. For example, it is <mfrac> who knows
     355                 :   // that its children have to be in scriptsizes, and has to transmit this
     356                 :   // information to them. Hence, when changes occur in a child frame, the child
     357                 :   // has to request the re-build from its parent. Unfortunately, the extra cost
     358                 :   // for this is that it will re-sync in the siblings of the child as well.
     359                 :   static void
     360                 :   RebuildAutomaticDataForChildren(nsIFrame* aParentFrame);
     361                 : 
     362                 :   // helper to blow away the automatic data cached in a frame's subtree and
     363                 :   // re-layout its subtree to reflect changes that may have happen. In the
     364                 :   // event where aParentFrame isn't a MathML frame, it will first walk up to
     365                 :   // the ancestor that is a MathML frame, and re-layout from there -- this is
     366                 :   // to guarantee that automatic data will be rebuilt properly. Note that this
     367                 :   // method re-builds the automatic data in the children -- not in the parent
     368                 :   // frame itself (except for those particular operations that the parent frame
     369                 :   // may do do its TransmitAutomaticData()). @see RebuildAutomaticDataForChildren
     370                 :   //
     371                 :   // aBits are the bits to pass to FrameNeedsReflow() when we call it.
     372                 :   static nsresult
     373                 :   ReLayoutChildren(nsIFrame* aParentFrame);
     374                 : 
     375                 : protected:
     376                 :   // Helper method which positions child frames as an <mrow> on given baseline
     377                 :   // y = aBaseline starting from x = aOffsetX, calling FinishReflowChild()
     378                 :   // on the frames.
     379                 :   void
     380                 :   PositionRowChildFrames(nscoord aOffsetX, nscoord aBaseline);
     381                 : 
     382                 :   // A variant on FinishAndStoreOverflow() that uses the union of child
     383                 :   // overflows, the frame bounds, and mBoundingMetrics to set and store the
     384                 :   // overflow.
     385                 :   void GatherAndStoreOverflow(nsHTMLReflowMetrics* aMetrics);
     386                 : 
     387                 :   /**
     388                 :    * Call DidReflow() if the NS_FRAME_IN_REFLOW frame bit is set on aFirst and
     389                 :    * all its next siblings up to, but not including, aStop.
     390                 :    * aStop == nsnull meaning all next siblings with the bit set.
     391                 :    * The method does nothing if aFirst == nsnull.
     392                 :    */
     393                 :   static void DidReflowChildren(nsIFrame* aFirst, nsIFrame* aStop = nsnull);
     394                 : 
     395                 : private:
     396                 :   class RowChildFrameIterator;
     397                 :   friend class RowChildFrameIterator;
     398                 : };
     399                 : 
     400                 : 
     401                 : // --------------------------------------------------------------------------
     402                 : // Currently, to benefit from line-breaking inside the <math> element, <math> is
     403                 : // simply mapping to nsBlockFrame or nsInlineFrame.
     404                 : // A separate implemention needs to provide:
     405                 : // 1) line-breaking
     406                 : // 2) proper inter-frame spacing
     407                 : // 3) firing of Stretch() (in which case FinalizeReflow() would have to be cleaned)
     408                 : // Issues: If/when mathml becomes a pluggable component, the separation will be needed.
     409                 : class nsMathMLmathBlockFrame : public nsBlockFrame {
     410                 : public:
     411                 :   NS_DECL_FRAMEARENA_HELPERS
     412                 : 
     413                 :   friend nsIFrame* NS_NewMathMLmathBlockFrame(nsIPresShell* aPresShell,
     414                 :           nsStyleContext* aContext, PRUint32 aFlags);
     415                 : 
     416                 :   // beware, mFrames is not set by nsBlockFrame
     417                 :   // cannot use mFrames{.FirstChild()|.etc} since the block code doesn't set mFrames
     418                 :   NS_IMETHOD
     419               0 :   SetInitialChildList(ChildListID     aListID,
     420                 :                       nsFrameList&    aChildList)
     421                 :   {
     422               0 :     NS_ASSERTION(aListID == kPrincipalList, "unexpected frame list");
     423               0 :     nsresult rv = nsBlockFrame::SetInitialChildList(aListID, aChildList);
     424                 :     // re-resolve our subtree to set any mathml-expected data
     425               0 :     nsMathMLContainerFrame::RebuildAutomaticDataForChildren(this);
     426               0 :     return rv;
     427                 :   }
     428                 : 
     429                 :   NS_IMETHOD
     430               0 :   AppendFrames(ChildListID     aListID,
     431                 :                nsFrameList&    aFrameList)
     432                 :   {
     433               0 :     NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
     434                 :                  "unexpected frame list");
     435               0 :     nsresult rv = nsBlockFrame::AppendFrames(aListID, aFrameList);
     436               0 :     if (NS_LIKELY(aListID == kPrincipalList))
     437               0 :       nsMathMLContainerFrame::ReLayoutChildren(this);
     438               0 :     return rv;
     439                 :   }
     440                 : 
     441                 :   NS_IMETHOD
     442               0 :   InsertFrames(ChildListID     aListID,
     443                 :                nsIFrame*       aPrevFrame,
     444                 :                nsFrameList&    aFrameList)
     445                 :   {
     446               0 :     NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
     447                 :                  "unexpected frame list");
     448               0 :     nsresult rv = nsBlockFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
     449               0 :     if (NS_LIKELY(aListID == kPrincipalList))
     450               0 :       nsMathMLContainerFrame::ReLayoutChildren(this);
     451               0 :     return rv;
     452                 :   }
     453                 : 
     454                 :   NS_IMETHOD
     455               0 :   RemoveFrame(ChildListID     aListID,
     456                 :               nsIFrame*       aOldFrame)
     457                 :   {
     458               0 :     NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
     459                 :                  "unexpected frame list");
     460               0 :     nsresult rv = nsBlockFrame::RemoveFrame(aListID, aOldFrame);
     461               0 :     if (NS_LIKELY(aListID == kPrincipalList))
     462               0 :       nsMathMLContainerFrame::ReLayoutChildren(this);
     463               0 :     return rv;
     464                 :   }
     465                 : 
     466               0 :   virtual bool IsFrameOfType(PRUint32 aFlags) const {
     467                 :     return nsBlockFrame::IsFrameOfType(aFlags &
     468               0 :               ~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace));
     469                 :   }
     470                 : 
     471                 : protected:
     472               0 :   nsMathMLmathBlockFrame(nsStyleContext* aContext) : nsBlockFrame(aContext) {
     473                 :     // We should always have a float manager.  Not that things can really try
     474                 :     // to float out of us anyway, but we need one for line layout.
     475               0 :     AddStateBits(NS_BLOCK_FLOAT_MGR);
     476               0 :   }
     477               0 :   virtual ~nsMathMLmathBlockFrame() {}
     478                 : };
     479                 : 
     480                 : // --------------
     481                 : 
     482                 : class nsMathMLmathInlineFrame : public nsInlineFrame {
     483                 : public:
     484                 :   NS_DECL_FRAMEARENA_HELPERS
     485                 : 
     486                 :   friend nsIFrame* NS_NewMathMLmathInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
     487                 : 
     488                 :   NS_IMETHOD
     489               0 :   SetInitialChildList(ChildListID     aListID,
     490                 :                       nsFrameList&    aChildList)
     491                 :   {
     492               0 :     NS_ASSERTION(aListID == kPrincipalList, "unexpected frame list");
     493               0 :     nsresult rv = nsInlineFrame::SetInitialChildList(aListID, aChildList);
     494                 :     // re-resolve our subtree to set any mathml-expected data
     495               0 :     nsMathMLContainerFrame::RebuildAutomaticDataForChildren(this);
     496               0 :     return rv;
     497                 :   }
     498                 : 
     499                 :   NS_IMETHOD
     500               0 :   AppendFrames(ChildListID     aListID,
     501                 :                nsFrameList&    aFrameList)
     502                 :   {
     503               0 :     NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
     504                 :                  "unexpected frame list");
     505               0 :     nsresult rv = nsInlineFrame::AppendFrames(aListID, aFrameList);
     506               0 :     if (NS_LIKELY(aListID == kPrincipalList))
     507               0 :       nsMathMLContainerFrame::ReLayoutChildren(this);
     508               0 :     return rv;
     509                 :   }
     510                 : 
     511                 :   NS_IMETHOD
     512               0 :   InsertFrames(ChildListID     aListID,
     513                 :                nsIFrame*       aPrevFrame,
     514                 :                nsFrameList&    aFrameList)
     515                 :   {
     516               0 :     NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
     517                 :                  "unexpected frame list");
     518               0 :     nsresult rv = nsInlineFrame::InsertFrames(aListID, aPrevFrame, aFrameList);
     519               0 :     if (NS_LIKELY(aListID == kPrincipalList))
     520               0 :       nsMathMLContainerFrame::ReLayoutChildren(this);
     521               0 :     return rv;
     522                 :   }
     523                 : 
     524                 :   NS_IMETHOD
     525               0 :   RemoveFrame(ChildListID     aListID,
     526                 :               nsIFrame*       aOldFrame)
     527                 :   {
     528               0 :     NS_ASSERTION(aListID == kPrincipalList || aListID == kNoReflowPrincipalList,
     529                 :                  "unexpected frame list");
     530               0 :     nsresult rv = nsInlineFrame::RemoveFrame(aListID, aOldFrame);
     531               0 :     if (NS_LIKELY(aListID == kPrincipalList))
     532               0 :       nsMathMLContainerFrame::ReLayoutChildren(this);
     533               0 :     return rv;
     534                 :   }
     535                 : 
     536               0 :   virtual bool IsFrameOfType(PRUint32 aFlags) const {
     537                 :       return nsInlineFrame::IsFrameOfType(aFlags &
     538               0 :                 ~(nsIFrame::eMathML | nsIFrame::eExcludesIgnorableWhitespace));
     539                 :   }
     540                 : 
     541                 : protected:
     542               0 :   nsMathMLmathInlineFrame(nsStyleContext* aContext) : nsInlineFrame(aContext) {}
     543               0 :   virtual ~nsMathMLmathInlineFrame() {}
     544                 : };
     545                 : 
     546                 : #endif /* nsMathMLContainerFrame_h___ */

Generated by: LCOV version 1.7