1998-04-14 00:24:54 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
|
|
|
#ifndef nsTableFrame_h__
|
|
|
|
#define nsTableFrame_h__
|
|
|
|
|
|
|
|
#include "nscore.h"
|
|
|
|
#include "nsContainerFrame.h"
|
1998-06-05 10:09:09 +04:00
|
|
|
#include "nsStyleCoord.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-06-17 20:38:24 +04:00
|
|
|
class nsCellMap;
|
1998-04-14 00:24:54 +04:00
|
|
|
class nsVoidArray;
|
|
|
|
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-04-30 21:57:09 +04:00
|
|
|
class nsITableLayoutStrategy;
|
1998-05-27 00:57:24 +04:00
|
|
|
class nsHTMLValue;
|
1998-06-05 06:36:25 +04:00
|
|
|
class ColumnInfoCache;
|
1998-04-14 00:24:54 +04:00
|
|
|
struct InnerTableReflowState;
|
1998-04-25 22:48:48 +04:00
|
|
|
struct nsStylePosition;
|
1998-05-27 00:57:24 +04:00
|
|
|
struct nsStyleSpacing;
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-06-24 03:23:21 +04:00
|
|
|
/* ff1d2780-06d6-11d2-8f37-006008159b0c */
|
|
|
|
#define NS_TABLEFRAME_CID \
|
|
|
|
{0xff1d2780, 0x06d6, 0x11d2, {0x8f, 0x37, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x0c}}
|
|
|
|
|
|
|
|
extern const nsIID kTableFrameCID;
|
|
|
|
|
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.)
|
|
|
|
* Used as a pseudo-frame within nsTableOuterFrame,
|
|
|
|
* it may also be used stand-alone as the top-level frame.
|
|
|
|
* The meaningful child frames of nsTableFrame map rowgroups.
|
|
|
|
*
|
|
|
|
* @author sclark
|
|
|
|
*
|
|
|
|
* TODO: make methods virtual so nsTableFrame can be used as a base class in the future.
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
|
|
|
class nsTableFrame : public nsContainerFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
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
|
|
|
|
NS_NewTableFrame(nsIContent* aContent,
|
|
|
|
nsIFrame* aParentFrame,
|
|
|
|
nsIFrame*& aResult);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-06-24 03:23:21 +04:00
|
|
|
// nsISupports
|
|
|
|
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
|
|
|
|
|
1998-09-01 01:23:28 +04:00
|
|
|
/** helper method for determining if this is a nested table or not */
|
1998-10-02 08:10:00 +04:00
|
|
|
PRBool IsNested(const nsHTMLReflowState& aReflowState, nsStylePosition *& aPosition) const;
|
1998-09-01 01:23:28 +04:00
|
|
|
|
1998-09-24 20:37:22 +04:00
|
|
|
/** helper method to find the table parent of any table frame object */
|
|
|
|
static NS_METHOD GetTableFrame(nsIFrame *aSourceFrame, nsTableFrame *& aOutFrame);
|
|
|
|
|
1998-06-05 06:36:25 +04:00
|
|
|
/** helper method for getting the width of the table's containing block */
|
1998-10-02 08:10:00 +04:00
|
|
|
static nscoord GetTableContainerWidth(const nsHTMLReflowState& aState);
|
1998-06-05 06:36:25 +04:00
|
|
|
|
|
|
|
|
|
|
|
static PRBool TableIsAutoWidth(nsTableFrame *aTableFrame,
|
|
|
|
nsIStyleContext *aTableStyle,
|
1998-10-02 08:10:00 +04:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
1998-06-05 06:36:25 +04:00
|
|
|
nscoord& aSpecifiedTableWidth);
|
|
|
|
|
1998-09-16 21:19:20 +04:00
|
|
|
NS_IMETHOD Init(nsIPresContext& aPresContext, nsIFrame* aChildList);
|
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** @see nsIFrame::Paint */
|
1998-04-17 05:41:24 +04:00
|
|
|
NS_IMETHOD Paint(nsIPresContext& aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect);
|
1998-04-14 00:24:54 +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
|
1998-05-25 21:31:49 +04:00
|
|
|
* @see nsIFrame::Reflow
|
1998-04-15 01:45:28 +04:00
|
|
|
*/
|
1998-07-15 06:53:09 +04:00
|
|
|
NS_IMETHOD Reflow(nsIPresContext& aPresContext,
|
1998-10-01 08:46:11 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
1998-10-02 08:10:00 +04:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
1998-05-25 21:31:49 +04:00
|
|
|
nsReflowStatus& aStatus);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** @see nsContainerFrame::CreateContinuingFrame */
|
1998-07-15 07:23:23 +04:00
|
|
|
NS_IMETHOD CreateContinuingFrame(nsIPresContext& aPresContext,
|
1998-05-07 04:08:20 +04:00
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIStyleContext* aStyleContext,
|
|
|
|
nsIFrame*& aContinuingFrame);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-06-17 20:38:24 +04:00
|
|
|
/** allow the cell and row attributes to effect the column frame
|
|
|
|
* currently, the only reason this exists is to support the HTML "rule"
|
|
|
|
* that a width attribute on a cell in the first column sets the column width.
|
|
|
|
*/
|
|
|
|
virtual NS_METHOD SetColumnStyleFromCell(nsIPresContext * aPresContext,
|
|
|
|
nsTableCellFrame* aCellFrame,
|
|
|
|
nsTableRowFrame * aRowFrame);
|
|
|
|
|
1998-07-26 08:23:01 +04:00
|
|
|
/** the COLS attribute can be modified by any cell's width attribute.
|
|
|
|
* deal with it here. Must be called before any call to
|
|
|
|
* ColumnInfoCache::AddColumnInfo
|
|
|
|
*/
|
|
|
|
virtual void AdjustColumnsForCOLSAttribute();
|
|
|
|
|
1998-06-05 06:36:25 +04:00
|
|
|
/** return the column frame corresponding to the given column index
|
|
|
|
* there are two ways to do this, depending on whether we have cached
|
|
|
|
* column information yet.
|
|
|
|
*/
|
|
|
|
NS_METHOD GetColumnFrame(PRInt32 aColIndex, nsTableColFrame *&aColFrame);
|
|
|
|
|
1998-07-11 04:00:31 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
/**
|
|
|
|
* DEBUG METHOD
|
|
|
|
*
|
|
|
|
*/
|
1998-07-11 04:00:31 +04:00
|
|
|
//virtual void ListColumnLayoutData(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
1998-04-14 00:24:54 +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
|
|
|
|
|
|
|
/** helper to get the cell spacing style value */
|
|
|
|
virtual nscoord GetCellSpacing();
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Calculate Layout Information
|
|
|
|
*
|
|
|
|
*/
|
1998-06-17 20:38:24 +04:00
|
|
|
void AppendLayoutData(nsVoidArray* aList, nsTableCellFrame* aTableCell);
|
1998-04-29 02:41:25 +04:00
|
|
|
void RecalcLayoutData();
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-05-22 03:43:18 +04:00
|
|
|
// Get cell margin information
|
1998-06-17 20:38:24 +04:00
|
|
|
NS_IMETHOD GetCellMarginData(nsTableCellFrame* aKidFrame, nsMargin& aMargin);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-06-05 06:36:25 +04:00
|
|
|
/** get cached column information for a subset of the columns
|
|
|
|
*
|
|
|
|
* @param aType -- information is returned for the subset of columns with aType style
|
|
|
|
* @param aOutNumColumns -- out param, the number of columns matching aType
|
|
|
|
* @param aOutColumnIndexes -- out param, the indexes of the columns matching aType
|
|
|
|
*
|
|
|
|
* TODO : make aOutColumnIndexes safe
|
|
|
|
*/
|
|
|
|
void GetColumnsByType(const nsStyleUnit aType,
|
|
|
|
PRInt32& aOutNumColumns,
|
|
|
|
PRInt32 *& aOutColumnIndexes);
|
|
|
|
|
1998-06-24 23:13:19 +04:00
|
|
|
/** return the row span of a cell, taking into account row span magic at the bottom
|
|
|
|
* of a table.
|
1998-07-17 03:23:31 +04:00
|
|
|
*
|
|
|
|
* @param aRowIndex the row from which to measure effective row span
|
|
|
|
* @param aCell the cell
|
|
|
|
*
|
1998-06-24 23:13:19 +04:00
|
|
|
* @return the row span, correcting for row spans that extend beyond the bottom
|
|
|
|
* of the table.
|
|
|
|
*/
|
|
|
|
virtual PRInt32 GetEffectiveRowSpan(PRInt32 aRowIndex, nsTableCellFrame *aCell);
|
|
|
|
|
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 aColIndex the column from which to measure effective col span
|
|
|
|
* @param aCell the cell
|
|
|
|
*
|
|
|
|
* @return the col span, correcting for col spans that extend beyond the edge
|
|
|
|
* of the table.
|
|
|
|
*/
|
|
|
|
virtual PRInt32 GetEffectiveColSpan(PRInt32 aColIndex, nsTableCellFrame *aCell);
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
/** verify that there are at least aColIndex column frames created.
|
|
|
|
* if not, create the needed col frames
|
|
|
|
*/
|
|
|
|
virtual void EnsureColumnFrameAt(PRInt32 aColIndex,
|
1998-09-24 01:48:26 +04:00
|
|
|
nsIPresContext* aPresContext);
|
1998-07-22 07:53:43 +04:00
|
|
|
|
1998-09-01 01:23:28 +04:00
|
|
|
/** return the index of the next row that is not yet assigned.
|
|
|
|
* If no row is initialized, 0 is returned.
|
|
|
|
*/
|
|
|
|
PRInt32 GetNextAvailRowIndex() const;
|
|
|
|
|
|
|
|
/** return the index of the next column in aRowIndex after aColIndex
|
|
|
|
* that does not have a cell assigned to it.
|
|
|
|
* If aColIndex is past the end of the row, it is returned.
|
|
|
|
* If the row is not initialized, 0 is returned.
|
|
|
|
*/
|
|
|
|
PRInt32 GetNextAvailColIndex(PRInt32 aRowIndex, PRInt32 aColIndex) const;
|
|
|
|
|
|
|
|
/** build as much of the CellMap as possible from the info we have so far
|
|
|
|
*/
|
|
|
|
virtual void AddCellToTable (nsTableRowFrame *aRowFrame,
|
|
|
|
nsTableCellFrame *aCellFrame,
|
|
|
|
PRBool aAddRow);
|
|
|
|
|
|
|
|
virtual void AddColumnFrame (nsTableColFrame *aColFrame);
|
|
|
|
|
1998-09-03 01:59:54 +04:00
|
|
|
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const;
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
protected:
|
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** protected constructor.
|
|
|
|
* @see NewFrame
|
|
|
|
*/
|
1998-05-06 03:56:50 +04:00
|
|
|
nsTableFrame(nsIContent* aContent, nsIFrame* aParentFrame);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** destructor, responsible for mColumnLayoutData and mColumnWidths */
|
1998-04-14 00:24:54 +04:00
|
|
|
virtual ~nsTableFrame();
|
|
|
|
|
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-06-03 04:43:53 +04:00
|
|
|
* @see Reflow
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
1998-05-30 00:36:05 +04:00
|
|
|
virtual nsReflowStatus ResizeReflowPass1(nsIPresContext* aPresContext,
|
1998-10-01 08:46:11 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
1998-10-02 08:10:00 +04:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
1998-06-17 20:38:24 +04:00
|
|
|
nsReflowStatus& aStatus);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** second pass of ResizeReflow.
|
|
|
|
* lays out all table content with aMaxSize(computed_table_width, given_table_height)
|
|
|
|
* Pass 2 is executed every time the table needs to resize. An optimization is included
|
|
|
|
* so that if the table doesn't need to actually be resized, no work is done (see NeedsReflow).
|
|
|
|
*
|
|
|
|
*
|
1998-06-03 04:43:53 +04:00
|
|
|
* @see Reflow
|
1998-04-15 01:45:28 +04:00
|
|
|
* @see NeedsReflow
|
1998-04-14 00:24:54 +04:00
|
|
|
*/
|
1998-09-30 03:15:01 +04:00
|
|
|
virtual nsReflowStatus ResizeReflowPass2(nsIPresContext* aPresContext,
|
1998-10-01 08:46:11 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
1998-10-02 08:10:00 +04:00
|
|
|
const nsHTMLReflowState& aReflowState);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-07-07 01:39:23 +04:00
|
|
|
nsresult AdjustSiblingsAfterReflow(nsIPresContext* aPresContext,
|
|
|
|
InnerTableReflowState& aState,
|
|
|
|
nsIFrame* aKidFrame,
|
|
|
|
nscoord aDeltaY);
|
|
|
|
|
1998-09-01 01:23:28 +04:00
|
|
|
/** return the desired width of this table accounting for the current
|
|
|
|
* reflow state, and for the table attributes and parent
|
|
|
|
*/
|
1998-10-02 08:10:00 +04:00
|
|
|
nscoord ComputeDesiredWidth(const nsHTMLReflowState& aReflowState) const;
|
1998-09-01 01:23:28 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
nscoord GetTopMarginFor(nsIPresContext* aCX,
|
|
|
|
InnerTableReflowState& aState,
|
1998-05-13 02:28:01 +04:00
|
|
|
const nsMargin& aKidMargin);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
void PlaceChild(nsIPresContext* aPresContext,
|
|
|
|
InnerTableReflowState& aState,
|
|
|
|
nsIFrame* aKidFrame,
|
|
|
|
const nsRect& aKidRect,
|
|
|
|
nsSize* aMaxElementSize,
|
|
|
|
nsSize& aKidMaxElementSize);
|
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/**
|
|
|
|
* Reflow the frames we've already created
|
|
|
|
*
|
|
|
|
* @param aPresContext presentation context to use
|
|
|
|
* @param aState current inline state
|
|
|
|
* @return true if we successfully reflowed all the mapped children and false
|
|
|
|
* otherwise, e.g. we pushed children to the next in flow
|
|
|
|
*/
|
1998-04-14 00:24:54 +04:00
|
|
|
PRBool ReflowMappedChildren(nsIPresContext* aPresContext,
|
|
|
|
InnerTableReflowState& aState,
|
|
|
|
nsSize* aMaxElementSize);
|
1998-04-15 01:45:28 +04:00
|
|
|
/**
|
|
|
|
* Try and pull-up frames from our next-in-flow
|
|
|
|
*
|
|
|
|
* @param aPresContext presentation context to use
|
|
|
|
* @param aState current inline state
|
|
|
|
* @return true if we successfully pulled-up all the children and false
|
|
|
|
* otherwise, e.g. child didn't fit
|
|
|
|
*/
|
1998-04-14 00:24:54 +04:00
|
|
|
PRBool PullUpChildren(nsIPresContext* aPresContext,
|
|
|
|
InnerTableReflowState& aState,
|
|
|
|
nsSize* aMaxElementSize);
|
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** assign widths for each column, taking into account the table content, the effective style,
|
|
|
|
* the layout constraints, and the compatibility mode. Sets mColumnWidths as a side effect.
|
|
|
|
* @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
|
|
|
*/
|
1998-10-02 08:10:00 +04:00
|
|
|
virtual void BalanceColumnWidths(nsIPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
const nsSize& aMaxSize,
|
|
|
|
nsSize* aMaxElementSize);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** sets the width of the table according to the computed widths of each column. */
|
1998-04-25 22:48:48 +04:00
|
|
|
virtual void SetTableWidth(nsIPresContext* aPresContext);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
|
|
|
virtual void VerticallyAlignChildren(nsIPresContext* aPresContext,
|
|
|
|
nscoord* aAscents,
|
|
|
|
nscoord aMaxAscent,
|
|
|
|
nscoord aMaxHeight);
|
|
|
|
|
|
|
|
/** given the new parent size, do I really need to do a reflow? */
|
|
|
|
virtual PRBool NeedsReflow(const nsSize& aMaxSize);
|
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** what stage of reflow is currently in process? */
|
1998-04-14 00:24:54 +04:00
|
|
|
virtual PRInt32 GetReflowPass() const;
|
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** sets the reflow pass flag. use with caution! */
|
1998-04-14 00:24:54 +04:00
|
|
|
virtual void SetReflowPass(PRInt32 aReflowPass);
|
|
|
|
|
1998-04-15 01:45:28 +04:00
|
|
|
/** returns PR_TRUE if the cached pass 1 data is still valid */
|
1998-04-14 00:24:54 +04:00
|
|
|
virtual PRBool IsFirstPassValid() const;
|
|
|
|
|
1998-05-02 00:44:55 +04:00
|
|
|
/** do post processing to setting up style information for the frame */
|
1998-05-27 03:17:29 +04:00
|
|
|
NS_IMETHOD DidSetStyleContext(nsIPresContext* aPresContext);
|
1998-05-02 00:44:55 +04:00
|
|
|
|
1998-05-27 00:57:24 +04:00
|
|
|
/** Support methods for DidSetStyleContext */
|
|
|
|
void MapBorderMarginPadding(nsIPresContext* aPresContext);
|
|
|
|
void MapHTMLBorderStyle(nsStyleSpacing& aSpacingStyle, nscoord aBorderWidth);
|
|
|
|
PRBool ConvertToPixelValue(nsHTMLValue& aValue, PRInt32 aDefault, PRInt32& aResult);
|
|
|
|
|
1998-06-17 20:38:24 +04:00
|
|
|
/** called whenever the number of columns changes, to increase the storage in mCellMap
|
|
|
|
*/
|
|
|
|
virtual void GrowCellMap(PRInt32 aColCount);
|
|
|
|
|
|
|
|
/** ResetCellMap is called when the cell structure of the table is changed.
|
|
|
|
* Call with caution, only when changing the structure of the table such as
|
|
|
|
* inserting or removing rows, changing the rowspan or colspan attribute of a cell, etc.
|
|
|
|
*/
|
|
|
|
virtual void ResetCellMap ();
|
|
|
|
|
1998-08-14 20:16:43 +04:00
|
|
|
/** Get the cell map for this table frame. It is not always mCellMap.
|
|
|
|
* Only the firstInFlow has a legit cell map
|
|
|
|
*/
|
|
|
|
virtual nsCellMap *GetCellMap();
|
|
|
|
|
1998-07-11 04:00:31 +04:00
|
|
|
/** for debugging only
|
|
|
|
* prints out information about the cell map
|
|
|
|
*/
|
1998-07-24 20:51:16 +04:00
|
|
|
void DumpCellMap();
|
1998-07-11 04:00:31 +04:00
|
|
|
|
|
|
|
/** for debugging only
|
|
|
|
* prints out info about the table layout state, printing columns and their cells
|
|
|
|
*/
|
1998-07-24 20:51:16 +04:00
|
|
|
void ListColumnLayoutData(FILE* out, PRInt32 aIndent);
|
1998-07-11 04:00:31 +04:00
|
|
|
|
1998-06-17 20:38:24 +04:00
|
|
|
/** sum the columns represented by all nsTableColGroup objects.
|
|
|
|
* if the cell map says there are more columns than this,
|
|
|
|
* add extra implicit columns to the content tree.
|
|
|
|
*/
|
1998-09-24 01:48:26 +04:00
|
|
|
virtual void EnsureColumns (nsIPresContext* aPresContext);
|
1998-06-17 20:38:24 +04:00
|
|
|
|
1998-09-01 01:23:28 +04:00
|
|
|
/** Set the min col span for every column in the table. Scans the whole table. */
|
|
|
|
virtual void SetMinColSpanForTable();
|
1998-06-17 20:38:24 +04:00
|
|
|
|
1998-10-02 08:10:00 +04:00
|
|
|
virtual void BuildColumnCache(nsIPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
1998-06-17 20:38:24 +04:00
|
|
|
|
|
|
|
/** called every time we discover we have a new cell to add to the table.
|
|
|
|
* This could be because we got actual cell content, because of rowspan/colspan attributes, etc.
|
|
|
|
* This method changes mCellMap as necessary to account for the new cell.
|
|
|
|
*
|
|
|
|
* @param aCell the content object created for the cell
|
|
|
|
* @param aRowIndex the row into which the cell is to be inserted
|
|
|
|
* @param aColIndex the col into which the cell is to be inserted
|
|
|
|
*/
|
|
|
|
virtual void BuildCellIntoMap (nsTableCellFrame *aCell, PRInt32 aRowIndex, PRInt32 aColIndex);
|
|
|
|
|
|
|
|
/** returns the index of the first child after aStartIndex that is a row group
|
|
|
|
*/
|
1998-07-02 02:22:28 +04:00
|
|
|
virtual nsTableRowGroupFrame* NextRowGroupFrame (nsTableRowGroupFrame*);
|
1998-06-17 20:38:24 +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 ();
|
|
|
|
|
|
|
|
public: /* ----- Cell Map public methods ----- */
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
virtual PRInt32 GetRowCount();
|
|
|
|
|
1998-09-19 02:37:14 +04:00
|
|
|
/** returns the number of columns in this table. */
|
1998-07-22 07:53:43 +04:00
|
|
|
virtual PRInt32 GetColCount();
|
|
|
|
|
1998-07-24 20:51:16 +04:00
|
|
|
/** adjust the col count for screwy table attributes.
|
|
|
|
* currently just handles excess colspan at end of table
|
|
|
|
*/
|
|
|
|
virtual void SetEffectiveColCount();
|
|
|
|
|
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);
|
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-19 02:37:14 +04:00
|
|
|
/** returns PR_TRUE if the row at aRowIndex has any cells that are the result
|
|
|
|
* of a row-spanning cell above it.
|
|
|
|
* @see nsCellMap::RowIsSpannedInto
|
|
|
|
*/
|
|
|
|
PRBool RowIsSpannedInto(PRInt32 aRowIndex);
|
1998-06-17 20:38:24 +04:00
|
|
|
|
1998-09-19 02:37:14 +04:00
|
|
|
/** returns PR_TRUE if the row at aRowIndex has any cells that have a rowspan>1
|
|
|
|
* that originate in aRowIndex.
|
|
|
|
* @see nsCellMap::RowHasSpanningCells
|
|
|
|
*/
|
|
|
|
PRBool RowHasSpanningCells(PRInt32 aRowIndex);
|
|
|
|
|
|
|
|
/** returns PR_TRUE if the col at aColIndex has any cells that are the result
|
|
|
|
* of a col-spanning cell.
|
|
|
|
* @see nsCellMap::ColIsSpannedInto
|
|
|
|
*/
|
|
|
|
PRBool ColIsSpannedInto(PRInt32 aColIndex);
|
|
|
|
|
|
|
|
/** returns PR_TRUE if the row at aColIndex has any cells that have a colspan>1
|
|
|
|
* @see nsCellMap::ColHasSpanningCells
|
|
|
|
*/
|
|
|
|
PRBool ColHasSpanningCells(PRInt32 aColIndex);
|
1998-05-22 03:43:18 +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();
|
|
|
|
|
1998-10-08 19:34:48 +04:00
|
|
|
/** return the minimum width of the table. Return 0 if the min width is unknown. */
|
|
|
|
nscoord GetMinTableWidth();
|
|
|
|
|
|
|
|
/** return the maximum width of the table caption. Return 0 if the max width is unknown. */
|
|
|
|
nscoord GetMaxTableWidth();
|
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
private:
|
1998-05-20 03:11:28 +04:00
|
|
|
void DebugPrintCount() const; // Debugging routine
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
|
|
|
|
/** table reflow is a multi-pass operation. Use these constants to keep track of
|
|
|
|
* which pass is currently being executed.
|
|
|
|
*/
|
1998-06-23 09:43:27 +04:00
|
|
|
enum {kPASS_UNDEFINED=0, kPASS_FIRST=1, kPASS_SECOND=2, kPASS_THIRD=3, kPASS_INCREMENTAL=4};
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
PRInt32 *mColumnWidths; // widths of each column
|
1998-06-05 06:36:25 +04:00
|
|
|
ColumnInfoCache *mColCache; // cached information about the table columns
|
1998-04-14 00:24:54 +04:00
|
|
|
PRBool mFirstPassValid; // PR_TRUE if first pass data is still legit
|
|
|
|
PRInt32 mPass; // which Reflow pass are we currently in?
|
|
|
|
PRBool mIsInvariantWidth; // PR_TRUE if table width cannot change
|
1998-04-30 21:57:09 +04:00
|
|
|
nsITableLayoutStrategy * mTableLayoutStrategy; // the layout strategy for this frame
|
1998-06-17 20:38:24 +04:00
|
|
|
PRInt32 mColCount; // the number of columns in this table
|
1998-07-24 20:51:16 +04:00
|
|
|
PRInt32 mEffectiveColCount; // the number of columns in this table adjusted for weird table attributes
|
1998-06-17 20:38:24 +04:00
|
|
|
nsCellMap* mCellMap; // maintains the relationships between rows, cols, and cells
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
1998-09-30 03:15:01 +04:00
|
|
|
|
1998-10-08 19:34:48 +04:00
|
|
|
#endif
|