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
|
1998-04-14 00:24:54 +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/
|
1998-04-14 00:24:54 +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.
|
1998-04-14 00:24:54 +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 ***** */
|
1998-04-14 00:24:54 +04:00
|
|
|
#ifndef nsTableFrame_h__
|
|
|
|
#define nsTableFrame_h__
|
|
|
|
|
|
|
|
#include "nscore.h"
|
1998-12-17 01:19:23 +03:00
|
|
|
#include "nsVoidArray.h"
|
1998-10-20 21:45:07 +04:00
|
|
|
#include "nsHTMLContainerFrame.h"
|
1998-06-05 10:09:09 +04:00
|
|
|
#include "nsStyleCoord.h"
|
1998-10-11 13:18:27 +04:00
|
|
|
#include "nsStyleConsts.h"
|
1998-12-18 01:59:40 +03:00
|
|
|
#include "nsIStyleContext.h"
|
1999-08-01 02:11:50 +04:00
|
|
|
#include "nsITableLayout.h"
|
1999-12-14 03:24:33 +03:00
|
|
|
#include "nsTableColFrame.h"
|
|
|
|
#include "nsTableColGroupFrame.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2002-03-05 18:23:28 +03:00
|
|
|
class nsCellMap;
|
2000-01-13 08:29:38 +03:00
|
|
|
class nsTableCellMap;
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsTableCellFrame;
|
1998-06-05 06:36:25 +04:00
|
|
|
class nsTableColFrame;
|
1998-07-02 02:22:28 +04:00
|
|
|
class nsTableRowGroupFrame;
|
1998-06-17 20:38:24 +04:00
|
|
|
class nsTableRowFrame;
|
1998-10-15 02:51:50 +04:00
|
|
|
class nsTableColGroupFrame;
|
1998-04-30 21:57:09 +04:00
|
|
|
class nsITableLayoutStrategy;
|
1998-05-27 00:57:24 +04:00
|
|
|
class nsHTMLValue;
|
1999-10-28 08:09:39 +04:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
struct nsTableReflowState;
|
1998-04-25 22:48:48 +04:00
|
|
|
struct nsStylePosition;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2001-11-01 18:31:13 +03:00
|
|
|
enum nsPixelRound {eAlwaysRoundUp=0, eAlwaysRoundDown, eRoundUpIfHalfOrMore};
|
|
|
|
|
2002-02-26 03:27:42 +03:00
|
|
|
// flags for Paint, PaintChild, PaintChildren are currently only used by tables.
|
|
|
|
// use low order bit of flags to distinguish between pass1(0) and pass2(1) border collapse backgrounds
|
|
|
|
#define BORDER_COLLAPSE_BACKGROUNDS 0x00000001
|
|
|
|
|
2001-01-25 18:55:51 +03:00
|
|
|
#ifdef DEBUG_TABLE_REFLOW_TIMING
|
|
|
|
#ifdef WIN32
|
|
|
|
#include <windows.h>
|
|
|
|
#endif
|
|
|
|
class nsReflowTimer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsReflowTimer(nsIFrame* aFrame) {
|
|
|
|
mFrame = aFrame;
|
2001-02-01 05:29:14 +03:00
|
|
|
mNextSibling = nsnull;
|
2001-01-25 18:55:51 +03:00
|
|
|
aFrame->GetFrameType(&mFrameType);
|
2001-03-13 09:38:59 +03:00
|
|
|
mReflowType = -1;
|
2001-01-25 18:55:51 +03:00
|
|
|
Reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Destroy() {
|
|
|
|
PRInt32 numChildren = mChildren.Count();
|
|
|
|
for (PRInt32 childX = 0; childX < numChildren; childX++) {
|
|
|
|
((nsReflowTimer*)mChildren.ElementAt(childX))->Destroy();
|
|
|
|
}
|
|
|
|
NS_IF_RELEASE(mFrameType);
|
2001-02-01 05:29:14 +03:00
|
|
|
if (mNextSibling) { // table frames have 3 auxillary timers
|
|
|
|
delete mNextSibling->mNextSibling->mNextSibling;
|
|
|
|
delete mNextSibling->mNextSibling;
|
|
|
|
delete mNextSibling;
|
|
|
|
}
|
2001-01-25 18:55:51 +03:00
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Print(PRUint32 aIndent,
|
|
|
|
char* aHeader = 0) {
|
|
|
|
if (aHeader) {
|
|
|
|
printf("%s", aHeader);
|
|
|
|
}
|
|
|
|
printf(" elapsed=%d numStarts=%d \n", Elapsed(), mNumStarts);
|
|
|
|
}
|
|
|
|
|
|
|
|
PRUint32 Elapsed() {
|
|
|
|
return mTotalTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Reset() {
|
|
|
|
mTotalTime = mNumStarts = 0;
|
|
|
|
mStarted = PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Start() {
|
|
|
|
NS_ASSERTION(!mStarted, "started timer without stopping");
|
|
|
|
#ifdef WIN32
|
|
|
|
mStartTime = GetTickCount();
|
|
|
|
#else
|
|
|
|
mStartTime = 0;
|
|
|
|
#endif
|
|
|
|
mStarted = PR_TRUE;
|
|
|
|
mNumStarts++;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Stop() {
|
|
|
|
NS_ASSERTION(mStarted, "stopped timer without starting");
|
|
|
|
mTotalTime += GetTickCount() - mStartTime;
|
|
|
|
mStarted = PR_FALSE;
|
|
|
|
}
|
|
|
|
PRUint32 mTotalTime;
|
|
|
|
PRUint32 mStartTime;
|
|
|
|
PRUint32 mNumStarts;
|
|
|
|
PRBool mStarted;
|
|
|
|
const nsIFrame* mFrame;
|
|
|
|
nsIAtom* mFrameType; // needed for frame summary timer
|
|
|
|
nsReflowReason mReason;
|
|
|
|
nsVoidArray mChildren;
|
|
|
|
PRInt32 mCount;
|
|
|
|
// reflow state/reflow metrics data
|
|
|
|
nscoord mAvailWidth;
|
|
|
|
nscoord mComputedWidth;
|
|
|
|
nscoord mComputedHeight;
|
|
|
|
nscoord mMaxElementWidth;
|
|
|
|
nscoord mMaxWidth; // preferred width
|
|
|
|
nscoord mDesiredWidth;
|
|
|
|
nscoord mDesiredHeight;
|
|
|
|
nsReflowStatus mStatus;
|
2001-02-01 05:29:14 +03:00
|
|
|
nsReflowTimer* mNextSibling;
|
2001-03-13 09:38:59 +03:00
|
|
|
PRInt32 mReflowType;
|
2001-01-25 18:55:51 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
~nsReflowTimer() {}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
1998-12-03 21:01:35 +03:00
|
|
|
/**
|
|
|
|
* Child list name indices
|
|
|
|
* @see #GetAdditionalChildListName()
|
|
|
|
*/
|
|
|
|
#define NS_TABLE_FRAME_COLGROUP_LIST_INDEX 0
|
|
|
|
#define NS_TABLE_FRAME_LAST_LIST_INDEX NS_TABLE_FRAME_COLGROUP_LIST_INDEX
|
|
|
|
|
1998-07-07 01:00:11 +04:00
|
|
|
/* ============================================================================ */
|
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** nsTableFrame maps the inner portion of a table (everything except captions.)
|
1998-12-04 06:14:28 +03:00
|
|
|
* Used as a pseudo-frame within nsTableOuterFrame, it may also be used
|
|
|
|
* stand-alone as the top-level frame.
|
|
|
|
*
|
1999-01-27 22:29:24 +03:00
|
|
|
* The flowed child list contains row group frames. There is also an additional
|
1998-12-04 06:14:28 +03:00
|
|
|
* named child list:
|
|
|
|
* - "ColGroup-list" which contains the col group frames
|
1998-04-15 01:45:28 +04:00
|
|
|
*
|
1998-12-09 08:30:17 +03:00
|
|
|
* @see nsLayoutAtoms::colGroupList
|
1998-04-15 01:45:28 +04:00
|
|
|
*
|
|
|
|
* TODO: make methods virtual so nsTableFrame can be used as a base class in the future.
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
1999-08-01 02:11:50 +04:00
|
|
|
class nsTableFrame : public nsHTMLContainerFrame, public nsITableLayout
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
1999-08-01 02:11:50 +04:00
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** nsTableOuterFrame has intimate knowledge of the inner table frame */
|
1998-04-14 00:24:54 +04:00
|
|
|
friend class nsTableOuterFrame;
|
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** instantiate a new instance of nsTableFrame.
|
1998-09-15 21:58:24 +04:00
|
|
|
* @param aResult the new object is returned in this out-param
|
|
|
|
* @param aContent the table object to map
|
|
|
|
* @param aParent the parent of the new frame
|
1998-04-15 01:45:28 +04:00
|
|
|
*
|
|
|
|
* @return NS_OK if the frame was properly allocated, otherwise an error code
|
|
|
|
*/
|
1998-09-15 21:58:24 +04:00
|
|
|
friend nsresult
|
1999-12-05 02:49:50 +03:00
|
|
|
NS_NewTableFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1999-01-27 22:29:24 +03:00
|
|
|
/** sets defaults for table-specific style.
|
|
|
|
* @see nsIFrame::Init
|
|
|
|
*/
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
1998-12-05 08:27:21 +03:00
|
|
|
nsIContent* aContent,
|
1999-01-14 08:16:23 +03:00
|
|
|
nsIFrame* aParent,
|
1999-02-25 06:27:57 +03:00
|
|
|
nsIStyleContext* aContext,
|
|
|
|
nsIFrame* aPrevInFlow);
|
1998-12-05 08:27:21 +03:00
|
|
|
|
|
|
|
|
2001-11-29 18:41:07 +03:00
|
|
|
static void* GetProperty(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsIAtom* aPropertyName,
|
|
|
|
PRBool aCreateIfNecessary = PR_FALSE);
|
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
static float GetTwipsToPixels(nsIPresContext* aPresContext);
|
|
|
|
|
2001-11-01 18:31:13 +03:00
|
|
|
static nscoord RoundToPixel(nscoord aValue,
|
|
|
|
float aPixelToTwips,
|
|
|
|
nsPixelRound aRound= eAlwaysRoundUp);
|
2000-09-01 05:29:50 +04:00
|
|
|
|
2002-04-01 10:46:17 +04:00
|
|
|
// See if a special height reflow will occur due to having a pct height when
|
|
|
|
// the pct height basis may not yet be valid.
|
|
|
|
static void CheckRequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState);
|
|
|
|
|
|
|
|
// Notify the frame and its ancestors (up to the containing table) that a special
|
|
|
|
// height reflow will occur.
|
|
|
|
static void RequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState);
|
|
|
|
|
|
|
|
// Return true (and set aMetrics's desiredSize to aRect) if the special height reflow
|
|
|
|
// was not initiated by aReflowState.frame's containing table.
|
|
|
|
static PRBool IsPrematureSpecialHeightReflow(const nsHTMLReflowState& aReflowState,
|
|
|
|
const nsRect& aRect,
|
|
|
|
PRBool aNeedSpecialHeightReflow,
|
|
|
|
nsHTMLReflowMetrics& aMetrics);
|
2001-11-05 03:15:51 +03:00
|
|
|
|
2000-02-12 04:55:40 +03:00
|
|
|
NS_IMETHOD IsPercentageBase(PRBool& aBase) const;
|
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
static nsresult AppendDirtyReflowCommand(nsIPresShell* aPresShell,
|
|
|
|
nsIFrame* aFrame);
|
|
|
|
static nsIPresShell* GetPresShellNoAddref(nsIPresContext* aPresContext);
|
|
|
|
|
|
|
|
static void RePositionViews(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame);
|
|
|
|
|
2002-03-18 00:35:08 +03:00
|
|
|
static PRBool PageBreakAfter(nsIFrame& aSourceFrame,
|
|
|
|
nsIFrame* aNextFrame);
|
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
nsPoint GetFirstSectionOrigin(const nsHTMLReflowState& aReflowState) const;
|
2000-01-04 08:31:56 +03:00
|
|
|
/*
|
|
|
|
* Notification that aAttribute has changed for content inside a table (cell, row, etc)
|
|
|
|
*/
|
|
|
|
void AttributeChangedFor(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsIContent* aContent,
|
|
|
|
nsIAtom* aAttribute);
|
|
|
|
|
1999-07-22 06:24:52 +04:00
|
|
|
/** @see nsIFrame::Destroy */
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Destroy(nsIPresContext* aPresContext);
|
1998-12-04 06:14:28 +03:00
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD AppendFrames(nsIPresContext* aPresContext,
|
1999-08-19 07:51:25 +04:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList);
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD InsertFrames(nsIPresContext* aPresContext,
|
1999-08-19 07:51:25 +04:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList);
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext,
|
1999-08-19 07:51:25 +04:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame);
|
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
// Get the offset from the border box to the area where the row groups fit
|
|
|
|
nsMargin GetChildAreaOffset(nsIPresContext& aPresContext,
|
|
|
|
const nsHTMLReflowState* aReflowState) const;
|
|
|
|
|
|
|
|
// Get the offset from the border box to the area where the content fits
|
|
|
|
nsMargin GetContentAreaOffset(nsIPresContext& aPresContext,
|
|
|
|
const nsHTMLReflowState* aReflowState) const;
|
2001-03-13 09:38:59 +03:00
|
|
|
|
1998-09-24 20:37:22 +04:00
|
|
|
/** helper method to find the table parent of any table frame object */
|
1999-01-27 22:29:24 +03:00
|
|
|
// TODO: today, this depends on display types. This should be changed to rely
|
|
|
|
// on stronger criteria, like an inner table frame atom
|
1999-12-14 01:56:31 +03:00
|
|
|
static NS_METHOD GetTableFrame(nsIFrame* aSourceFrame,
|
|
|
|
nsTableFrame*& aTableFrame);
|
|
|
|
|
|
|
|
// Return the closest sibling of aPriorChildFrame (including aPriroChildFrame)
|
|
|
|
// of type aChildType.
|
2000-01-22 04:16:50 +03:00
|
|
|
static nsIFrame* GetFrameAtOrBefore(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aParentFrame,
|
|
|
|
nsIFrame* aPriorChildFrame,
|
|
|
|
nsIAtom* aChildType);
|
2001-03-13 09:38:59 +03:00
|
|
|
PRBool IsAutoWidth(PRBool* aIsPctWidth = nsnull);
|
2001-05-14 18:28:00 +04:00
|
|
|
PRBool IsAutoHeight();
|
2001-11-05 03:15:51 +03:00
|
|
|
static PRBool IsPctHeight(nsIStyleContext* aStyleContext);
|
1998-10-11 13:18:27 +04:00
|
|
|
|
1999-01-27 22:29:24 +03:00
|
|
|
/** @return PR_TRUE if aDisplayType represents a rowgroup of any sort
|
1998-10-11 13:18:27 +04:00
|
|
|
* (header, footer, or body)
|
|
|
|
*/
|
1998-11-20 04:01:25 +03:00
|
|
|
PRBool IsRowGroup(PRInt32 aDisplayType) const;
|
1998-06-05 06:36:25 +04:00
|
|
|
|
1999-01-27 22:29:24 +03:00
|
|
|
/** Initialize the table frame with a set of children.
|
|
|
|
* @see nsIFrame::SetInitialChildList
|
|
|
|
*/
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
|
1998-11-10 09:05:32 +03:00
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList);
|
1998-09-16 21:19:20 +04:00
|
|
|
|
1999-01-27 22:29:24 +03:00
|
|
|
/** return the first child belonging to the list aListName.
|
|
|
|
* @see nsIFrame::FirstChild
|
|
|
|
*/
|
2000-01-22 04:16:50 +03:00
|
|
|
NS_IMETHOD FirstChild(nsIPresContext* aPresContext,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame** aFirstChild) const;
|
1998-12-03 21:01:35 +03:00
|
|
|
|
1999-01-27 22:29:24 +03:00
|
|
|
/** @see nsIFrame::GetAdditionalChildListName */
|
1998-12-03 21:01:35 +03:00
|
|
|
NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex,
|
1999-02-10 05:25:01 +03:00
|
|
|
nsIAtom** aListName) const;
|
1998-12-03 21:01:35 +03:00
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** @see nsIFrame::Paint */
|
2001-09-19 16:35:19 +04:00
|
|
|
NS_IMETHOD Paint(nsIPresContext* aPresContext,
|
1998-04-17 05:41:24 +04:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
2001-09-19 16:35:19 +04:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
PRUint32 aFlags = 0);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2002-02-26 03:27:42 +03:00
|
|
|
virtual void PaintChildren(nsIPresContext* aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
PRUint32 aFlags = 0);
|
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
nsMargin* GetBCBorder(nsIPresContext& aPresContext,
|
|
|
|
PRBool aInnerBorderOnly,
|
|
|
|
nsMargin& aBorder) const;
|
|
|
|
|
|
|
|
void SetBCDamageArea(nsIPresContext& aPresContext,
|
|
|
|
const nsRect& aValue);
|
|
|
|
|
|
|
|
void PaintBCBorders(nsIPresContext* aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect);
|
|
|
|
|
2000-03-22 05:43:08 +03:00
|
|
|
NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
|
|
|
|
const nsPoint& aPoint,
|
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
nsIFrame** aFrame);
|
|
|
|
|
1999-05-20 04:52:00 +04:00
|
|
|
/** nsIFrame method overridden to handle table specifics
|
|
|
|
*/
|
1999-10-26 08:44:41 +04:00
|
|
|
NS_IMETHOD SetSelected(nsIPresContext* aPresContext,
|
|
|
|
nsIDOMRange *aRange,
|
|
|
|
PRBool aSelected,
|
|
|
|
nsSpread aSpread);
|
1999-05-20 04:52:00 +04:00
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** inner tables are reflowed in two steps.
|
|
|
|
* <pre>
|
|
|
|
* if mFirstPassValid is false, this is our first time through since content was last changed
|
|
|
|
* set pass to 1
|
|
|
|
* do pass 1
|
|
|
|
* get min/max info for all cells in an infinite space
|
|
|
|
* do column balancing
|
|
|
|
* set mFirstPassValid to true
|
|
|
|
* do pass 2
|
1998-05-25 21:31:49 +04:00
|
|
|
* use column widths to Reflow cells
|
1998-04-15 01:45:28 +04:00
|
|
|
* </pre>
|
|
|
|
*
|
|
|
|
* @see ResizeReflowPass1
|
|
|
|
* @see ResizeReflowPass2
|
|
|
|
* @see BalanceColumnWidths
|
1999-01-27 22:29:24 +03:00
|
|
|
* @see nsIFrameReflow::Reflow
|
1998-04-15 01:45:28 +04:00
|
|
|
*/
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
1998-10-21 00:05:44 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
1998-10-02 08:10:00 +04:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
1998-10-21 00:05:44 +04:00
|
|
|
nsReflowStatus& aStatus);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2001-08-08 05:13:35 +04:00
|
|
|
nsresult ReflowTable(nsIPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nscoord aAvailHeight,
|
|
|
|
nsReflowReason aReason,
|
2002-03-04 18:48:56 +03:00
|
|
|
nsIFrame*& aLastChildReflowed,
|
2001-08-08 05:13:35 +04:00
|
|
|
PRBool& aDoCollapse,
|
|
|
|
PRBool& aDidBalance,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
2000-02-12 04:55:40 +03:00
|
|
|
static nsMargin GetPadding(const nsHTMLReflowState& aReflowState,
|
|
|
|
const nsTableCellFrame* aCellFrame);
|
|
|
|
|
|
|
|
static nsMargin GetPadding(const nsSize& aBasis,
|
|
|
|
const nsTableCellFrame* aCellFrame);
|
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
nsFrameList& GetColGroups();
|
|
|
|
|
2002-03-27 05:38:13 +03:00
|
|
|
NS_IMETHOD GetParentStyleContextFrame(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame** aProviderFrame,
|
|
|
|
PRBool* aIsChild);
|
|
|
|
|
1999-02-24 08:54:31 +03:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsLayoutAtoms::tableFrame
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
|
1998-12-23 18:47:43 +03:00
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef DEBUG
|
1999-01-27 22:29:24 +03:00
|
|
|
/** @see nsIFrame::GetFrameName */
|
2001-11-14 04:33:42 +03:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
1999-08-31 07:09:40 +04:00
|
|
|
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
1999-09-01 05:02:16 +04:00
|
|
|
#endif
|
1999-08-31 07:09:40 +04:00
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** return the width of the column at aColIndex */
|
1998-05-30 02:08:19 +04:00
|
|
|
virtual PRInt32 GetColumnWidth(PRInt32 aColIndex);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** set the width of the column at aColIndex to aWidth */
|
1998-06-05 22:11:20 +04:00
|
|
|
virtual void SetColumnWidth(PRInt32 aColIndex, nscoord aWidth);
|
1998-07-17 03:23:31 +04:00
|
|
|
|
1998-12-09 09:37:18 +03:00
|
|
|
/** helper to get the cell spacing X style value */
|
|
|
|
virtual nscoord GetCellSpacingX();
|
|
|
|
|
|
|
|
/** helper to get the cell spacing Y style value */
|
|
|
|
virtual nscoord GetCellSpacingY();
|
2002-02-19 18:48:28 +03:00
|
|
|
|
1998-06-24 23:13:19 +04:00
|
|
|
/** return the row span of a cell, taking into account row span magic at the bottom
|
2000-02-01 06:23:29 +03:00
|
|
|
* of a table. The row span equals the number of rows spanned by aCell starting at
|
|
|
|
* aStartRowIndex, and can be smaller if aStartRowIndex is greater than the row
|
|
|
|
* index in which aCell originates.
|
1998-07-17 03:23:31 +04:00
|
|
|
*
|
2000-02-01 06:23:29 +03:00
|
|
|
* @param aStartRowIndex the cell
|
|
|
|
* @param aCell the cell
|
1998-07-17 03:23:31 +04:00
|
|
|
*
|
1998-06-24 23:13:19 +04:00
|
|
|
* @return the row span, correcting for row spans that extend beyond the bottom
|
|
|
|
* of the table.
|
|
|
|
*/
|
2000-02-01 06:23:29 +03:00
|
|
|
virtual PRInt32 GetEffectiveRowSpan(PRInt32 aStartRowIndex,
|
|
|
|
const nsTableCellFrame& aCell) const;
|
2002-03-05 18:23:28 +03:00
|
|
|
virtual PRInt32 GetEffectiveRowSpan(const nsTableCellFrame& aCell,
|
|
|
|
nsCellMap* aCellMap = nsnull);
|
1998-06-24 23:13:19 +04:00
|
|
|
|
1998-07-17 03:23:31 +04:00
|
|
|
/** return the col span of a cell, taking into account col span magic at the edge
|
|
|
|
* of a table.
|
|
|
|
*
|
|
|
|
* @param aCell the cell
|
|
|
|
*
|
|
|
|
* @return the col span, correcting for col spans that extend beyond the edge
|
|
|
|
* of the table.
|
|
|
|
*/
|
2002-03-05 18:23:28 +03:00
|
|
|
virtual PRInt32 GetEffectiveColSpan(const nsTableCellFrame& aCell,
|
|
|
|
nsCellMap* aCellMap = nsnull) const;
|
1998-07-17 03:23:31 +04:00
|
|
|
|
1998-07-22 07:53:43 +04:00
|
|
|
/** return the value of the COLS attribute, adjusted for the
|
|
|
|
* actual number of columns in the table
|
|
|
|
*/
|
1998-08-26 21:26:38 +04:00
|
|
|
PRInt32 GetEffectiveCOLSAttribute();
|
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
/** return the column frame associated with aColIndex */
|
|
|
|
nsTableColFrame* GetColFrame(PRInt32 aColIndex) const;
|
|
|
|
|
|
|
|
void InsertCol(nsIPresContext& aPresContext,
|
|
|
|
nsTableColFrame& aColFrame,
|
|
|
|
PRInt32 aColIndex);
|
|
|
|
|
|
|
|
nsTableColGroupFrame* CreateAnonymousColGroupFrame(nsIPresContext& aPresContext,
|
|
|
|
nsTableColGroupType aType);
|
|
|
|
|
|
|
|
PRInt32 DestroyAnonymousColFrames(nsIPresContext& aPresContext,
|
|
|
|
PRInt32 aNumFrames);
|
|
|
|
|
|
|
|
void CreateAnonymousColFrames(nsIPresContext& aPresContext,
|
|
|
|
PRInt32 aNumColsToAdd,
|
|
|
|
nsTableColType aColType,
|
|
|
|
PRBool aDoAppend,
|
|
|
|
nsIFrame* aPrevCol = nsnull);
|
|
|
|
|
|
|
|
void CreateAnonymousColFrames(nsIPresContext& aPresContext,
|
|
|
|
nsTableColGroupFrame& aColGroupFrame,
|
|
|
|
PRInt32 aNumColsToAdd,
|
|
|
|
nsTableColType aColType,
|
|
|
|
PRBool aAddToColGroupAndTable,
|
|
|
|
nsIFrame* aPrevCol,
|
|
|
|
nsIFrame** aFirstNewFrame);
|
|
|
|
|
|
|
|
/** empty the column frame cache */
|
|
|
|
void ClearColCache();
|
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
virtual void AppendCell(nsIPresContext& aPresContext,
|
|
|
|
nsTableCellFrame& aCellFrame,
|
|
|
|
PRInt32 aRowIndex);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
|
|
|
virtual void InsertCells(nsIPresContext& aPresContext,
|
|
|
|
nsVoidArray& aCellFrames,
|
|
|
|
PRInt32 aRowIndex,
|
|
|
|
PRInt32 aColIndexBefore);
|
|
|
|
|
|
|
|
virtual void RemoveCell(nsIPresContext& aPresContext,
|
|
|
|
nsTableCellFrame* aCellFrame,
|
|
|
|
PRInt32 aRowIndex);
|
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
void AppendRows(nsIPresContext& aPresContext,
|
|
|
|
nsTableRowGroupFrame& aRowGroupFrame,
|
2000-09-14 10:49:47 +04:00
|
|
|
PRInt32 aRowIndex,
|
2000-01-13 08:29:38 +03:00
|
|
|
nsVoidArray& aRowFrames);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
PRInt32 InsertRow(nsIPresContext& aPresContext,
|
|
|
|
nsTableRowGroupFrame& aRowGroupFrame,
|
|
|
|
nsIFrame& aFrame,
|
|
|
|
PRInt32 aRowIndex,
|
|
|
|
PRBool aConsiderSpans);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
PRInt32 InsertRows(nsIPresContext& aPresContext,
|
|
|
|
nsTableRowGroupFrame& aRowGroupFrame,
|
|
|
|
nsVoidArray& aFrames,
|
|
|
|
PRInt32 aRowIndex,
|
|
|
|
PRBool aConsiderSpans);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
virtual void RemoveRows(nsIPresContext& aPresContext,
|
|
|
|
nsTableRowFrame& aFirstRowFrame,
|
|
|
|
PRInt32 aNumRowsToRemove,
|
|
|
|
PRBool aConsiderSpans);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
|
|
|
void AppendRowGroups(nsIPresContext& aPresContext,
|
|
|
|
nsIFrame* aFirstRowGroupFrame);
|
|
|
|
|
|
|
|
void InsertRowGroups(nsIPresContext& aPresContext,
|
|
|
|
nsIFrame* aFirstRowGroupFrame,
|
2000-09-14 10:49:47 +04:00
|
|
|
nsIFrame* aLastRowGroupFrame);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
|
|
|
void InsertColGroups(nsIPresContext& aPresContext,
|
|
|
|
PRInt32 aColIndex,
|
|
|
|
nsIFrame* aFirstFrame,
|
|
|
|
nsIFrame* aLastFrame = nsnull);
|
|
|
|
|
|
|
|
virtual void RemoveCol(nsIPresContext& aPresContext,
|
|
|
|
nsTableColGroupFrame* aColGroupFrame,
|
|
|
|
PRInt32 aColIndex,
|
|
|
|
PRBool aRemoveFromCache,
|
|
|
|
PRBool aRemoveFromCellMap);
|
1998-09-01 01:23:28 +04:00
|
|
|
|
1999-08-19 23:52:37 +04:00
|
|
|
nsTableCellFrame* GetCellInfoAt(PRInt32 aRowX,
|
|
|
|
PRInt32 aColX,
|
|
|
|
PRBool* aOriginates = nsnull,
|
|
|
|
PRInt32* aColSpan = nsnull);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
1999-08-26 01:49:18 +04:00
|
|
|
PRInt32 GetNumCellsOriginatingInCol(PRInt32 aColIndex) const;
|
2001-11-05 03:15:51 +03:00
|
|
|
PRInt32 GetNumCellsOriginatingInRow(PRInt32 aRowIndex) const;
|
1999-07-28 12:09:02 +04:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
PRBool HasPctCol() const;
|
|
|
|
void SetHasPctCol(PRBool aValue);
|
|
|
|
|
2000-09-09 05:46:44 +04:00
|
|
|
PRBool HasCellSpanningPctCol() const;
|
|
|
|
void SetHasCellSpanningPctCol(PRBool aValue);
|
2001-11-05 03:15:51 +03:00
|
|
|
|
|
|
|
PRBool NeedSpecialReflow() const;
|
|
|
|
void SetNeedSpecialReflow(PRBool aValue);
|
2002-04-11 01:32:41 +04:00
|
|
|
|
2001-11-05 03:15:51 +03:00
|
|
|
PRBool NeedToInitiateSpecialReflow() const;
|
|
|
|
void SetNeedToInitiateSpecialReflow(PRBool aValue);
|
1999-10-04 09:19:32 +04:00
|
|
|
|
2002-04-11 01:32:41 +04:00
|
|
|
PRBool InitiatedSpecialReflow() const;
|
|
|
|
void SetInitiatedSpecialReflow(PRBool aValue);
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
protected:
|
|
|
|
|
2000-05-11 05:04:39 +04:00
|
|
|
/** protected constructor.
|
1998-04-15 01:45:28 +04:00
|
|
|
* @see NewFrame
|
|
|
|
*/
|
1998-12-03 09:31:43 +03:00
|
|
|
nsTableFrame();
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
/** destructor, responsible for mColumnLayoutData */
|
1998-04-14 00:24:54 +04:00
|
|
|
virtual ~nsTableFrame();
|
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
void InitChildReflowState(nsIPresContext& aPresContext,
|
|
|
|
nsHTMLReflowState& aReflowState);
|
|
|
|
|
1998-10-20 21:45:07 +04:00
|
|
|
/** implement abstract method on nsHTMLContainerFrame */
|
|
|
|
virtual PRIntn GetSkipSides() const;
|
|
|
|
|
1999-06-02 03:04:13 +04:00
|
|
|
virtual PRBool ParentDisablesSelection() const; //override default behavior
|
|
|
|
|
1999-08-19 07:51:25 +04:00
|
|
|
// Sets the starting column index for aColGroupFrame and the siblings frames that
|
|
|
|
// follow
|
|
|
|
void SetStartingColumnIndexFor(nsTableColGroupFrame* aColGroupFrame,
|
|
|
|
PRInt32 aIndex);
|
|
|
|
|
|
|
|
// Calculate the starting column index to use for the specified col group frame
|
|
|
|
PRInt32 CalculateStartingColumnIndexFor(nsTableColGroupFrame* aColGroupFrame);
|
1999-07-28 12:09:02 +04:00
|
|
|
|
1999-06-15 05:19:18 +04:00
|
|
|
public:
|
1998-04-15 01:45:28 +04:00
|
|
|
/** first pass of ResizeReflow.
|
|
|
|
* lays out all table content with aMaxSize(NS_UNCONSTRAINEDSIZE,NS_UNCONSTRAINEDSIZE) and
|
|
|
|
* a non-null aMaxElementSize so we get all the metrics we need to do column balancing.
|
|
|
|
* Pass 1 only needs to be executed once no matter how many times the table is resized,
|
|
|
|
* as long as content and style don't change. This is managed in the member variable mFirstPassIsValid.
|
|
|
|
* The layout information for each cell is cached in mColumLayoutData.
|
1998-10-15 11:46:16 +04:00
|
|
|
* Incremental layout can take advantage of aStartingFrame to pick up where a previous
|
|
|
|
* ResizeReflowPass1 left off.
|
1998-04-15 01:45:28 +04:00
|
|
|
*
|
1999-01-27 22:29:24 +03:00
|
|
|
* @see nsIFrameReflow::Reflow
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
|
1999-08-19 07:51:25 +04:00
|
|
|
/** do I need to do a reflow? */
|
|
|
|
virtual PRBool NeedsReflow(const nsHTMLReflowState& aReflowState);
|
2001-03-13 09:38:59 +03:00
|
|
|
|
2001-08-06 18:48:09 +04:00
|
|
|
PRBool IsRowInserted() const;
|
|
|
|
void SetRowInserted(PRBool aValue);
|
|
|
|
|
1999-06-15 05:19:18 +04:00
|
|
|
protected:
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
NS_METHOD ReflowChildren(nsIPresContext* aPresContext,
|
|
|
|
nsTableReflowState& aReflowState,
|
|
|
|
PRBool aDoColGroups,
|
|
|
|
PRBool aDirtyOnly,
|
|
|
|
nsReflowStatus& aStatus,
|
2002-03-04 18:48:56 +03:00
|
|
|
nsIFrame*& aLastChildReflowed,
|
2001-03-13 09:38:59 +03:00
|
|
|
PRBool* aReflowedAtLeastOne = nsnull);
|
1999-01-27 22:29:24 +03:00
|
|
|
// begin incremental reflow methods
|
1999-06-15 05:19:18 +04:00
|
|
|
|
1998-10-11 13:18:27 +04:00
|
|
|
/** Incremental Reflow attempts to do column balancing with the minimum number of reflow
|
|
|
|
* commands to child elements. This is done by processing the reflow command,
|
|
|
|
* rebalancing column widths (if necessary), then comparing the resulting column widths
|
|
|
|
* to the prior column widths and reflowing only those cells that require a reflow.
|
1999-01-27 22:29:24 +03:00
|
|
|
* All incremental reflows go through this method.
|
1998-10-11 13:18:27 +04:00
|
|
|
*
|
|
|
|
* @see Reflow
|
|
|
|
*/
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD IncrementalReflow(nsIPresContext* aPresContext,
|
1998-10-11 13:18:27 +04:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
1998-10-15 11:46:16 +04:00
|
|
|
nsReflowStatus& aStatus);
|
1998-10-11 13:18:27 +04:00
|
|
|
|
1999-01-27 22:29:24 +03:00
|
|
|
/** process an incremental reflow command targeted at a child of this frame.
|
|
|
|
* @param aNextFrame the next frame in the reflow target chain
|
|
|
|
* @see nsIFrameReflow::Reflow
|
|
|
|
*/
|
2001-03-13 09:38:59 +03:00
|
|
|
NS_IMETHOD IR_TargetIsChild(nsIPresContext* aPresContext,
|
|
|
|
nsTableReflowState& aReflowStatet,
|
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
nsIFrame* aNextFrame);
|
1998-10-11 13:18:27 +04:00
|
|
|
|
1999-01-27 22:29:24 +03:00
|
|
|
/** process an incremental reflow command targeted at this frame.
|
|
|
|
* @see nsIFrameReflow::Reflow
|
|
|
|
*/
|
2001-03-13 09:38:59 +03:00
|
|
|
NS_IMETHOD IR_TargetIsMe(nsIPresContext* aPresContext,
|
|
|
|
nsTableReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
1998-10-11 13:18:27 +04:00
|
|
|
|
1999-01-27 22:29:24 +03:00
|
|
|
/** process a style chnaged notification.
|
|
|
|
* @see nsIFrameReflow::Reflow
|
|
|
|
* TODO: needs to be optimized for which attribute was actually changed.
|
|
|
|
*/
|
2001-03-13 09:38:59 +03:00
|
|
|
NS_IMETHOD IR_StyleChanged(nsIPresContext* aPresContext,
|
|
|
|
nsTableReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
1998-10-11 13:18:27 +04:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
NS_IMETHOD AdjustSiblingsAfterReflow(nsIPresContext* aPresContext,
|
|
|
|
nsTableReflowState& aReflowState,
|
|
|
|
nsIFrame* aKidFrame,
|
|
|
|
nscoord aDeltaY);
|
1999-08-19 07:51:25 +04:00
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
nsresult RecoverState(nsIPresContext& aPresContext,
|
|
|
|
nsTableReflowState& aReflowState,
|
2001-03-13 09:38:59 +03:00
|
|
|
nsIFrame* aKidFrame);
|
1999-02-11 09:22:33 +03:00
|
|
|
|
1999-12-16 04:51:06 +03:00
|
|
|
NS_METHOD CollapseRowGroupIfNecessary(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aRowGroupFrame,
|
|
|
|
const nscoord& aYTotalOffset,
|
|
|
|
nscoord& aYGroupOffset, PRInt32& aRowX);
|
1999-06-14 12:01:00 +04:00
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_METHOD AdjustForCollapsingRows(nsIPresContext* aPresContext,
|
1999-02-11 09:22:33 +03:00
|
|
|
nscoord& aHeight);
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_METHOD AdjustForCollapsingCols(nsIPresContext* aPresContext,
|
1999-02-11 09:22:33 +03:00
|
|
|
nscoord& aWidth);
|
2001-03-13 09:38:59 +03:00
|
|
|
// end incremental reflow methods
|
1998-07-07 01:39:23 +04:00
|
|
|
|
1998-09-01 01:23:28 +04:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
// WIDTH AND HEIGHT CALCULATION
|
1998-11-20 04:01:25 +03:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
public:
|
|
|
|
|
|
|
|
// calculate the computed width of aFrame including its border and padding given
|
2001-07-13 09:53:09 +04:00
|
|
|
// its reflow state.
|
2001-10-26 06:30:38 +04:00
|
|
|
nscoord CalcBorderBoxWidth(nsIPresContext* aPresContex,
|
|
|
|
const nsHTMLReflowState& aReflowState);
|
2001-03-13 09:38:59 +03:00
|
|
|
|
|
|
|
// calculate the computed height of aFrame including its border and padding given
|
|
|
|
// its reflow state.
|
2002-02-19 18:48:28 +03:00
|
|
|
nscoord CalcBorderBoxHeight(nsIPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aReflowState);
|
2001-07-16 23:15:01 +04:00
|
|
|
// calculate the minimum width to layout aFrame and its desired width
|
|
|
|
// including border and padding given its reflow state and column width information
|
2002-02-19 18:48:28 +03:00
|
|
|
void CalcMinAndPreferredWidths(nsIPresContext* aPresContext,
|
2001-08-06 17:58:46 +04:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
PRBool aCalcPrefWidthIfAutoWithPctCol,
|
2001-03-13 09:38:59 +03:00
|
|
|
nscoord& aMinWidth,
|
|
|
|
nscoord& aPreferredWidth);
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// calcs the width of the table according to the computed widths of each column.
|
2002-02-19 18:48:28 +03:00
|
|
|
virtual PRInt32 CalcDesiredWidth(nsIPresContext& aPresContext,
|
|
|
|
const nsHTMLReflowState& aReflowState);
|
2001-03-13 09:38:59 +03:00
|
|
|
|
|
|
|
// return the desired height of this table accounting for the current
|
|
|
|
// reflow state, and for the table attributes and parent
|
|
|
|
nscoord CalcDesiredHeight(nsIPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aReflowState);
|
2001-11-05 03:15:51 +03:00
|
|
|
|
|
|
|
// The following is a helper for CalcDesiredHeight
|
2001-03-13 09:38:59 +03:00
|
|
|
|
2001-11-05 03:15:51 +03:00
|
|
|
void DistributeHeightToRows(nsIPresContext* aPresContext,
|
1999-06-15 03:42:16 +04:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
2001-11-05 03:15:51 +03:00
|
|
|
nscoord aAmount);
|
1998-11-20 04:01:25 +03:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
void PlaceChild(nsIPresContext* aPresContext,
|
|
|
|
nsTableReflowState& aReflowState,
|
|
|
|
nsIFrame* aKidFrame,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** assign widths for each column, taking into account the table content, the effective style,
|
2001-03-13 09:38:59 +03:00
|
|
|
* the layout constraints, and the compatibility mode.
|
1998-04-15 01:45:28 +04:00
|
|
|
* @param aPresContext the presentation context
|
|
|
|
* @param aTableStyle the resolved style for the table
|
|
|
|
* @param aMaxSize the height and width constraints
|
|
|
|
* @param aMaxElementSize the min size of the largest indivisible object
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
1999-11-24 09:03:41 +03:00
|
|
|
virtual void BalanceColumnWidths(nsIPresContext* aPresContext,
|
2001-03-13 09:38:59 +03:00
|
|
|
const nsHTMLReflowState& aReflowState);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-10-16 01:07:37 +04:00
|
|
|
|
1999-03-09 08:29:37 +03:00
|
|
|
nsIFrame* GetFirstBodyRowGroupFrame();
|
1999-10-21 09:11:43 +04:00
|
|
|
PRBool MoveOverflowToChildList(nsIPresContext* aPresContext);
|
|
|
|
void PushChildren(nsIPresContext *aPresContext,
|
|
|
|
nsIFrame* aFromChild,
|
|
|
|
nsIFrame* aPrevSibling);
|
1999-03-09 08:29:37 +03:00
|
|
|
|
1998-10-14 20:32:45 +04:00
|
|
|
public:
|
2000-09-14 10:49:47 +04:00
|
|
|
// put the children frames in the display order (e.g. thead before tbody before tfoot)
|
|
|
|
// and put the non row group frames at the end. Also return the number of row group frames.
|
2001-04-09 18:21:24 +04:00
|
|
|
void OrderRowGroups(nsVoidArray& aChildren,
|
|
|
|
PRUint32& aNumRowGroups,
|
|
|
|
nsIFrame** aFirstBody = nsnull,
|
|
|
|
nsTableRowGroupFrame** aHead = nsnull,
|
2002-02-19 18:48:28 +03:00
|
|
|
nsTableRowGroupFrame** aFoot = nsnull) const;
|
2000-09-14 10:49:47 +04:00
|
|
|
|
1999-08-19 23:52:37 +04:00
|
|
|
// Returns PR_TRUE if there are any cells above the row at
|
|
|
|
// aRowIndex and spanning into the row at aRowIndex
|
1999-08-20 00:36:52 +04:00
|
|
|
PRBool RowIsSpannedInto(PRInt32 aRowIndex);
|
1999-08-19 23:52:37 +04:00
|
|
|
|
|
|
|
// Returns PR_TRUE if there is a cell originating in aRowIndex
|
|
|
|
// which spans into the next row
|
|
|
|
PRBool RowHasSpanningCells(PRInt32 aRowIndex);
|
|
|
|
|
|
|
|
// Returns PR_TRUE if there are any cells to the left of the column at
|
|
|
|
// aColIndex and spanning into the column at aColIndex
|
|
|
|
PRBool ColIsSpannedInto(PRInt32 aColIndex);
|
|
|
|
|
|
|
|
// Returns PR_TRUE if there is a cell originating in aColIndex
|
|
|
|
// which spans into the next col
|
|
|
|
PRBool ColHasSpanningCells(PRInt32 aColIndex);
|
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
// Allows rows to notify the table of additions or changes to a cell's width
|
|
|
|
// The table uses this to update the appropriate column widths and to decide
|
|
|
|
// whether to reinitialize (and then rebalance) or rebalance the table. If the
|
|
|
|
// most extreme measure results (e.g. reinitialize) then PR_TRUE is returned
|
|
|
|
// indicating that further calls are not going to accomplish anyting.
|
|
|
|
PRBool CellChangedWidth(const nsTableCellFrame& aCellFrame,
|
|
|
|
nscoord aPrevMinWidth,
|
|
|
|
nscoord aPrevMaxWidth,
|
|
|
|
PRBool aCellWasDestroyed = PR_FALSE);
|
|
|
|
|
|
|
|
protected:
|
1998-10-16 01:07:37 +04:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
PRBool HaveReflowedColGroups() const;
|
|
|
|
void SetHaveReflowedColGroups(PRBool aValue);
|
2000-01-11 18:55:31 +03:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
PRBool DidResizeReflow() const;
|
|
|
|
void SetResizeReflow(PRBool aValue);
|
1998-05-02 00:44:55 +04:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
PRBool ConvertToPixelValue(nsHTMLValue& aValue,
|
|
|
|
PRInt32 aDefault,
|
|
|
|
PRInt32& aResult);
|
1998-05-27 00:57:24 +04:00
|
|
|
|
1998-10-14 20:32:45 +04:00
|
|
|
public:
|
2001-03-13 09:38:59 +03:00
|
|
|
PRBool NeedStrategyInit() const;
|
|
|
|
void SetNeedStrategyInit(PRBool aValue);
|
|
|
|
|
|
|
|
PRBool NeedStrategyBalance() const;
|
|
|
|
void SetNeedStrategyBalance(PRBool aValue);
|
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
PRBool IsBorderCollapse() const;
|
|
|
|
|
|
|
|
PRBool NeedToCalcBCBorders() const;
|
|
|
|
void SetNeedToCalcBCBorders(PRBool aValue);
|
|
|
|
|
1999-07-28 12:09:02 +04:00
|
|
|
/** Get the cell map for this table frame. It is not always mCellMap.
|
|
|
|
* Only the firstInFlow has a legit cell map
|
|
|
|
*/
|
2000-01-13 08:29:38 +03:00
|
|
|
virtual nsTableCellMap* GetCellMap() const;
|
1998-10-14 20:32:45 +04:00
|
|
|
|
2000-01-22 04:16:50 +03:00
|
|
|
void AdjustRowIndices(nsIPresContext* aPresContext,
|
|
|
|
PRInt32 aRowIndex,
|
|
|
|
PRInt32 aAdjustment);
|
1999-08-30 04:01:09 +04:00
|
|
|
|
2000-01-22 04:16:50 +03:00
|
|
|
NS_IMETHOD AdjustRowIndices(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aRowGroup,
|
|
|
|
PRInt32 aRowIndex,
|
|
|
|
PRInt32 anAdjustment);
|
1999-08-30 04:01:09 +04:00
|
|
|
|
1999-09-02 04:07:14 +04:00
|
|
|
// Remove cell borders which aren't bordering row and/or col groups
|
1999-11-24 09:03:41 +03:00
|
|
|
void ProcessGroupRules(nsIPresContext* aPresContext);
|
1999-09-02 04:07:14 +04:00
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
nsVoidArray& GetColCache();
|
|
|
|
|
2000-01-13 08:29:38 +03:00
|
|
|
/**
|
|
|
|
* Return aFrame's child if aFrame is an nsScrollFrame, otherwise return aFrame
|
|
|
|
*/
|
|
|
|
nsTableRowGroupFrame* GetRowGroupFrame(nsIFrame* aFrame,
|
2002-02-19 18:48:28 +03:00
|
|
|
nsIAtom* aFrameTypeIn = nsnull) const;
|
2000-01-13 08:29:38 +03:00
|
|
|
|
1998-10-14 20:32:45 +04:00
|
|
|
protected:
|
1998-06-17 20:38:24 +04:00
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
void SetBorderCollapse(PRBool aValue);
|
|
|
|
|
|
|
|
void CalcBCBorders(nsIPresContext& aPresContext);
|
|
|
|
|
|
|
|
void ExpandBCDamageArea(nsRect& aRect) const;
|
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
PRBool HadInitialReflow() const;
|
|
|
|
void SetHadInitialReflow(PRBool aValue);
|
|
|
|
|
2000-02-12 04:55:40 +03:00
|
|
|
void SetColumnDimensions(nsIPresContext* aPresContext,
|
|
|
|
nscoord aHeight,
|
|
|
|
const nsMargin& aReflowState);
|
1999-06-08 01:10:25 +04:00
|
|
|
|
1998-07-11 04:00:31 +04:00
|
|
|
/** return the number of columns as specified by the input.
|
|
|
|
* has 2 side effects:<br>
|
|
|
|
* calls SetStartColumnIndex on each nsTableColumn<br>
|
|
|
|
* sets mSpecifiedColCount.<br>
|
|
|
|
*/
|
|
|
|
virtual PRInt32 GetSpecifiedColumnCount ();
|
|
|
|
|
2000-01-22 04:16:50 +03:00
|
|
|
PRInt32 CollectRows(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsVoidArray& aCollection);
|
1999-01-18 02:35:56 +03:00
|
|
|
|
1998-07-11 04:00:31 +04:00
|
|
|
public: /* ----- Cell Map public methods ----- */
|
|
|
|
|
2000-09-14 10:49:47 +04:00
|
|
|
PRInt32 GetStartRowIndex(nsTableRowGroupFrame& aRowGroupFrame);
|
|
|
|
|
1998-06-17 20:38:24 +04:00
|
|
|
/** returns the number of rows in this table.
|
|
|
|
* if mCellMap has been created, it is asked for the number of rows.<br>
|
|
|
|
* otherwise, the content is enumerated and the rows are counted.
|
|
|
|
*/
|
1998-11-20 04:01:25 +03:00
|
|
|
virtual PRInt32 GetRowCount() const;
|
1998-06-17 20:38:24 +04:00
|
|
|
|
1999-07-28 12:09:02 +04:00
|
|
|
/** returns the number of columns in this table after redundant columns have been removed
|
1998-07-24 20:51:16 +04:00
|
|
|
*/
|
2002-02-19 18:48:28 +03:00
|
|
|
virtual PRInt32 GetEffectiveColCount() const;
|
|
|
|
virtual PRInt32 GetColCount() const;
|
1998-07-24 20:51:16 +04:00
|
|
|
|
1998-09-19 02:37:14 +04:00
|
|
|
/** return the column frame at colIndex.
|
|
|
|
* returns nsnull if the col frame has not yet been allocated, or if aColIndex is out of range
|
|
|
|
*/
|
1998-07-11 04:00:31 +04:00
|
|
|
nsTableColFrame * GetColFrame(PRInt32 aColIndex);
|
2001-05-17 16:40:27 +04:00
|
|
|
// return the last col index which isn't of type eColAnonymousCell
|
|
|
|
PRInt32 GetIndexOfLastRealCol();
|
1998-06-17 20:38:24 +04:00
|
|
|
|
1998-09-19 02:37:14 +04:00
|
|
|
/** return the cell frame at aRowIndex, aColIndex.
|
|
|
|
* returns nsnull if the cell frame has not yet been allocated,
|
|
|
|
* or if aRowIndex or aColIndex is out of range
|
|
|
|
*/
|
|
|
|
nsTableCellFrame * GetCellFrameAt(PRInt32 aRowIndex, PRInt32 aColIndex);
|
1998-06-17 20:38:24 +04:00
|
|
|
|
1998-09-30 03:15:01 +04:00
|
|
|
/** return the minimum width of the table caption. Return 0 if there is no caption. */
|
|
|
|
nscoord GetMinCaptionWidth();
|
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
/** returns PR_TRUE if table-layout:auto */
|
2000-11-15 17:59:47 +03:00
|
|
|
virtual PRBool IsAutoLayout();
|
1998-10-21 00:05:44 +04:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
nscoord GetMinWidth() const;
|
|
|
|
void SetMinWidth(nscoord aWidth);
|
|
|
|
|
|
|
|
nscoord GetDesiredWidth() const;
|
|
|
|
void SetDesiredWidth(nscoord aWidth);
|
|
|
|
|
2000-07-06 17:37:28 +04:00
|
|
|
nscoord GetPreferredWidth() const;
|
|
|
|
void SetPreferredWidth(nscoord aWidth);
|
|
|
|
|
1999-08-01 02:11:50 +04:00
|
|
|
/*---------------- nsITableLayout methods ------------------------*/
|
1999-08-01 20:20:14 +04:00
|
|
|
|
|
|
|
/** Get the cell and associated data for a table cell from the frame's cellmap */
|
1999-08-01 02:11:50 +04:00
|
|
|
NS_IMETHOD GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex,
|
|
|
|
nsIDOMElement* &aCell, //out params
|
|
|
|
PRInt32& aStartRowIndex, PRInt32& aStartColIndex,
|
|
|
|
PRInt32& aRowSpan, PRInt32& aColSpan,
|
2000-01-26 17:56:06 +03:00
|
|
|
PRInt32& aActualRowSpan, PRInt32& aActualColSpan,
|
1999-08-01 02:11:50 +04:00
|
|
|
PRBool& aIsSelected);
|
|
|
|
|
1999-08-01 20:20:14 +04:00
|
|
|
/** Get the number of rows and column for a table from the frame's cellmap
|
|
|
|
* Some rows may not have enough cells (the number returned is the maximum possible),
|
|
|
|
* which displays as a ragged-right edge table
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetTableSize(PRInt32& aRowCount, PRInt32& aColCount);
|
|
|
|
|
|
|
|
/*------------end of nsITableLayout methods -----------------------*/
|
|
|
|
|
1998-12-03 21:01:35 +03:00
|
|
|
public:
|
|
|
|
static nsIAtom* gColGroupAtom;
|
2002-03-06 18:56:32 +03:00
|
|
|
#ifdef DEBUG
|
2000-01-22 04:16:50 +03:00
|
|
|
void Dump(nsIPresContext* aPresContext,
|
|
|
|
PRBool aDumpRows,
|
|
|
|
PRBool aDumpCols,
|
|
|
|
PRBool aDumpCellMap);
|
2002-03-06 18:56:32 +03:00
|
|
|
#endif
|
2001-09-07 01:11:44 +04:00
|
|
|
nsAutoVoidArray mColFrames; // XXX temporarily public
|
1998-12-03 21:01:35 +03:00
|
|
|
|
2001-09-24 18:48:38 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
static void DumpTableFrames(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aFrame);
|
|
|
|
#endif
|
|
|
|
|
1999-02-04 01:35:03 +03:00
|
|
|
protected:
|
2002-03-06 18:56:32 +03:00
|
|
|
#ifdef DEBUG
|
2000-01-22 04:16:50 +03:00
|
|
|
void DumpRowGroup(nsIPresContext* aPresContext, nsIFrame* aChildFrame);
|
2002-03-06 18:56:32 +03:00
|
|
|
#endif
|
2001-03-13 09:38:59 +03:00
|
|
|
// DATA MEMBERS
|
1999-10-05 03:48:05 +04:00
|
|
|
|
|
|
|
struct TableBits {
|
2001-03-13 09:38:59 +03:00
|
|
|
unsigned mHadInitialReflow:1; // has intial reflow happened
|
|
|
|
unsigned mHaveReflowedColGroups:1; // have the col groups gotten their initial reflow
|
|
|
|
unsigned mNeedStrategyBalance:1; // does the strategy needs to balance the table
|
|
|
|
unsigned mNeedStrategyInit:1; // does the strategy needs to be initialized and then balance the table
|
|
|
|
unsigned mHasPctCol:1; // does any cell or col have a pct width
|
|
|
|
unsigned mCellSpansPctCol:1; // does any cell span a col with a pct width (or containing a cell with a pct width)
|
|
|
|
unsigned mDidResizeReflow:1; // did a resize reflow happen (indicating pass 2)
|
2002-02-19 18:48:28 +03:00
|
|
|
unsigned mIsBorderCollapse:1; // border collapsing model vs. separate model
|
2001-08-08 05:13:35 +04:00
|
|
|
unsigned mRowInserted:1;
|
2001-11-05 03:15:51 +03:00
|
|
|
unsigned mNeedSpecialReflow:1;
|
|
|
|
unsigned mNeedToInitiateSpecialReflow:1;
|
2002-04-11 01:32:41 +04:00
|
|
|
unsigned mInitiatedSpecialReflow:1;
|
2002-02-19 18:48:28 +03:00
|
|
|
unsigned mNeedToCalcBCBorders:1;
|
2002-05-10 22:22:41 +04:00
|
|
|
unsigned : 19; // unused
|
1999-10-05 03:48:05 +04:00
|
|
|
} mBits;
|
|
|
|
|
2000-07-06 17:37:28 +04:00
|
|
|
nsTableCellMap* mCellMap; // maintains the relationships between rows, cols, and cells
|
|
|
|
nsITableLayoutStrategy* mTableLayoutStrategy;// the layout strategy for this frame
|
|
|
|
nsFrameList mColGroups; // the list of colgroup frames
|
2001-03-13 09:38:59 +03:00
|
|
|
nscoord mMinWidth; // XXX could store as PRUint16 with pixels
|
|
|
|
nscoord mDesiredWidth; // XXX could store as PRUint16 with pixels
|
|
|
|
nscoord mPreferredWidth; // XXX could store as PRUint16 with pixels
|
|
|
|
|
2001-09-24 18:48:38 +04:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
// DEBUG REFLOW
|
2002-05-29 22:55:34 +04:00
|
|
|
#if defined DEBUG_TABLE_REFLOW_TIMING
|
2001-01-25 18:55:51 +03:00
|
|
|
public:
|
|
|
|
static void DebugReflow(nsIFrame* aFrame,
|
|
|
|
nsHTMLReflowState& aReflowState,
|
|
|
|
nsHTMLReflowMetrics* aMetrics = nsnull,
|
|
|
|
nsReflowStatus aStatus = NS_FRAME_COMPLETE);
|
2001-02-01 05:29:14 +03:00
|
|
|
|
2001-01-25 18:55:51 +03:00
|
|
|
static void DebugReflowDone(nsIFrame* aFrame);
|
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
enum nsMethod {eInit=0, eBalanceCols, eNonPctCols, eNonPctColspans, ePctCols};
|
|
|
|
static void DebugTimeMethod(nsMethod aMethod,
|
|
|
|
nsTableFrame& aFrame,
|
|
|
|
nsHTMLReflowState& aReflowState,
|
|
|
|
PRBool aStart);
|
2001-01-25 18:55:51 +03:00
|
|
|
nsReflowTimer* mTimer;
|
|
|
|
#endif
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
1998-09-30 03:15:01 +04:00
|
|
|
|
1998-11-20 04:01:25 +03:00
|
|
|
inline PRBool nsTableFrame::IsRowGroup(PRInt32 aDisplayType) const
|
1998-10-11 13:18:27 +04:00
|
|
|
{
|
|
|
|
return PRBool((NS_STYLE_DISPLAY_TABLE_HEADER_GROUP == aDisplayType) ||
|
|
|
|
(NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == aDisplayType) ||
|
|
|
|
(NS_STYLE_DISPLAY_TABLE_ROW_GROUP == aDisplayType));
|
|
|
|
}
|
1998-10-15 02:12:06 +04:00
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
inline void nsTableFrame::SetHadInitialReflow(PRBool aValue)
|
|
|
|
{
|
|
|
|
mBits.mHadInitialReflow = aValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline PRBool nsTableFrame::HadInitialReflow() const
|
|
|
|
{
|
|
|
|
return (PRBool)mBits.mHadInitialReflow;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void nsTableFrame::SetHaveReflowedColGroups(PRBool aValue)
|
|
|
|
{
|
|
|
|
mBits.mHaveReflowedColGroups = aValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline PRBool nsTableFrame::HaveReflowedColGroups() const
|
|
|
|
{
|
|
|
|
return (PRBool)mBits.mHaveReflowedColGroups;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline PRBool nsTableFrame::HasPctCol() const
|
|
|
|
{
|
|
|
|
return (PRBool)mBits.mHasPctCol;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void nsTableFrame::SetHasPctCol(PRBool aValue)
|
|
|
|
{
|
|
|
|
mBits.mHasPctCol = (unsigned)aValue;
|
|
|
|
}
|
|
|
|
|
2000-09-09 05:46:44 +04:00
|
|
|
inline PRBool nsTableFrame::HasCellSpanningPctCol() const
|
1999-10-04 09:19:32 +04:00
|
|
|
{
|
2000-09-09 05:46:44 +04:00
|
|
|
return (PRBool)mBits.mCellSpansPctCol;
|
1999-10-04 09:19:32 +04:00
|
|
|
}
|
|
|
|
|
2000-09-09 05:46:44 +04:00
|
|
|
inline void nsTableFrame::SetHasCellSpanningPctCol(PRBool aValue)
|
1999-10-04 09:19:32 +04:00
|
|
|
{
|
2000-09-09 05:46:44 +04:00
|
|
|
mBits.mCellSpansPctCol = (unsigned)aValue;
|
1999-10-04 09:19:32 +04:00
|
|
|
}
|
|
|
|
|
2001-11-05 03:15:51 +03:00
|
|
|
inline PRBool nsTableFrame::NeedSpecialReflow() const
|
|
|
|
{
|
|
|
|
return (PRBool)mBits.mNeedSpecialReflow;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void nsTableFrame::SetNeedSpecialReflow(PRBool aValue)
|
2001-08-08 05:13:35 +04:00
|
|
|
{
|
2001-11-05 03:15:51 +03:00
|
|
|
mBits.mNeedSpecialReflow = (unsigned)aValue;
|
2001-08-08 05:13:35 +04:00
|
|
|
}
|
|
|
|
|
2001-11-05 03:15:51 +03:00
|
|
|
inline PRBool nsTableFrame::NeedToInitiateSpecialReflow() const
|
2001-08-08 05:13:35 +04:00
|
|
|
{
|
2001-11-05 03:15:51 +03:00
|
|
|
return (PRBool)mBits.mNeedToInitiateSpecialReflow;
|
2001-08-08 05:13:35 +04:00
|
|
|
}
|
|
|
|
|
2001-11-05 03:15:51 +03:00
|
|
|
inline void nsTableFrame::SetNeedToInitiateSpecialReflow(PRBool aValue)
|
|
|
|
{
|
|
|
|
mBits.mNeedToInitiateSpecialReflow = (unsigned)aValue;
|
|
|
|
}
|
2002-04-11 01:32:41 +04:00
|
|
|
|
|
|
|
inline PRBool nsTableFrame::InitiatedSpecialReflow() const
|
|
|
|
{
|
|
|
|
return (PRBool)mBits.mInitiatedSpecialReflow;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void nsTableFrame::SetInitiatedSpecialReflow(PRBool aValue)
|
|
|
|
{
|
|
|
|
mBits.mInitiatedSpecialReflow = (unsigned)aValue;
|
|
|
|
}
|
|
|
|
|
2001-08-06 18:48:09 +04:00
|
|
|
inline PRBool nsTableFrame::IsRowInserted() const
|
|
|
|
{
|
|
|
|
return (PRBool)mBits.mRowInserted;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void nsTableFrame::SetRowInserted(PRBool aValue)
|
|
|
|
{
|
|
|
|
mBits.mRowInserted = (unsigned)aValue;
|
|
|
|
}
|
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
inline nsFrameList& nsTableFrame::GetColGroups()
|
|
|
|
{
|
|
|
|
return mColGroups;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nsVoidArray& nsTableFrame::GetColCache()
|
|
|
|
{
|
|
|
|
return mColFrames;
|
|
|
|
}
|
|
|
|
|
2001-03-13 09:38:59 +03:00
|
|
|
inline void nsTableFrame::SetMinWidth(nscoord aWidth)
|
|
|
|
{
|
|
|
|
mMinWidth = aWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void nsTableFrame::SetDesiredWidth(nscoord aWidth)
|
2000-07-06 17:37:28 +04:00
|
|
|
{
|
2001-03-13 09:38:59 +03:00
|
|
|
mDesiredWidth = aWidth;
|
2000-07-06 17:37:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void nsTableFrame::SetPreferredWidth(nscoord aWidth)
|
|
|
|
{
|
|
|
|
mPreferredWidth = aWidth;
|
|
|
|
}
|
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
inline PRBool nsTableFrame::IsBorderCollapse() const
|
|
|
|
{
|
|
|
|
return (PRBool)mBits.mIsBorderCollapse;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void nsTableFrame::SetBorderCollapse(PRBool aValue)
|
|
|
|
{
|
|
|
|
mBits.mIsBorderCollapse = aValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline PRBool nsTableFrame::NeedToCalcBCBorders() const
|
|
|
|
{
|
|
|
|
return (PRBool)mBits.mNeedToCalcBCBorders;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void nsTableFrame::SetNeedToCalcBCBorders(PRBool aValue)
|
|
|
|
{
|
|
|
|
mBits.mNeedToCalcBCBorders = (unsigned)aValue;
|
|
|
|
}
|
2001-03-13 09:38:59 +03:00
|
|
|
|
1999-05-04 23:15:56 +04:00
|
|
|
enum nsTableIteration {
|
|
|
|
eTableLTR = 0,
|
|
|
|
eTableRTL = 1,
|
|
|
|
eTableDIR = 2
|
|
|
|
};
|
|
|
|
|
1999-04-22 07:51:58 +04:00
|
|
|
class nsTableIterator
|
|
|
|
{
|
|
|
|
public:
|
2000-01-22 04:16:50 +03:00
|
|
|
nsTableIterator(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame& aSource,
|
1999-05-04 23:15:56 +04:00
|
|
|
nsTableIteration aType);
|
|
|
|
nsTableIterator(nsFrameList& aSource,
|
|
|
|
nsTableIteration aType);
|
1999-04-22 07:51:58 +04:00
|
|
|
nsIFrame* First();
|
|
|
|
nsIFrame* Next();
|
|
|
|
PRBool IsLeftToRight();
|
|
|
|
PRInt32 Count();
|
|
|
|
|
|
|
|
protected:
|
1999-05-04 23:15:56 +04:00
|
|
|
void Init(nsIFrame* aFirstChild,
|
|
|
|
nsTableIteration aType);
|
1999-04-22 07:51:58 +04:00
|
|
|
PRBool mLeftToRight;
|
|
|
|
nsIFrame* mFirstListChild;
|
|
|
|
nsIFrame* mFirstChild;
|
|
|
|
nsIFrame* mCurrentChild;
|
|
|
|
PRInt32 mCount;
|
|
|
|
};
|
|
|
|
|
2002-02-19 18:48:28 +03:00
|
|
|
#define ABORT0() \
|
|
|
|
{NS_ASSERTION(PR_FALSE, "CellIterator program error"); \
|
|
|
|
return;}
|
|
|
|
|
|
|
|
#define ABORT1(aReturn) \
|
|
|
|
{NS_ASSERTION(PR_FALSE, "CellIterator program error"); \
|
|
|
|
return aReturn;}
|
|
|
|
|
|
|
|
#define GET_PIXELS_TO_TWIPS(presContext,var) \
|
|
|
|
float var; \
|
|
|
|
(presContext)->GetScaledPixelsToTwips(&var);
|
|
|
|
|
|
|
|
#define GET_TWIPS_TO_PIXELS(presContext,var) \
|
|
|
|
float var; \
|
|
|
|
(presContext)->GetScaledPixelsToTwips(&var); \
|
|
|
|
var = 1.0f / var;
|
|
|
|
|
1998-10-15 02:12:06 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1998-10-11 13:18:27 +04:00
|
|
|
|
|
|
|
|