2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 18:30:37 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-04-14 00:24:54 +04:00
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The contents of this file are subject to the Mozilla 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/MPL/
|
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.
|
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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
|
2004-04-18 18:30:37 +04:00
|
|
|
* either of 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"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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
|
2004-04-18 18:30:37 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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
|
2004-04-18 18:30:37 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-04-14 00:24:54 +04:00
|
|
|
#ifndef nsTableColGroupFrame_h__
|
|
|
|
#define nsTableColGroupFrame_h__
|
|
|
|
|
|
|
|
#include "nscore.h"
|
1998-10-20 21:45:07 +04:00
|
|
|
#include "nsHTMLContainerFrame.h"
|
1999-12-14 03:24:33 +03:00
|
|
|
#include "nsTableColFrame.h"
|
2004-03-09 09:48:35 +03:00
|
|
|
#include "nsTablePainter.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
1998-09-24 20:37:22 +04:00
|
|
|
class nsTableColFrame;
|
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
enum nsTableColGroupType {
|
|
|
|
eColGroupContent = 0, // there is real col group content associated
|
|
|
|
eColGroupAnonymousCol = 1, // the result of a col
|
2001-11-30 18:05:51 +03:00
|
|
|
eColGroupAnonymousCell = 2 // the result of a cell alone
|
1999-12-14 01:56:31 +03:00
|
|
|
};
|
1998-04-14 00:24:54 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* nsTableColGroupFrame
|
|
|
|
* data structure to maintain information about a single table cell's frame
|
|
|
|
*
|
|
|
|
* @author sclark
|
|
|
|
*/
|
1998-10-20 21:45:07 +04:00
|
|
|
class nsTableColGroupFrame : public nsHTMLContainerFrame
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
|
|
|
public:
|
1998-12-03 23:19:01 +03:00
|
|
|
|
|
|
|
// default constructor supplied by the compiler
|
|
|
|
|
2005-11-04 05:38:33 +03:00
|
|
|
/** instantiate a new instance of nsTableRowFrame.
|
|
|
|
* @param aPresShell the pres shell for this frame
|
1998-09-15 21:58:24 +04:00
|
|
|
*
|
2005-11-04 05:38:33 +03:00
|
|
|
* @return the frame that was created
|
1998-09-15 21:58:24 +04:00
|
|
|
*/
|
2006-03-27 01:30:36 +04:00
|
|
|
friend nsIFrame* NS_NewTableColGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** Initialize the colgroup frame with a set of children.
|
|
|
|
* @see nsIFrame::SetInitialChildList
|
|
|
|
*/
|
2006-04-10 04:16:29 +04:00
|
|
|
NS_IMETHOD SetInitialChildList(nsIAtom* aListName,
|
1998-11-10 09:05:32 +03:00
|
|
|
nsIFrame* aChildList);
|
1998-09-16 21:19:20 +04:00
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
/**
|
|
|
|
* ColGroups never paint anything, nor receive events.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) { return NS_OK; }
|
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** A colgroup can be caused by three things:
|
|
|
|
* 1) An element with table-column-group display
|
|
|
|
* 2) An element with a table-column display without a
|
|
|
|
* table-column-group parent
|
|
|
|
* 3) Cells that are not in a column (and hence get an anonymous
|
|
|
|
* column and colgroup).
|
|
|
|
* @return colgroup type
|
|
|
|
*/
|
2003-10-31 23:19:18 +03:00
|
|
|
nsTableColGroupType GetColType() const;
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** Set the colgroup type based on the creation cause
|
|
|
|
* @param aType - the reason why this colgroup is needed
|
|
|
|
*/
|
2003-10-31 23:19:18 +03:00
|
|
|
void SetColType(nsTableColGroupType aType);
|
2004-05-03 22:31:34 +04:00
|
|
|
|
|
|
|
/** Real in this context are colgroups that come from an element
|
|
|
|
* with table-column-group display or wrap around columns that
|
|
|
|
* come from an element with table-column display. Colgroups
|
|
|
|
* that are the result of wrapping cells in an anonymous
|
|
|
|
* column and colgroup are not considered real here.
|
|
|
|
* @param aTableFrame - the table parent of the colgroups
|
|
|
|
* @param aLastColgroup - the last real colgroup
|
|
|
|
* @return is false if there is a non real colgroup at the end
|
|
|
|
*/
|
1999-12-14 01:56:31 +03:00
|
|
|
static PRBool GetLastRealColGroup(nsTableFrame* aTableFrame,
|
|
|
|
nsIFrame** aLastColGroup);
|
|
|
|
|
2008-10-26 13:11:34 +03:00
|
|
|
/** @see nsIFrame::DidSetStyleContext */
|
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
|
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** @see nsIFrame::AppendFrames, InsertFrames, RemoveFrame
|
|
|
|
*/
|
2005-02-07 04:58:25 +03:00
|
|
|
NS_IMETHOD AppendFrames(nsIAtom* aListName,
|
1999-08-06 18:34:56 +04:00
|
|
|
nsIFrame* aFrameList);
|
2005-02-07 04:58:25 +03:00
|
|
|
NS_IMETHOD InsertFrames(nsIAtom* aListName,
|
1999-08-06 18:34:56 +04:00
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList);
|
2005-02-07 04:58:25 +03:00
|
|
|
NS_IMETHOD RemoveFrame(nsIAtom* aListName,
|
1999-08-06 18:34:56 +04:00
|
|
|
nsIFrame* aOldFrame);
|
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** remove the column aChild from the column group, if requested renumber
|
|
|
|
* the subsequent columns in this column group and all following column
|
|
|
|
* groups. see also ResetColIndices for this
|
|
|
|
* @param aChild - the column frame that needs to be removed
|
|
|
|
* @param aResetSubsequentColIndices - if true the columns that follow
|
|
|
|
* after aChild will be reenumerated
|
|
|
|
*/
|
2005-02-07 04:58:25 +03:00
|
|
|
void RemoveChild(nsTableColFrame& aChild,
|
2004-05-03 22:31:34 +04:00
|
|
|
PRBool aResetSubsequentColIndices);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
1998-05-29 01:39:22 +04:00
|
|
|
/** reflow of a column group is a trivial matter of reflowing
|
|
|
|
* the col group's children (columns), and setting this frame
|
|
|
|
* to 0-size. Since tables are row-centric, column group frames
|
|
|
|
* don't play directly in the rendering game. They do however
|
|
|
|
* maintain important state that effects table and cell layout.
|
|
|
|
*/
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
1998-10-02 08:10:00 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
1998-04-17 05:41:24 +04:00
|
|
|
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 08:38:33 +03:00
|
|
|
/* needed only because we use Reflow in a hacky way, see
|
|
|
|
nsTableFrame::ReflowColGroups */
|
|
|
|
virtual PRBool IsContainingBlock() const;
|
|
|
|
|
2008-07-14 02:41:18 +04:00
|
|
|
virtual PRBool IsFrameOfType(PRUint32 aFlags) const
|
|
|
|
{
|
|
|
|
return nsHTMLContainerFrame::IsFrameOfType(aFlags &
|
|
|
|
~nsIFrame::eExcludesIgnorableWhitespace);
|
|
|
|
}
|
|
|
|
|
1999-10-02 04:02:54 +04:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
2007-01-30 03:06:41 +03:00
|
|
|
* @see nsGkAtoms::tableColGroupFrame
|
1999-10-02 04:02:54 +04:00
|
|
|
*/
|
2003-10-31 23:19:18 +03:00
|
|
|
virtual nsIAtom* GetType() const;
|
2004-05-03 22:31:34 +04:00
|
|
|
|
|
|
|
/** Add column frames to the table storages: colframe cache and cellmap
|
|
|
|
* this doesn't change the mFrames of the colgroup frame.
|
|
|
|
* @param aFirstColIndex - the index at which aFirstFrame should be inserted
|
|
|
|
* into the colframe cache.
|
|
|
|
* @param aResetSubsequentColIndices - the indices of the col frames
|
|
|
|
* after the insertion might need
|
|
|
|
* an update
|
|
|
|
* @param aFirstFrame - first frame that needs to be added to the table,
|
|
|
|
* the frame should have a correctly set sibling
|
|
|
|
* @param aLastFrame - last frame that needs to be added. It can be either
|
|
|
|
* null or should be in the sibling chain of
|
|
|
|
* aFirstFrame
|
|
|
|
* @result - if there is no table frame or the table frame is not
|
|
|
|
* the first in flow it will return an error
|
|
|
|
*/
|
2005-02-07 04:58:25 +03:00
|
|
|
nsresult AddColsToTable(PRInt32 aFirstColIndex,
|
2004-05-03 22:31:34 +04:00
|
|
|
PRBool aResetSubsequentColIndices,
|
|
|
|
nsIFrame* aFirstFrame,
|
|
|
|
nsIFrame* aLastFrame = nsnull);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
1999-09-01 05:02:16 +04:00
|
|
|
#ifdef DEBUG
|
2001-11-14 04:33:42 +03:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
2004-09-04 20:02:50 +04:00
|
|
|
void Dump(PRInt32 aIndent);
|
1999-09-01 05:02:16 +04:00
|
|
|
#endif
|
1998-11-19 20:22:29 +03:00
|
|
|
|
1998-06-17 20:38:24 +04:00
|
|
|
/** returns the number of columns represented by this group.
|
|
|
|
* if there are col children, count them (taking into account the span of each)
|
|
|
|
* else, check my own span attribute.
|
|
|
|
*/
|
1999-12-14 01:56:31 +03:00
|
|
|
virtual PRInt32 GetColCount() const;
|
1998-06-17 20:38:24 +04:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** first column on the child list */
|
|
|
|
nsTableColFrame * GetFirstColumn();
|
|
|
|
/** next sibling to aChildFrame that is a column frame, first column frame
|
|
|
|
* in the column group if aChildFrame is null
|
|
|
|
*/
|
|
|
|
nsTableColFrame * GetNextColumn(nsIFrame *aChildFrame);
|
1998-10-15 02:51:50 +04:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** @return - the position of the first column in this colgroup in the table
|
|
|
|
* colframe cache.
|
|
|
|
*/
|
|
|
|
PRInt32 GetStartColumnIndex();
|
1998-06-17 20:38:24 +04:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** set the position of the first column in this colgroup in the table
|
|
|
|
* colframe cache.
|
1998-10-15 02:51:50 +04:00
|
|
|
*/
|
2004-05-03 22:31:34 +04:00
|
|
|
void SetStartColumnIndex(PRInt32 aIndex);
|
1998-06-17 20:38:24 +04:00
|
|
|
|
1998-09-24 01:48:26 +04:00
|
|
|
/** helper method to get the span attribute for this colgroup */
|
|
|
|
PRInt32 GetSpan();
|
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** provide access to the mFrames list
|
|
|
|
*/
|
1999-12-14 01:56:31 +03:00
|
|
|
nsFrameList& GetChildList();
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** set the column index for all frames starting at aStartColFrame, it
|
|
|
|
* will also reset the column indices in all subsequent colgroups
|
|
|
|
* @param aFirstColGroup - start the reset operation inside this colgroup
|
|
|
|
* @param aFirstColIndex - first column that is reset should get this index
|
|
|
|
* @param aStartColFrame - if specified the reset starts with this column
|
|
|
|
* inside the colgroup; if not specified, the reset
|
|
|
|
* starts with the first column
|
|
|
|
*/
|
2004-01-18 13:28:40 +03:00
|
|
|
static void ResetColIndices(nsIFrame* aFirstColGroup,
|
2000-01-22 04:16:50 +03:00
|
|
|
PRInt32 aFirstColIndex,
|
|
|
|
nsIFrame* aStartColFrame = nsnull);
|
2004-03-09 09:48:35 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets inner border widths before collapsing with cell borders
|
|
|
|
* Caller must get left border from previous column
|
|
|
|
* GetContinuousBCBorderWidth will not overwrite aBorder.left
|
|
|
|
* see nsTablePainter about continuous borders
|
|
|
|
*/
|
2007-02-07 10:46:44 +03:00
|
|
|
void GetContinuousBCBorderWidth(nsMargin& aBorder);
|
2004-03-09 09:48:35 +03:00
|
|
|
/**
|
|
|
|
* Set full border widths before collapsing with cell borders
|
|
|
|
* @param aForSide - side to set; only accepts top and bottom
|
|
|
|
*/
|
|
|
|
void SetContinuousBCBorderWidth(PRUint8 aForSide,
|
|
|
|
BCPixelSize aPixelValue);
|
1999-12-14 01:56:31 +03:00
|
|
|
protected:
|
2006-03-27 01:30:36 +04:00
|
|
|
nsTableColGroupFrame(nsStyleContext* aContext);
|
1999-08-10 06:45:18 +04:00
|
|
|
|
2005-02-07 04:58:25 +03:00
|
|
|
void InsertColsReflow(PRInt32 aColIndex,
|
1999-12-14 01:56:31 +03:00
|
|
|
nsIFrame* aFirstFrame,
|
|
|
|
nsIFrame* aLastFrame = nsnull);
|
|
|
|
|
1998-10-20 21:45:07 +04:00
|
|
|
/** implement abstract method on nsHTMLContainerFrame */
|
|
|
|
virtual PRIntn GetSkipSides() const;
|
|
|
|
|
2001-11-30 18:05:51 +03:00
|
|
|
// data members
|
1998-06-17 20:38:24 +04:00
|
|
|
PRInt32 mColCount;
|
2001-11-30 18:05:51 +03:00
|
|
|
// the starting column index this col group represents. Must be >= 0.
|
1998-06-17 20:38:24 +04:00
|
|
|
PRInt32 mStartColIndex;
|
2004-03-09 09:48:35 +03:00
|
|
|
|
|
|
|
// border width in pixels
|
|
|
|
BCPixelSize mTopContBorderWidth;
|
|
|
|
BCPixelSize mBottomContBorderWidth;
|
1998-04-14 00:24:54 +04:00
|
|
|
};
|
|
|
|
|
2006-03-27 01:30:36 +04:00
|
|
|
inline nsTableColGroupFrame::nsTableColGroupFrame(nsStyleContext *aContext)
|
|
|
|
: nsHTMLContainerFrame(aContext), mColCount(0), mStartColIndex(0)
|
1999-12-14 01:56:31 +03:00
|
|
|
{
|
2003-10-31 23:19:18 +03:00
|
|
|
SetColType(eColGroupContent);
|
1999-12-14 01:56:31 +03:00
|
|
|
}
|
1999-08-10 06:45:18 +04:00
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
inline PRInt32 nsTableColGroupFrame::GetStartColumnIndex()
|
|
|
|
{
|
|
|
|
return mStartColIndex;
|
|
|
|
}
|
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
inline void nsTableColGroupFrame::SetStartColumnIndex (PRInt32 aIndex)
|
|
|
|
{
|
|
|
|
mStartColIndex = aIndex;
|
|
|
|
}
|
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
inline PRInt32 nsTableColGroupFrame::GetColCount() const
|
|
|
|
{
|
|
|
|
return mColCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nsFrameList& nsTableColGroupFrame::GetChildList()
|
|
|
|
{
|
|
|
|
return mFrames;
|
|
|
|
}
|
1999-08-10 06:45:18 +04:00
|
|
|
|
1998-04-14 00:24:54 +04:00
|
|
|
#endif
|
1999-12-14 01:56:31 +03:00
|
|
|
|