LCOV - code coverage report
Current view: directory - layout/generic - nsHTMLReflowState.h (source / functions) Found Hit Coverage
Test: app.info Lines: 26 0 0.0 %
Date: 2012-06-02 Functions: 11 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.org code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Netscape Communications Corporation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 1998
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *
      24                 :  * Alternatively, the contents of this file may be used under the terms of
      25                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      26                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      28                 :  * of those above. If you wish to allow use of your version of this file only
      29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      30                 :  * use your version of this file under the terms of the MPL, indicate your
      31                 :  * decision by deleting the provisions above and replace them with the notice
      32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      33                 :  * the provisions above, a recipient may use your version of this file under
      34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      35                 :  *
      36                 :  * ***** END LICENSE BLOCK ***** */
      37                 : 
      38                 : /* struct containing the input to nsIFrame::Reflow */
      39                 : 
      40                 : #ifndef nsHTMLReflowState_h___
      41                 : #define nsHTMLReflowState_h___
      42                 : 
      43                 : #include "nsMargin.h"
      44                 : #include "nsStyleCoord.h"
      45                 : #include "nsIFrame.h"
      46                 : #include "mozilla/AutoRestore.h"
      47                 : 
      48                 : class nsPresContext;
      49                 : class nsRenderingContext;
      50                 : class nsFloatManager;
      51                 : class nsLineLayout;
      52                 : class nsIPercentHeightObserver;
      53                 : 
      54                 : struct nsStyleDisplay;
      55                 : struct nsStyleVisibility;
      56                 : struct nsStylePosition;
      57                 : struct nsStyleBorder;
      58                 : struct nsStyleMargin;
      59                 : struct nsStylePadding;
      60                 : struct nsStyleText;
      61                 : struct nsHypotheticalBox;
      62                 : 
      63                 : template <class NumericType>
      64                 : NumericType
      65               0 : NS_CSS_MINMAX(NumericType aValue, NumericType aMinValue, NumericType aMaxValue)
      66                 : {
      67               0 :   NumericType result = aValue;
      68               0 :   if (aMaxValue < result)
      69               0 :     result = aMaxValue;
      70               0 :   if (aMinValue > result)
      71               0 :     result = aMinValue;
      72               0 :   return result;
      73                 : }
      74                 : 
      75                 : /**
      76                 :  * Constant used to indicate an unconstrained size.
      77                 :  *
      78                 :  * @see #Reflow()
      79                 :  */
      80                 : #define NS_UNCONSTRAINEDSIZE NS_MAXSIZE
      81                 : 
      82                 : /**
      83                 :  * CSS Frame type. Included as part of the reflow state.
      84                 :  */
      85                 : typedef PRUint32  nsCSSFrameType;
      86                 : 
      87                 : #define NS_CSS_FRAME_TYPE_UNKNOWN         0
      88                 : #define NS_CSS_FRAME_TYPE_INLINE          1
      89                 : #define NS_CSS_FRAME_TYPE_BLOCK           2  /* block-level in normal flow */
      90                 : #define NS_CSS_FRAME_TYPE_FLOATING        3
      91                 : #define NS_CSS_FRAME_TYPE_ABSOLUTE        4
      92                 : #define NS_CSS_FRAME_TYPE_INTERNAL_TABLE  5  /* row group frame, row frame, cell frame, ... */
      93                 : 
      94                 : /**
      95                 :  * Bit-flag that indicates whether the element is replaced. Applies to inline,
      96                 :  * block-level, floating, and absolutely positioned elements
      97                 :  */
      98                 : #define NS_CSS_FRAME_TYPE_REPLACED                0x08000
      99                 : 
     100                 : /**
     101                 :  * Bit-flag that indicates that the element is replaced and contains a block
     102                 :  * (eg some form controls).  Applies to inline, block-level, floating, and
     103                 :  * absolutely positioned elements.  Mutually exclusive with
     104                 :  * NS_CSS_FRAME_TYPE_REPLACED.
     105                 :  */
     106                 : #define NS_CSS_FRAME_TYPE_REPLACED_CONTAINS_BLOCK 0x10000
     107                 : 
     108                 : /**
     109                 :  * Helper macros for telling whether items are replaced
     110                 :  */
     111                 : #define NS_FRAME_IS_REPLACED_NOBLOCK(_ft) \
     112                 :   (NS_CSS_FRAME_TYPE_REPLACED == ((_ft) & NS_CSS_FRAME_TYPE_REPLACED))
     113                 : 
     114                 : #define NS_FRAME_IS_REPLACED(_ft)            \
     115                 :   (NS_FRAME_IS_REPLACED_NOBLOCK(_ft) ||      \
     116                 :    NS_FRAME_IS_REPLACED_CONTAINS_BLOCK(_ft))
     117                 : 
     118                 : #define NS_FRAME_REPLACED(_ft) \
     119                 :   (NS_CSS_FRAME_TYPE_REPLACED | (_ft))
     120                 : 
     121                 : #define NS_FRAME_IS_REPLACED_CONTAINS_BLOCK(_ft)         \
     122                 :   (NS_CSS_FRAME_TYPE_REPLACED_CONTAINS_BLOCK ==         \
     123                 :    ((_ft) & NS_CSS_FRAME_TYPE_REPLACED_CONTAINS_BLOCK))
     124                 : 
     125                 : #define NS_FRAME_REPLACED_CONTAINS_BLOCK(_ft) \
     126                 :   (NS_CSS_FRAME_TYPE_REPLACED_CONTAINS_BLOCK | (_ft))
     127                 : 
     128                 : /**
     129                 :  * A macro to extract the type. Masks off the 'replaced' bit-flag
     130                 :  */
     131                 : #define NS_FRAME_GET_TYPE(_ft)                           \
     132                 :   ((_ft) & ~(NS_CSS_FRAME_TYPE_REPLACED |                \
     133                 :              NS_CSS_FRAME_TYPE_REPLACED_CONTAINS_BLOCK))
     134                 : 
     135                 : #define NS_INTRINSICSIZE    NS_UNCONSTRAINEDSIZE
     136                 : #define NS_AUTOHEIGHT       NS_UNCONSTRAINEDSIZE
     137                 : #define NS_AUTOMARGIN       NS_UNCONSTRAINEDSIZE
     138                 : #define NS_AUTOOFFSET       NS_UNCONSTRAINEDSIZE
     139                 : // NOTE: there are assumptions all over that these have the same value, namely NS_UNCONSTRAINEDSIZE
     140                 : //       if any are changed to be a value other than NS_UNCONSTRAINEDSIZE
     141                 : //       at least update AdjustComputedHeight/Width and test ad nauseum
     142                 : 
     143                 : // A base class of nsHTMLReflowState that computes only the padding,
     144                 : // border, and margin, since those values are needed more often.
     145               0 : struct nsCSSOffsetState {
     146                 : public:
     147                 :   // the frame being reflowed
     148                 :   nsIFrame*           frame;
     149                 : 
     150                 :   // rendering context to use for measurement
     151                 :   nsRenderingContext* rendContext;
     152                 : 
     153                 :   // Computed margin values
     154                 :   nsMargin         mComputedMargin;
     155                 : 
     156                 :   // Cached copy of the border + padding values
     157                 :   nsMargin         mComputedBorderPadding;
     158                 : 
     159                 :   // Computed padding values
     160                 :   nsMargin         mComputedPadding;
     161                 : 
     162                 :   // Callers using this constructor must call InitOffsets on their own.
     163               0 :   nsCSSOffsetState(nsIFrame *aFrame, nsRenderingContext *aRenderingContext)
     164                 :     : frame(aFrame)
     165               0 :     , rendContext(aRenderingContext)
     166                 :   {
     167               0 :   }
     168                 : 
     169               0 :   nsCSSOffsetState(nsIFrame *aFrame, nsRenderingContext *aRenderingContext,
     170                 :                    nscoord aContainingBlockWidth)
     171                 :     : frame(aFrame)
     172               0 :     , rendContext(aRenderingContext)
     173                 :   {
     174               0 :     InitOffsets(aContainingBlockWidth, frame->GetType());
     175               0 :   }
     176                 : 
     177                 : #ifdef DEBUG
     178                 :   // Reflow trace methods.  Defined in nsFrame.cpp so they have access
     179                 :   // to the display-reflow infrastructure.
     180                 :   static void* DisplayInitOffsetsEnter(nsIFrame* aFrame,
     181                 :                                        nsCSSOffsetState* aState,
     182                 :                                        nscoord aCBWidth,
     183                 :                                        const nsMargin* aBorder,
     184                 :                                        const nsMargin* aPadding);
     185                 :   static void DisplayInitOffsetsExit(nsIFrame* aFrame,
     186                 :                                      nsCSSOffsetState* aState,
     187                 :                                      void* aValue);
     188                 : #endif
     189                 : 
     190                 : private:
     191                 :   /**
     192                 :    * Computes margin values from the specified margin style information, and
     193                 :    * fills in the mComputedMargin member.
     194                 :    * @return true if the margin is dependent on the containing block width
     195                 :    */
     196                 :   bool ComputeMargin(nscoord aContainingBlockWidth);
     197                 :   
     198                 :   /**
     199                 :    * Computes padding values from the specified padding style information, and
     200                 :    * fills in the mComputedPadding member.
     201                 :    * @return true if the padding is dependent on the containing block width
     202                 :    */
     203                 :    bool ComputePadding(nscoord aContainingBlockWidth, nsIAtom* aFrameType);
     204                 : 
     205                 : protected:
     206                 : 
     207                 :   void InitOffsets(nscoord aContainingBlockWidth,
     208                 :                    nsIAtom* aFrameType,
     209                 :                    const nsMargin *aBorder = nsnull,
     210                 :                    const nsMargin *aPadding = nsnull);
     211                 : 
     212                 :   /*
     213                 :    * Convert nsStyleCoord to nscoord when percentages depend on the
     214                 :    * containing block width, and enumerated values are for width,
     215                 :    * min-width, or max-width.  Does not handle auto widths.
     216                 :    */
     217                 :   inline nscoord ComputeWidthValue(nscoord aContainingBlockWidth,
     218                 :                                    nscoord aContentEdgeToBoxSizing,
     219                 :                                    nscoord aBoxSizingToMarginEdge,
     220                 :                                    const nsStyleCoord& aCoord);
     221                 :   // same as previous, but using mComputedBorderPadding, mComputedPadding,
     222                 :   // and mComputedMargin
     223                 :   nscoord ComputeWidthValue(nscoord aContainingBlockWidth,
     224                 :                             PRUint8 aBoxSizing,
     225                 :                             const nsStyleCoord& aCoord);
     226                 : };
     227                 : 
     228                 : /**
     229                 :  * State passed to a frame during reflow or intrinsic size calculation.
     230                 :  *
     231                 :  * XXX Refactor so only a base class (nsSizingState?) is used for intrinsic
     232                 :  * size calculation.
     233                 :  *
     234                 :  * @see nsIFrame#Reflow()
     235                 :  */
     236               0 : struct nsHTMLReflowState : public nsCSSOffsetState {
     237                 :   // the reflow states are linked together. this is the pointer to the
     238                 :   // parent's reflow state
     239                 :   const nsHTMLReflowState* parentReflowState;
     240                 : 
     241                 :   // pointer to the float manager associated with this area
     242                 :   nsFloatManager* mFloatManager;
     243                 : 
     244                 :   // LineLayout object (only for inline reflow; set to NULL otherwise)
     245                 :   nsLineLayout*    mLineLayout;
     246                 : 
     247                 :   // The appropriate reflow state for the containing block (for
     248                 :   // percentage widths, etc.) of this reflow state's frame.
     249                 :   const nsHTMLReflowState *mCBReflowState;
     250                 : 
     251                 :   // the available width in which to reflow the frame. The space
     252                 :   // represents the amount of room for the frame's margin, border,
     253                 :   // padding, and content area. The frame size you choose should fit
     254                 :   // within the available width.
     255                 :   nscoord              availableWidth;
     256                 : 
     257                 :   // A value of NS_UNCONSTRAINEDSIZE for the available height means
     258                 :   // you can choose whatever size you want. In galley mode the
     259                 :   // available height is always NS_UNCONSTRAINEDSIZE, and only page
     260                 :   // mode or multi-column layout involves a constrained height. The
     261                 :   // element's the top border and padding, and content, must fit. If the
     262                 :   // element is complete after reflow then its bottom border, padding
     263                 :   // and margin (and similar for its complete ancestors) will need to
     264                 :   // fit in this height.
     265                 :   nscoord              availableHeight;
     266                 : 
     267                 :   // The type of frame, from css's perspective. This value is
     268                 :   // initialized by the Init method below.
     269                 :   nsCSSFrameType   mFrameType;
     270                 : 
     271                 :   // The amount the in-flow position of the block is moving vertically relative
     272                 :   // to its previous in-flow position (i.e. the amount the line containing the
     273                 :   // block is moving).
     274                 :   // This should be zero for anything which is not a block outside, and it
     275                 :   // should be zero for anything which has a non-block parent.
     276                 :   // The intended use of this value is to allow the accurate determination
     277                 :   // of the potential impact of a float
     278                 :   // This takes on an arbitrary value the first time a block is reflowed
     279                 :   nscoord mBlockDelta;
     280                 : 
     281                 : private:
     282                 :   // The computed width specifies the frame's content area width, and it does
     283                 :   // not apply to inline non-replaced elements
     284                 :   //
     285                 :   // For replaced inline frames, a value of NS_INTRINSICSIZE means you should
     286                 :   // use your intrinsic width as the computed width
     287                 :   //
     288                 :   // For block-level frames, the computed width is based on the width of the
     289                 :   // containing block, the margin/border/padding areas, and the min/max width.
     290                 :   nscoord          mComputedWidth; 
     291                 : 
     292                 :   // The computed height specifies the frame's content height, and it does
     293                 :   // not apply to inline non-replaced elements
     294                 :   //
     295                 :   // For replaced inline frames, a value of NS_INTRINSICSIZE means you should
     296                 :   // use your intrinsic height as the computed height
     297                 :   //
     298                 :   // For non-replaced block-level frames in the flow and floated, a value of
     299                 :   // NS_AUTOHEIGHT means you choose a height to shrink wrap around the normal
     300                 :   // flow child frames. The height must be within the limit of the min/max
     301                 :   // height if there is such a limit
     302                 :   //
     303                 :   // For replaced block-level frames, a value of NS_INTRINSICSIZE
     304                 :   // means you use your intrinsic height as the computed height
     305                 :   nscoord          mComputedHeight;
     306                 : 
     307                 : public:
     308                 :   // Computed values for 'left/top/right/bottom' offsets. Only applies to
     309                 :   // 'positioned' elements
     310                 :   nsMargin         mComputedOffsets;
     311                 : 
     312                 :   // Computed values for 'min-width/max-width' and 'min-height/max-height'
     313                 :   // XXXldb The width ones here should go; they should be needed only
     314                 :   // internally.
     315                 :   nscoord          mComputedMinWidth, mComputedMaxWidth;
     316                 :   nscoord          mComputedMinHeight, mComputedMaxHeight;
     317                 : 
     318                 :   // Cached pointers to the various style structs used during intialization
     319                 :   const nsStyleDisplay*    mStyleDisplay;
     320                 :   const nsStyleVisibility* mStyleVisibility;
     321                 :   const nsStylePosition*   mStylePosition;
     322                 :   const nsStyleBorder*     mStyleBorder;
     323                 :   const nsStyleMargin*     mStyleMargin;
     324                 :   const nsStylePadding*    mStylePadding;
     325                 :   const nsStyleText*       mStyleText;
     326                 : 
     327                 :   // a frame (e.g. nsTableCellFrame) which may need to generate a special 
     328                 :   // reflow for percent height calculations 
     329                 :   nsIPercentHeightObserver* mPercentHeightObserver;
     330                 : 
     331                 :   // CSS margin collapsing sometimes requires us to reflow
     332                 :   // optimistically assuming that margins collapse to see if clearance
     333                 :   // is required. When we discover that clearance is required, we
     334                 :   // store the frame in which clearance was discovered to the location
     335                 :   // requested here.
     336                 :   nsIFrame** mDiscoveredClearance;
     337                 : 
     338                 :   // This value keeps track of how deeply nested a given reflow state
     339                 :   // is from the top of the frame tree.
     340                 :   PRInt16 mReflowDepth;
     341                 : 
     342                 :   struct ReflowStateFlags {
     343                 :     PRUint16 mSpecialHeightReflow:1; // used by tables to communicate special reflow (in process) to handle
     344                 :                                      // percent height frames inside cells which may not have computed heights
     345                 :     PRUint16 mNextInFlowUntouched:1; // nothing in the frame's next-in-flow (or its descendants)
     346                 :                                      // is changing
     347                 :     PRUint16 mIsTopOfPage:1;         // Is the current context at the top of a
     348                 :                                      // page?  When true, we force something
     349                 :                                      // that's too tall for a page/column to
     350                 :                                      // fit anyway to avoid infinite loops.
     351                 :     PRUint16 mBlinks:1;              // Keep track of text-decoration: blink
     352                 :     PRUint16 mHasClearance:1;        // Block has clearance
     353                 :     PRUint16 mAssumingHScrollbar:1;  // parent frame is an nsIScrollableFrame and it
     354                 :                                      // is assuming a horizontal scrollbar
     355                 :     PRUint16 mAssumingVScrollbar:1;  // parent frame is an nsIScrollableFrame and it
     356                 :                                      // is assuming a vertical scrollbar
     357                 : 
     358                 :     PRUint16 mHResize:1;             // Is frame (a) not dirty and (b) a
     359                 :                                      // different width than before?
     360                 : 
     361                 :     PRUint16 mVResize:1;             // Is frame (a) not dirty and (b) a
     362                 :                                      // different height than before or
     363                 :                                      // (potentially) in a context where
     364                 :                                      // percent heights have a different
     365                 :                                      // basis?
     366                 :     PRUint16 mTableIsSplittable:1;   // tables are splittable, this should happen only inside a page
     367                 :                                      // and never insider a column frame
     368                 :     PRUint16 mHeightDependsOnAncestorCell:1;   // Does frame height depend on
     369                 :                                                // an ancestor table-cell?
     370                 :     PRUint16 mIsColumnBalancing:1;   // nsColumnSetFrame is balancing columns
     371                 :   } mFlags;
     372                 : 
     373                 : private:
     374                 : 
     375                 :   mozilla::AutoRestore<nsIFrame*> mRestoreCurrentInflationContainer;
     376                 :   mozilla::AutoRestore<nscoord> mRestoreCurrentInflationContainerWidth;
     377                 : 
     378                 : public:
     379                 :   // Note: The copy constructor is written by the compiler automatically. You
     380                 :   // can use that and then override specific values if you want, or you can
     381                 :   // call Init as desired...
     382                 : 
     383                 :   // Initialize a <b>root</b> reflow state with a rendering context to
     384                 :   // use for measuring things.
     385                 :   nsHTMLReflowState(nsPresContext*           aPresContext,
     386                 :                     nsIFrame*                aFrame,
     387                 :                     nsRenderingContext*     aRenderingContext,
     388                 :                     const nsSize&            aAvailableSpace);
     389                 : 
     390                 :   // Initialize a reflow state for a child frames reflow. Some state
     391                 :   // is copied from the parent reflow state; the remaining state is
     392                 :   // computed. 
     393                 :   nsHTMLReflowState(nsPresContext*           aPresContext,
     394                 :                     const nsHTMLReflowState& aParentReflowState,
     395                 :                     nsIFrame*                aFrame,
     396                 :                     const nsSize&            aAvailableSpace,
     397                 :                     // These two are used by absolute positioning code
     398                 :                     // to override default containing block w & h:
     399                 :                     nscoord                  aContainingBlockWidth = -1,
     400                 :                     nscoord                  aContainingBlockHeight = -1,
     401                 :                     bool                     aInit = true);
     402                 : 
     403                 :   // This method initializes various data members. It is automatically
     404                 :   // called by the various constructors
     405                 :   void Init(nsPresContext* aPresContext,
     406                 :             nscoord         aContainingBlockWidth = -1,
     407                 :             nscoord         aContainingBlockHeight = -1,
     408                 :             const nsMargin* aBorder = nsnull,
     409                 :             const nsMargin* aPadding = nsnull);
     410                 :   /**
     411                 :    * Find the content width of the containing block of aReflowState
     412                 :    */
     413                 :   static nscoord
     414                 :     GetContainingBlockContentWidth(const nsHTMLReflowState* aReflowState);
     415                 : 
     416                 :   /**
     417                 :    * Calculate the used line-height property. The return value will be >= 0.
     418                 :    */
     419                 :   nscoord CalcLineHeight() const;
     420                 : 
     421                 :   /**
     422                 :    * Same as CalcLineHeight() above, but doesn't need a reflow state.
     423                 :    *
     424                 :    * @param aBlockHeight The computed height of the content rect of the block
     425                 :    *                     that the line should fill.
     426                 :    *                     Only used with line-height:-moz-block-height.
     427                 :    *                     NS_AUTOHEIGHT results in a normal line-height for
     428                 :    *                     line-height:-moz-block-height.
     429                 :    * @param aFontSizeInflation The result of the appropriate
     430                 :    *                           nsLayoutUtils::FontSizeInflationFor call,
     431                 :    *                           or 1.0 if during intrinsic size
     432                 :    *                           calculation.
     433                 :    */
     434                 :   static nscoord CalcLineHeight(nsStyleContext* aStyleContext,
     435                 :                                 nscoord aBlockHeight,
     436                 :                                 float aFontSizeInflation);
     437                 : 
     438                 : 
     439                 :   void ComputeContainingBlockRectangle(nsPresContext*          aPresContext,
     440                 :                                        const nsHTMLReflowState* aContainingBlockRS,
     441                 :                                        nscoord&                 aContainingBlockWidth,
     442                 :                                        nscoord&                 aContainingBlockHeight);
     443                 : 
     444                 :   /**
     445                 :    * Apply the mComputed(Min/Max)(Width/Height) values to the content
     446                 :    * size computed so far. If a passed-in pointer is null, we skip
     447                 :    * adjusting that dimension.
     448                 :    */
     449                 :   void ApplyMinMaxConstraints(nscoord* aContentWidth, nscoord* aContentHeight) const;
     450                 : 
     451               0 :   bool ShouldReflowAllKids() const {
     452                 :     // Note that we could make a stronger optimization for mVResize if
     453                 :     // we use it in a ShouldReflowChild test that replaces the current
     454                 :     // checks of NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN, if it
     455                 :     // were tested there along with NS_FRAME_CONTAINS_RELATIVE_HEIGHT.
     456                 :     // This would need to be combined with a slight change in which
     457                 :     // frames NS_FRAME_CONTAINS_RELATIVE_HEIGHT is marked on.
     458               0 :     return (frame->GetStateBits() & NS_FRAME_IS_DIRTY) ||
     459                 :            mFlags.mHResize ||
     460                 :            (mFlags.mVResize && 
     461               0 :             (frame->GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT));
     462                 :   }
     463                 : 
     464               0 :   nscoord ComputedWidth() const { return mComputedWidth; }
     465                 :   // This method doesn't apply min/max computed widths to the value passed in.
     466                 :   void SetComputedWidth(nscoord aComputedWidth);
     467                 : 
     468               0 :   nscoord ComputedHeight() const { return mComputedHeight; }
     469                 :   // This method doesn't apply min/max computed heights to the value passed in.
     470                 :   void SetComputedHeight(nscoord aComputedHeight);
     471                 : 
     472               0 :   void SetComputedHeightWithoutResettingResizeFlags(nscoord aComputedHeight) {
     473                 :     // Viewport frames reset the computed height on a copy of their reflow
     474                 :     // state when reflowing fixed-pos kids.  In that case we actually don't
     475                 :     // want to mess with the resize flags, because comparing the frame's rect
     476                 :     // to the munged computed width is pointless.
     477               0 :     mComputedHeight = aComputedHeight;
     478               0 :   }
     479                 : 
     480                 :   void SetTruncated(const nsHTMLReflowMetrics& aMetrics, nsReflowStatus* aStatus) const;
     481                 : 
     482               0 :   bool WillReflowAgainForClearance() const {
     483               0 :     return mDiscoveredClearance && *mDiscoveredClearance;
     484                 :   }
     485                 : 
     486                 : #ifdef DEBUG
     487                 :   // Reflow trace methods.  Defined in nsFrame.cpp so they have access
     488                 :   // to the display-reflow infrastructure.
     489                 :   static void* DisplayInitConstraintsEnter(nsIFrame* aFrame,
     490                 :                                            nsHTMLReflowState* aState,
     491                 :                                            nscoord aCBWidth,
     492                 :                                            nscoord aCBHeight,
     493                 :                                            const nsMargin* aBorder,
     494                 :                                            const nsMargin* aPadding);
     495                 :   static void DisplayInitConstraintsExit(nsIFrame* aFrame,
     496                 :                                          nsHTMLReflowState* aState,
     497                 :                                          void* aValue);
     498                 :   static void* DisplayInitFrameTypeEnter(nsIFrame* aFrame,
     499                 :                                          nsHTMLReflowState* aState);
     500                 :   static void DisplayInitFrameTypeExit(nsIFrame* aFrame,
     501                 :                                        nsHTMLReflowState* aState,
     502                 :                                        void* aValue);
     503                 : #endif
     504                 : 
     505                 : protected:
     506                 :   void InitFrameType(nsIAtom* aFrameType);
     507                 :   void InitCBReflowState();
     508                 :   void InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType);
     509                 : 
     510                 :   void InitConstraints(nsPresContext* aPresContext,
     511                 :                        nscoord         aContainingBlockWidth,
     512                 :                        nscoord         aContainingBlockHeight,
     513                 :                        const nsMargin* aBorder,
     514                 :                        const nsMargin* aPadding,
     515                 :                        nsIAtom*        aFrameType);
     516                 : 
     517                 :   // Returns the nearest containing block or block frame (whether or not
     518                 :   // it is a containing block) for the specified frame.  Also returns
     519                 :   // the left edge and width of the containing block's content area.
     520                 :   // These are returned in the coordinate space of the containing block.
     521                 :   nsIFrame* GetHypotheticalBoxContainer(nsIFrame* aFrame,
     522                 :                                         nscoord& aCBLeftEdge,
     523                 :                                         nscoord& aCBWidth);
     524                 : 
     525                 :   void CalculateHypotheticalBox(nsPresContext*    aPresContext,
     526                 :                                 nsIFrame*         aPlaceholderFrame,
     527                 :                                 nsIFrame*         aContainingBlock,
     528                 :                                 nscoord           aBlockLeftContentEdge,
     529                 :                                 nscoord           aBlockContentWidth,
     530                 :                                 const nsHTMLReflowState* cbrs,
     531                 :                                 nsHypotheticalBox& aHypotheticalBox,
     532                 :                                 nsIAtom*          aFrameType);
     533                 : 
     534                 :   void InitAbsoluteConstraints(nsPresContext* aPresContext,
     535                 :                                const nsHTMLReflowState* cbrs,
     536                 :                                nscoord aContainingBlockWidth,
     537                 :                                nscoord aContainingBlockHeight,
     538                 :                                nsIAtom* aFrameType);
     539                 : 
     540                 :   void ComputeRelativeOffsets(const nsHTMLReflowState* cbrs,
     541                 :                               nscoord aContainingBlockWidth,
     542                 :                               nscoord aContainingBlockHeight,
     543                 :                               nsPresContext* aPresContext);
     544                 : 
     545                 :   // Calculates the computed values for the 'min-Width', 'max-Width',
     546                 :   // 'min-Height', and 'max-Height' properties, and stores them in the assorted
     547                 :   // data members
     548                 :   void ComputeMinMaxValues(nscoord                  aContainingBlockWidth,
     549                 :                            nscoord                  aContainingBlockHeight,
     550                 :                            const nsHTMLReflowState* aContainingBlockRS);
     551                 : 
     552                 :   void CalculateHorizBorderPaddingMargin(nscoord aContainingBlockWidth,
     553                 :                                          nscoord* aInsideBoxSizing,
     554                 :                                          nscoord* aOutsideBoxSizing);
     555                 : 
     556                 :   void CalculateBlockSideMargins(nscoord aAvailWidth,
     557                 :                                  nscoord aComputedWidth,
     558                 :                                  nsIAtom* aFrameType);
     559                 : };
     560                 : 
     561                 : #endif /* nsHTMLReflowState_h___ */
     562                 : 

Generated by: LCOV version 1.7