2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1999-10-30 20:16:45 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
1999-10-30 20:16:45 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-10-30 20:16:45 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-10-30 20:16:45 +04:00
|
|
|
#ifndef nsHTMLReflowState_h___
|
|
|
|
#define nsHTMLReflowState_h___
|
|
|
|
|
2001-07-16 06:40:48 +04:00
|
|
|
#include "nsMargin.h"
|
|
|
|
#include "nsStyleCoord.h"
|
1999-10-30 20:16:45 +04:00
|
|
|
|
|
|
|
class nsIFrame;
|
|
|
|
class nsIPresContext;
|
2002-05-10 22:22:41 +04:00
|
|
|
class nsReflowPath;
|
1999-10-30 20:16:45 +04:00
|
|
|
class nsIRenderingContext;
|
2001-10-26 09:06:07 +04:00
|
|
|
class nsSpaceManager;
|
1999-10-30 20:16:45 +04:00
|
|
|
class nsLineLayout;
|
2001-12-07 17:51:12 +03:00
|
|
|
class nsIPercentHeightObserver;
|
1999-10-30 20:16:45 +04:00
|
|
|
|
|
|
|
struct nsStyleDisplay;
|
2001-06-01 02:19:43 +04:00
|
|
|
struct nsStyleVisibility;
|
1999-10-30 20:16:45 +04:00
|
|
|
struct nsStylePosition;
|
2001-02-07 12:57:26 +03:00
|
|
|
struct nsStyleBorder;
|
|
|
|
struct nsStyleMargin;
|
|
|
|
struct nsStylePadding;
|
2000-07-28 03:37:44 +04:00
|
|
|
struct nsStyleText;
|
2000-04-16 08:07:02 +04:00
|
|
|
struct nsHypotheticalBox;
|
1999-10-30 20:16:45 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constant used to indicate an unconstrained size.
|
|
|
|
*
|
|
|
|
* @see #Reflow()
|
|
|
|
*/
|
|
|
|
#define NS_UNCONSTRAINEDSIZE NS_MAXSIZE
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The reason the frame is being reflowed.
|
|
|
|
*
|
|
|
|
* XXX Should probably be a #define so it can be extended for specialized
|
|
|
|
* reflow interfaces...
|
|
|
|
*
|
|
|
|
* @see nsHTMLReflowState
|
|
|
|
*/
|
|
|
|
enum nsReflowReason {
|
2000-01-12 11:28:24 +03:00
|
|
|
eReflowReason_Initial = 0, // initial reflow of a newly created frame
|
|
|
|
eReflowReason_Incremental = 1, // an incremental change has occured. see the reflow command for details
|
|
|
|
eReflowReason_Resize = 2, // general request to determine a desired size
|
|
|
|
eReflowReason_StyleChange = 3, // request to reflow because of a style change. Note: you must reflow
|
|
|
|
// all your child frames
|
|
|
|
eReflowReason_Dirty = 4 // request to reflow because you and/or your children are dirty
|
1999-10-30 20:16:45 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CSS Frame type. Included as part of the reflow state.
|
|
|
|
*/
|
|
|
|
typedef PRUint32 nsCSSFrameType;
|
|
|
|
|
|
|
|
#define NS_CSS_FRAME_TYPE_UNKNOWN 0
|
|
|
|
#define NS_CSS_FRAME_TYPE_INLINE 1
|
|
|
|
#define NS_CSS_FRAME_TYPE_BLOCK 2 /* block-level in normal flow */
|
|
|
|
#define NS_CSS_FRAME_TYPE_FLOATING 3
|
|
|
|
#define NS_CSS_FRAME_TYPE_ABSOLUTE 4
|
|
|
|
#define NS_CSS_FRAME_TYPE_INTERNAL_TABLE 5 /* row group frame, row frame, cell frame, ... */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Bit-flag that indicates whether the element is replaced. Applies to inline,
|
|
|
|
* block-level, floating, and absolutely positioned elements
|
|
|
|
*/
|
|
|
|
#define NS_CSS_FRAME_TYPE_REPLACED 0x8000
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper macros for telling whether items are replaced
|
|
|
|
*/
|
|
|
|
#define NS_FRAME_IS_REPLACED(_ft) \
|
|
|
|
(NS_CSS_FRAME_TYPE_REPLACED == ((_ft) & NS_CSS_FRAME_TYPE_REPLACED))
|
|
|
|
|
|
|
|
#define NS_FRAME_REPLACED(_ft) \
|
|
|
|
(NS_CSS_FRAME_TYPE_REPLACED | (_ft))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A macro to extract the type. Masks off the 'replaced' bit-flag
|
|
|
|
*/
|
|
|
|
#define NS_FRAME_GET_TYPE(_ft) \
|
|
|
|
((_ft) & ~NS_CSS_FRAME_TYPE_REPLACED)
|
|
|
|
|
2000-01-03 07:32:13 +03:00
|
|
|
#define NS_INTRINSICSIZE NS_UNCONSTRAINEDSIZE
|
|
|
|
#define NS_SHRINKWRAPWIDTH NS_UNCONSTRAINEDSIZE
|
|
|
|
#define NS_AUTOHEIGHT NS_UNCONSTRAINEDSIZE
|
|
|
|
#define NS_AUTOMARGIN NS_UNCONSTRAINEDSIZE
|
2000-04-16 08:07:02 +04:00
|
|
|
#define NS_AUTOOFFSET NS_UNCONSTRAINEDSIZE
|
2001-03-06 08:56:19 +03:00
|
|
|
// NOTE: there are assumptions all over that these have the same value, namely NS_UNCONSTRAINEDSIZE
|
|
|
|
// if any are changed to be a value other than NS_UNCONSTRAINEDSIZE
|
|
|
|
// at least update AdjustComputedHeight/Width and test ad nauseum
|
1999-10-30 20:16:45 +04:00
|
|
|
|
|
|
|
/**
|
2000-01-03 07:32:13 +03:00
|
|
|
* Reflow state passed to a frame during reflow.
|
1999-10-30 20:16:45 +04:00
|
|
|
*
|
2000-01-03 07:32:13 +03:00
|
|
|
* @see nsIFrame#Reflow()
|
1999-10-30 20:16:45 +04:00
|
|
|
*/
|
|
|
|
struct nsHTMLReflowState {
|
2000-01-03 07:32:13 +03:00
|
|
|
// the reflow states are linked together. this is the pointer to the
|
|
|
|
// parent's reflow state
|
1999-10-30 20:16:45 +04:00
|
|
|
const nsHTMLReflowState* parentReflowState;
|
|
|
|
|
|
|
|
// the frame being reflowed
|
2000-01-03 07:32:13 +03:00
|
|
|
nsIFrame* frame;
|
1999-10-30 20:16:45 +04:00
|
|
|
|
|
|
|
// the reason for the reflow
|
2000-01-03 07:32:13 +03:00
|
|
|
nsReflowReason reason;
|
|
|
|
|
2002-05-10 22:22:41 +04:00
|
|
|
// the incremental reflow path, when the reflow reason is
|
|
|
|
// eReflowReason_Incremental. Specifically, this corresponds to the
|
|
|
|
// portion of the incremental reflow path from `frame' down. Note
|
|
|
|
// that it is safe to assume that this is non-null: we maintain the
|
|
|
|
// invariant that it contains a valid nsReflowPath pointer when
|
|
|
|
// reason == eReflowReason_Incremental.
|
|
|
|
nsReflowPath *path;
|
2000-01-03 07:32:13 +03:00
|
|
|
|
|
|
|
// the available space in which to reflow the frame. The space represents the
|
|
|
|
// amount of room for the frame's border, padding, and content area (not the
|
|
|
|
// margin area. The parent frame deals with the child frame's margins). The
|
|
|
|
// frame size you choose should fit within the available space.
|
|
|
|
// A value of NS_UNCONSTRAINEDSIZE for the available height means you can
|
|
|
|
// choose whatever size you want. In galley mode the available height is always
|
|
|
|
// NS_UNCONSTRAINEDSIZE, and only page mode involves a constrained height
|
1999-10-30 20:16:45 +04:00
|
|
|
nscoord availableWidth, availableHeight;
|
|
|
|
|
|
|
|
// rendering context to use for measurement
|
|
|
|
nsIRenderingContext* rendContext;
|
|
|
|
|
|
|
|
// The type of frame, from css's perspective. This value is
|
|
|
|
// initialized by the Init method below.
|
|
|
|
nsCSSFrameType mFrameType;
|
|
|
|
|
2000-01-03 07:32:13 +03:00
|
|
|
// pointer to the space manager associated with this area
|
2001-10-26 09:06:07 +04:00
|
|
|
nsSpaceManager* mSpaceManager;
|
1999-10-30 20:16:45 +04:00
|
|
|
|
|
|
|
// LineLayout object (only for inline reflow; set to NULL otherwise)
|
|
|
|
nsLineLayout* mLineLayout;
|
|
|
|
|
2002-05-14 16:59:55 +04:00
|
|
|
// The appropriate reflow state for the containing block (for
|
|
|
|
// percentage widths, etc.) of any *children* of this reflow state's
|
|
|
|
// frame. In other words, this is the nearest containing block reflow
|
|
|
|
// state that is *either* this frame or an ancestor thereof.
|
|
|
|
const nsHTMLReflowState *mCBReflowState;
|
|
|
|
|
2000-01-03 07:32:13 +03:00
|
|
|
// The computed width specifies the frame's content area width, and it does
|
|
|
|
// not apply to inline non-replaced elements
|
1999-10-30 20:16:45 +04:00
|
|
|
//
|
|
|
|
// For replaced inline frames, a value of NS_INTRINSICSIZE means you should
|
|
|
|
// use your intrinsic width as the computed width
|
|
|
|
//
|
|
|
|
// For block-level frames, the computed width is based on the width of the
|
2000-01-03 07:32:13 +03:00
|
|
|
// containing block, the margin/border/padding areas, and the min/max width.
|
|
|
|
// A value of NS_SHRINKWRAPWIDTH means that you should choose a width based
|
|
|
|
// on your content. The width may be as large as the specified maximum width
|
|
|
|
// (see mComputedMaxWidth).
|
1999-10-30 20:16:45 +04:00
|
|
|
nscoord mComputedWidth;
|
|
|
|
|
|
|
|
// The computed height specifies the frame's content height, and it does
|
|
|
|
// not apply to inline non-replaced elements
|
|
|
|
//
|
|
|
|
// For replaced inline frames, a value of NS_INTRINSICSIZE means you should
|
|
|
|
// use your intrinsic height as the computed height
|
|
|
|
//
|
|
|
|
// For non-replaced block-level frames in the flow and floated, a value of
|
|
|
|
// NS_AUTOHEIGHT means you choose a height to shrink wrap around the normal
|
|
|
|
// flow child frames. The height must be within the limit of the min/max
|
|
|
|
// height if there is such a limit
|
|
|
|
//
|
|
|
|
// For replaced block-level frames, a value of NS_INTRINSICSIZE
|
|
|
|
// means you use your intrinsic height as the computed height
|
|
|
|
nscoord mComputedHeight;
|
|
|
|
|
|
|
|
// Computed margin values
|
|
|
|
nsMargin mComputedMargin;
|
|
|
|
|
|
|
|
// Cached copy of the border values
|
|
|
|
nsMargin mComputedBorderPadding;
|
|
|
|
|
|
|
|
// Computed padding values
|
|
|
|
nsMargin mComputedPadding;
|
|
|
|
|
|
|
|
// Computed values for 'left/top/right/bottom' offsets. Only applies to
|
|
|
|
// 'positioned' elements
|
|
|
|
nsMargin mComputedOffsets;
|
|
|
|
|
|
|
|
// Computed values for 'min-width/max-width' and 'min-height/max-height'
|
|
|
|
nscoord mComputedMinWidth, mComputedMaxWidth;
|
|
|
|
nscoord mComputedMinHeight, mComputedMaxHeight;
|
|
|
|
|
|
|
|
// Compact margin available space
|
|
|
|
nscoord mCompactMarginWidth;
|
|
|
|
|
|
|
|
// Cached pointers to the various style structs used during intialization
|
2001-12-07 17:51:12 +03:00
|
|
|
const nsStyleDisplay* mStyleDisplay;
|
2001-06-01 02:19:43 +04:00
|
|
|
const nsStyleVisibility* mStyleVisibility;
|
2001-12-07 17:51:12 +03:00
|
|
|
const nsStylePosition* mStylePosition;
|
|
|
|
const nsStyleBorder* mStyleBorder;
|
|
|
|
const nsStyleMargin* mStyleMargin;
|
|
|
|
const nsStylePadding* mStylePadding;
|
|
|
|
const nsStyleText* mStyleText;
|
|
|
|
|
|
|
|
// a frame (e.g. nsTableCellFrame) which may need to generate a special
|
|
|
|
// reflow for percent height calculations
|
|
|
|
nsIPercentHeightObserver* mPercentHeightObserver;
|
1999-10-30 20:16:45 +04:00
|
|
|
|
2002-04-01 10:46:17 +04:00
|
|
|
// a frame (e.g. nsTableFrame) which initiates a special reflow for percent height calculations
|
|
|
|
nsIFrame* mPercentHeightReflowInitiator;
|
|
|
|
|
1999-10-30 20:16:45 +04:00
|
|
|
// This value keeps track of how deeply nested a given reflow state
|
|
|
|
// is from the top of the frame tree.
|
2001-11-05 03:15:51 +03:00
|
|
|
PRInt16 mReflowDepth;
|
|
|
|
|
|
|
|
struct ReflowStateFlags {
|
2001-12-07 17:51:12 +03:00
|
|
|
PRUint16 mSpecialHeightReflow:1; // used by tables to communicate special reflow (in process) to handle
|
|
|
|
// percent height frames inside cells which may not have computed heights
|
2003-01-19 23:07:39 +03:00
|
|
|
PRUint16 mTableDerivedComputedWidth:1; // Computed width is due to a table cell's final width, not style
|
|
|
|
// on the frame itself. Restrictions apply.
|
2001-12-07 17:51:12 +03:00
|
|
|
PRUint16 mIsTopOfPage:1; // is the current context at the top of a page?
|
|
|
|
PRUint16 mBlinks:1; // Keep track of text-decoration: blink
|
2002-07-10 04:52:17 +04:00
|
|
|
PRUint16 mVisualBidiFormControl:1; // Keep track of descendants of form controls on Visual Bidi pages
|
2003-01-19 23:07:39 +03:00
|
|
|
PRUint16 mUnused:11; // for future use
|
2001-11-05 03:15:51 +03:00
|
|
|
} mFlags;
|
1999-10-30 20:16:45 +04:00
|
|
|
|
2001-03-09 06:13:03 +03:00
|
|
|
#ifdef IBMBIDI
|
|
|
|
nscoord mRightEdge;
|
|
|
|
#endif
|
|
|
|
|
2001-01-25 18:55:51 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
// hook for attaching debug info (e.g. tables may attach a timer during reflow)
|
|
|
|
void* mDebugHook;
|
2001-09-06 00:27:19 +04:00
|
|
|
|
|
|
|
static const char* ReasonToString(nsReflowReason aReason);
|
2001-01-25 18:55:51 +03:00
|
|
|
#endif
|
|
|
|
|
2002-05-15 23:58:20 +04:00
|
|
|
// A simple copy constructor. (It fixes up |mCBReflowState|, which
|
|
|
|
// can point to |this|, to point to the copy's |this|.)
|
|
|
|
nsHTMLReflowState(const nsHTMLReflowState& aOther);
|
|
|
|
|
|
|
|
// A simple assignment operator. It does the same fixups as the
|
|
|
|
// copy-consturctor.
|
|
|
|
nsHTMLReflowState& operator=(const nsHTMLReflowState& aOther);
|
1999-10-30 20:16:45 +04:00
|
|
|
|
|
|
|
// Initialize a <b>root</b> reflow state with a rendering context to
|
|
|
|
// use for measuring things.
|
1999-11-24 09:03:41 +03:00
|
|
|
nsHTMLReflowState(nsIPresContext* aPresContext,
|
1999-10-30 20:16:45 +04:00
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsReflowReason aReason,
|
|
|
|
nsIRenderingContext* aRenderingContext,
|
|
|
|
const nsSize& aAvailableSpace);
|
|
|
|
|
|
|
|
// Initialize a <b>root</b> reflow state for an <b>incremental</b>
|
|
|
|
// reflow.
|
1999-11-24 09:03:41 +03:00
|
|
|
nsHTMLReflowState(nsIPresContext* aPresContext,
|
1999-10-30 20:16:45 +04:00
|
|
|
nsIFrame* aFrame,
|
2002-05-10 22:22:41 +04:00
|
|
|
nsReflowPath* aReflowPath,
|
1999-10-30 20:16:45 +04:00
|
|
|
nsIRenderingContext* aRenderingContext,
|
|
|
|
const nsSize& aAvailableSpace);
|
|
|
|
|
|
|
|
// Initialize a reflow state for a child frames reflow. Some state
|
|
|
|
// is copied from the parent reflow state; the remaining state is
|
2002-02-19 18:48:28 +03:00
|
|
|
// computed.
|
1999-11-24 09:03:41 +03:00
|
|
|
nsHTMLReflowState(nsIPresContext* aPresContext,
|
1999-10-30 20:16:45 +04:00
|
|
|
const nsHTMLReflowState& aParentReflowState,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
const nsSize& aAvailableSpace,
|
2002-02-19 18:48:28 +03:00
|
|
|
nsReflowReason aReason,
|
|
|
|
PRBool aInit = PR_TRUE);
|
1999-10-30 20:16:45 +04:00
|
|
|
|
|
|
|
// Same as the previous except that the reason is taken from the
|
|
|
|
// parent's reflow state.
|
1999-11-24 09:03:41 +03:00
|
|
|
nsHTMLReflowState(nsIPresContext* aPresContext,
|
1999-10-30 20:16:45 +04:00
|
|
|
const nsHTMLReflowState& aParentReflowState,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
const nsSize& aAvailableSpace);
|
|
|
|
|
|
|
|
// Used when you want to override the default containing block
|
|
|
|
// width and height. Used by absolute positioning code
|
1999-11-24 09:03:41 +03:00
|
|
|
nsHTMLReflowState(nsIPresContext* aPresContext,
|
1999-10-30 20:16:45 +04:00
|
|
|
const nsHTMLReflowState& aParentReflowState,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
const nsSize& aAvailableSpace,
|
|
|
|
nscoord aContainingBlockWidth,
|
2002-05-10 22:22:41 +04:00
|
|
|
nscoord aContainingBlockHeight,
|
|
|
|
nsReflowReason aReason);
|
1999-10-30 20:16:45 +04:00
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
// This method initializes various data members. It is automatically
|
|
|
|
// called by the various constructors
|
|
|
|
void Init(nsIPresContext* aPresContext,
|
|
|
|
nscoord aContainingBlockWidth = -1,
|
|
|
|
nscoord aContainingBlockHeight = -1,
|
|
|
|
nsMargin* aBorder = nsnull,
|
|
|
|
nsMargin* aPadding = nsnull);
|
1999-10-30 20:16:45 +04:00
|
|
|
/**
|
|
|
|
* First find the containing block's reflow state using
|
|
|
|
* GetContainingBlockReflowState, then ask the containing block for
|
|
|
|
* it's content width using GetContentWidth
|
|
|
|
*/
|
|
|
|
static nscoord
|
|
|
|
GetContainingBlockContentWidth(const nsHTMLReflowState* aParentRS);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the page box reflow state, starting from a frames
|
|
|
|
* <B>parent</B> reflow state (the parent reflow state may or may not end
|
|
|
|
* up being the containing block reflow state)
|
|
|
|
*/
|
|
|
|
static const nsHTMLReflowState*
|
|
|
|
GetPageBoxReflowState(const nsHTMLReflowState* aParentRS);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compute the border plus padding for <TT>aFrame</TT>. If a
|
|
|
|
* percentage needs to be computed it will be computed by finding
|
|
|
|
* the containing block, use GetContainingBlockReflowState.
|
|
|
|
* aParentReflowState is aFrame's
|
|
|
|
* parent's reflow state. The resulting computed border plus padding
|
|
|
|
* is returned in aResult.
|
|
|
|
*/
|
|
|
|
static void ComputeBorderPaddingFor(nsIFrame* aFrame,
|
|
|
|
const nsHTMLReflowState* aParentRS,
|
|
|
|
nsMargin& aResult);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Calculate the raw line-height property for the given frame. The return
|
|
|
|
* value, if line-height was applied and is valid will be >= 0. Otherwise,
|
|
|
|
* the return value will be <0 which is illegal (CSS2 spec: section 10.8.1).
|
|
|
|
*/
|
1999-11-24 09:03:41 +03:00
|
|
|
static nscoord CalcLineHeight(nsIPresContext* aPresContext,
|
1999-10-30 20:16:45 +04:00
|
|
|
nsIRenderingContext* aRenderingContext,
|
|
|
|
nsIFrame* aFrame);
|
|
|
|
|
|
|
|
static PRBool UseComputedHeight();
|
|
|
|
|
|
|
|
static nsCSSFrameType DetermineFrameType(nsIFrame* aFrame);
|
|
|
|
|
2000-04-29 01:05:31 +04:00
|
|
|
void ComputeContainingBlockRectangle(nsIPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState* aContainingBlockRS,
|
|
|
|
nscoord& aContainingBlockWidth,
|
|
|
|
nscoord& aContainingBlockHeight);
|
|
|
|
|
2000-05-05 03:16:42 +04:00
|
|
|
void CalculateBlockSideMargins(nscoord aAvailWidth,
|
|
|
|
nscoord aComputedWidth);
|
2000-04-29 01:05:31 +04:00
|
|
|
|
1999-10-30 20:16:45 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2002-05-14 16:59:55 +04:00
|
|
|
void InitCBReflowState();
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
void InitConstraints(nsIPresContext* aPresContext,
|
1999-10-30 20:16:45 +04:00
|
|
|
nscoord aContainingBlockWidth,
|
2002-02-19 18:48:28 +03:00
|
|
|
nscoord aContainingBlockHeight,
|
|
|
|
nsMargin* aBorder,
|
|
|
|
nsMargin* aPadding);
|
1999-10-30 20:16:45 +04:00
|
|
|
|
2000-04-16 08:07:02 +04:00
|
|
|
void CalculateHypotheticalBox(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aPlaceholderFrame,
|
|
|
|
nsIFrame* aBlockFrame,
|
|
|
|
nsMargin& aBlockContentArea,
|
|
|
|
nsIFrame* aAbsoluteContainingBlockFrame,
|
|
|
|
nsHypotheticalBox& aHypotheticalBox);
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
void InitAbsoluteConstraints(nsIPresContext* aPresContext,
|
1999-10-30 20:16:45 +04:00
|
|
|
const nsHTMLReflowState* cbrs,
|
|
|
|
nscoord aContainingBlockWidth,
|
|
|
|
nscoord aContainingBlockHeight);
|
|
|
|
|
|
|
|
void ComputeRelativeOffsets(const nsHTMLReflowState* cbrs,
|
|
|
|
nscoord aContainingBlockWidth,
|
|
|
|
nscoord aContainingBlockHeight);
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
void ComputeBlockBoxData(nsIPresContext* aPresContext,
|
1999-10-30 20:16:45 +04:00
|
|
|
const nsHTMLReflowState* cbrs,
|
|
|
|
nsStyleUnit aWidthUnit,
|
|
|
|
nsStyleUnit aHeightUnit,
|
|
|
|
nscoord aContainingBlockWidth,
|
|
|
|
nscoord aContainingBlockHeight);
|
|
|
|
|
|
|
|
void ComputeHorizontalValue(nscoord aContainingBlockWidth,
|
|
|
|
nsStyleUnit aUnit,
|
|
|
|
const nsStyleCoord& aCoord,
|
|
|
|
nscoord& aResult);
|
|
|
|
|
|
|
|
void ComputeVerticalValue(nscoord aContainingBlockHeight,
|
|
|
|
nsStyleUnit aUnit,
|
|
|
|
const nsStyleCoord& aCoord,
|
|
|
|
nscoord& aResult);
|
|
|
|
|
|
|
|
static nsCSSFrameType DetermineFrameType(nsIFrame* aFrame,
|
|
|
|
const nsStyleDisplay* aDisplay);
|
|
|
|
|
|
|
|
// Computes margin values from the specified margin style information, and
|
|
|
|
// fills in the mComputedMargin member
|
|
|
|
void ComputeMargin(nscoord aContainingBlockWidth,
|
|
|
|
const nsHTMLReflowState* aContainingBlockRS);
|
|
|
|
|
|
|
|
// Computes padding values from the specified padding style information, and
|
|
|
|
// fills in the mComputedPadding member
|
|
|
|
void ComputePadding(nscoord aContainingBlockWidth,
|
|
|
|
const nsHTMLReflowState* aContainingBlockRS);
|
|
|
|
|
|
|
|
// Calculates the computed values for the 'min-Width', 'max-Width',
|
|
|
|
// 'min-Height', and 'max-Height' properties, and stores them in the assorted
|
|
|
|
// data members
|
|
|
|
void ComputeMinMaxValues(nscoord aContainingBlockWidth,
|
|
|
|
nscoord aContainingBlockHeight,
|
|
|
|
const nsHTMLReflowState* aContainingBlockRS);
|
|
|
|
|
2000-04-16 08:07:02 +04:00
|
|
|
nscoord CalculateHorizBorderPaddingMargin(nscoord aContainingBlockWidth);
|
2001-03-06 08:56:19 +03:00
|
|
|
|
|
|
|
// Adjust Computed sizes for Min/Max Width and box-Sizing
|
|
|
|
// - guarantees that the computed height/width will be non-negative
|
|
|
|
// If the value goes negative (because the padding or border is greater than
|
|
|
|
// the width/height and it is removed due to box sizing) then it is driven to 0
|
|
|
|
void AdjustComputedHeight(void);
|
|
|
|
void AdjustComputedWidth(void);
|
2002-07-10 04:52:17 +04:00
|
|
|
|
|
|
|
#ifdef IBMBIDI
|
|
|
|
/**
|
|
|
|
* Test whether the frame is a form control in a visual Bidi page.
|
|
|
|
* This is necessary for backwards-compatibility, because most visual
|
|
|
|
* pages use logical order for form controls so that they will
|
|
|
|
* display correctly on native widgets in OSs with Bidi support
|
|
|
|
* @param aPresContext the pres context
|
|
|
|
* @return whether the frame is a BIDI form control
|
|
|
|
*/
|
|
|
|
PRBool IsBidiFormControl(nsIPresContext* aPresContext);
|
|
|
|
#endif
|
1999-10-30 20:16:45 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsHTMLReflowState_h___ */
|
|
|
|
|