2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1998-04-14 00:24:54 +04:00
|
|
|
#ifndef nsTableColGroupFrame_h__
|
|
|
|
#define nsTableColGroupFrame_h__
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
#include "nscore.h"
|
2011-12-28 00:18:48 +04:00
|
|
|
#include "nsContainerFrame.h"
|
1999-12-14 03:24:33 +03:00
|
|
|
#include "nsTableColFrame.h"
|
1998-04-14 00:24:54 +04:00
|
|
|
|
2012-08-08 17:05:17 +04:00
|
|
|
class nsTableFrame;
|
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
|
|
|
|
*/
|
2011-12-28 00:18:48 +04:00
|
|
|
class nsTableColGroupFrame : public nsContainerFrame
|
1998-04-14 00:24:54 +04:00
|
|
|
{
|
|
|
|
public:
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
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
|
|
|
|
*/
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD SetInitialChildList(ChildListID aListID,
|
2012-09-14 20:10:08 +04:00
|
|
|
nsFrameList& aChildList) MOZ_OVERRIDE;
|
1998-09-16 21:19:20 +04:00
|
|
|
|
2006-01-26 05:29:17 +03:00
|
|
|
/**
|
|
|
|
* ColGroups never paint anything, nor receive events.
|
|
|
|
*/
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE {}
|
2006-01-26 05:29:17 +03:00
|
|
|
|
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
|
2009-07-30 21:23:32 +04:00
|
|
|
* @return the last real colgroup
|
2004-05-03 22:31:34 +04:00
|
|
|
*/
|
2009-07-30 21:23:32 +04:00
|
|
|
static nsTableColGroupFrame* GetLastRealColGroup(nsTableFrame* aTableFrame);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2008-10-26 13:11:34 +03:00
|
|
|
/** @see nsIFrame::DidSetStyleContext */
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) MOZ_OVERRIDE;
|
2008-10-26 13:11:34 +03:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** @see nsIFrame::AppendFrames, InsertFrames, RemoveFrame
|
|
|
|
*/
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD AppendFrames(ChildListID aListID,
|
2012-09-14 20:10:08 +04:00
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD InsertFrames(ChildListID aListID,
|
1999-08-06 18:34:56 +04:00
|
|
|
nsIFrame* aPrevFrame,
|
2012-09-14 20:10:08 +04:00
|
|
|
nsFrameList& aFrameList) MOZ_OVERRIDE;
|
2011-08-25 00:54:30 +04:00
|
|
|
NS_IMETHOD RemoveFrame(ChildListID aListID,
|
2012-09-14 20:10:08 +04:00
|
|
|
nsIFrame* aOldFrame) MOZ_OVERRIDE;
|
1999-08-06 18:34:56 +04:00
|
|
|
|
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,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool 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,
|
2012-09-14 20:10:08 +04:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
1998-04-17 05:41:24 +04:00
|
|
|
|
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
|
|
|
*/
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
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
|
2009-07-30 21:23:32 +04:00
|
|
|
* @param aCols - an iterator that can be used to iterate over the col
|
|
|
|
* frames to be added. Once this is done, the frames on the
|
|
|
|
* sbling chain of its .get() at that point will still need
|
|
|
|
* their col indices updated.
|
2004-05-03 22:31:34 +04:00
|
|
|
* @result - if there is no table frame or the table frame is not
|
|
|
|
* the first in flow it will return an error
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult AddColsToTable(int32_t aFirstColIndex,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aResetSubsequentColIndices,
|
2009-07-30 21:23:32 +04:00
|
|
|
const nsFrameList::Slice& aCols);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
1999-09-01 05:02:16 +04:00
|
|
|
#ifdef DEBUG
|
2012-09-14 20:10:08 +04:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
2012-08-22 19:56:38 +04:00
|
|
|
void Dump(int32_t 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.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual int32_t 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.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t 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
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetStartColumnIndex(int32_t 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 */
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetSpan();
|
1998-09-24 01:48:26 +04:00
|
|
|
|
2004-05-03 22:31:34 +04:00
|
|
|
/** provide access to the mFrames list
|
|
|
|
*/
|
2009-07-28 16:53:18 +04:00
|
|
|
nsFrameList& GetWritableChildList();
|
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,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aFirstColIndex,
|
2012-07-30 18:20:58 +04:00
|
|
|
nsIFrame* aStartColFrame = nullptr);
|
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
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetContinuousBCBorderWidth(uint8_t aForSide,
|
2004-03-09 09:48:35 +03:00
|
|
|
BCPixelSize aPixelValue);
|
2012-08-29 09:39:31 +04:00
|
|
|
|
2012-08-29 09:48:45 +04:00
|
|
|
virtual void InvalidateFrame(uint32_t aDisplayItemKey = 0) MOZ_OVERRIDE;
|
|
|
|
virtual void InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey = 0) MOZ_OVERRIDE;
|
|
|
|
virtual void InvalidateFrameForRemoval() MOZ_OVERRIDE { InvalidateFrameSubtree(); }
|
2012-08-29 09:39:31 +04:00
|
|
|
|
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
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void InsertColsReflow(int32_t aColIndex,
|
2009-07-30 21:23:32 +04:00
|
|
|
const nsFrameList::Slice& aCols);
|
1999-12-14 01:56:31 +03:00
|
|
|
|
2013-02-04 20:17:31 +04:00
|
|
|
virtual int GetSkipSides() const MOZ_OVERRIDE;
|
1998-10-20 21:45:07 +04:00
|
|
|
|
2001-11-30 18:05:51 +03:00
|
|
|
// data members
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mColCount;
|
2001-11-30 18:05:51 +03:00
|
|
|
// the starting column index this col group represents. Must be >= 0.
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t 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)
|
2011-12-28 00:18:48 +04:00
|
|
|
: nsContainerFrame(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
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
inline int32_t nsTableColGroupFrame::GetStartColumnIndex()
|
1999-12-14 01:56:31 +03:00
|
|
|
{
|
|
|
|
return mStartColIndex;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
inline void nsTableColGroupFrame::SetStartColumnIndex (int32_t aIndex)
|
2004-05-03 22:31:34 +04:00
|
|
|
{
|
|
|
|
mStartColIndex = aIndex;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
inline int32_t nsTableColGroupFrame::GetColCount() const
|
1999-12-14 01:56:31 +03:00
|
|
|
{
|
|
|
|
return mColCount;
|
|
|
|
}
|
|
|
|
|
2009-07-28 16:53:18 +04:00
|
|
|
inline nsFrameList& nsTableColGroupFrame::GetWritableChildList()
|
1999-12-14 01:56:31 +03:00
|
|
|
{
|
|
|
|
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
|
|
|
|