2001-09-28 20:14:13 +00: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-13 20:24:54 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00: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-13 20:24:54 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00: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-13 20:24:54 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-28 20:14:13 +00: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 03:40:37 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00: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-13 20:24:54 +00:00
|
|
|
#ifndef nsTableCellFrame_h__
|
|
|
|
#define nsTableCellFrame_h__
|
|
|
|
|
1999-02-11 01:16:28 +00:00
|
|
|
#include "nsITableCellLayout.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nscore.h"
|
1998-10-20 17:45:07 +00:00
|
|
|
#include "nsHTMLContainerFrame.h"
|
1998-07-11 00:00:31 +00:00
|
|
|
#include "nsTableRowFrame.h" // need to actually include this here to inline GetRowIndex
|
1998-12-21 06:38:18 +00:00
|
|
|
#include "nsIStyleContext.h"
|
2001-12-07 14:51:12 +00:00
|
|
|
#include "nsIPercentHeightObserver.h"
|
2002-02-19 15:48:28 +00:00
|
|
|
#include "nsLayoutAtoms.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1998-11-11 19:56:02 +00:00
|
|
|
class nsTableFrame;
|
|
|
|
class nsHTMLValue;
|
1998-06-23 23:23:21 +00:00
|
|
|
|
1999-10-15 03:14:59 +00:00
|
|
|
/**
|
|
|
|
* Additional frame-state bits
|
|
|
|
*/
|
2001-11-05 00:15:51 +00:00
|
|
|
#define NS_TABLE_CELL_CONTENT_EMPTY 0x80000000
|
|
|
|
#define NS_TABLE_CELL_NEED_SPECIAL_REFLOW 0x40000000
|
2001-12-07 14:51:12 +00:00
|
|
|
#define NS_TABLE_CELL_HAD_SPECIAL_REFLOW 0x20000000
|
|
|
|
#define NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT 0x10000000
|
1999-10-15 03:14:59 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
/**
|
|
|
|
* nsTableCellFrame
|
|
|
|
* data structure to maintain information about a single table cell's frame
|
|
|
|
*
|
1999-02-11 01:16:28 +00:00
|
|
|
* NOTE: frames are not ref counted. We expose addref and release here
|
|
|
|
* so we can change that decsion in the future. Users of nsITableCellLayout
|
|
|
|
* should refcount correctly as if this object is being ref counted, though
|
|
|
|
* no actual support is under the hood.
|
|
|
|
*
|
1998-04-13 20:24:54 +00:00
|
|
|
* @author sclark
|
|
|
|
*/
|
2001-12-07 14:51:12 +00:00
|
|
|
class nsTableCellFrame : public nsHTMLContainerFrame,
|
|
|
|
public nsITableCellLayout,
|
|
|
|
public nsIPercentHeightObserver
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
|
|
|
public:
|
1998-06-11 00:13:18 +00:00
|
|
|
|
1999-02-11 01:16:28 +00:00
|
|
|
// nsISupports
|
1999-03-06 03:56:24 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
1999-02-11 01:16:28 +00:00
|
|
|
|
1999-10-08 18:52:19 +00:00
|
|
|
// default constructor supplied by the compiler
|
1998-12-03 20:19:01 +00:00
|
|
|
|
2000-01-04 05:31:56 +00:00
|
|
|
nsTableCellFrame();
|
1999-10-17 03:30:11 +00:00
|
|
|
~nsTableCellFrame();
|
|
|
|
|
1999-11-24 06:03:41 +00:00
|
|
|
NS_IMETHOD Init(nsIPresContext* aPresContext,
|
1999-02-25 05:31:15 +00:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIStyleContext* aContext,
|
|
|
|
nsIFrame* aPrevInFlow);
|
|
|
|
|
2001-08-17 03:13:07 +00:00
|
|
|
#ifdef ACCESSIBILITY
|
2001-05-17 23:52:32 +00:00
|
|
|
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
|
2001-08-17 03:13:07 +00:00
|
|
|
#endif
|
2001-05-17 23:52:32 +00:00
|
|
|
|
|
|
|
|
2000-01-04 05:31:56 +00:00
|
|
|
NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aChild,
|
|
|
|
PRInt32 aNameSpaceID,
|
|
|
|
nsIAtom* aAttribute,
|
2001-08-25 02:01:08 +00:00
|
|
|
PRInt32 aModType,
|
2000-01-04 05:31:56 +00:00
|
|
|
PRInt32 aHint);
|
|
|
|
|
1999-08-01 22:21:03 +00:00
|
|
|
// table cells contain an area frame which does most of the work, and
|
|
|
|
// so these functions should never be called. They assert and return
|
|
|
|
// NS_ERROR_NOT_IMPLEMENTED
|
1999-11-24 06:03:41 +00:00
|
|
|
NS_IMETHOD AppendFrames(nsIPresContext* aPresContext,
|
1999-08-01 22:21:03 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList);
|
1999-11-24 06:03:41 +00:00
|
|
|
NS_IMETHOD InsertFrames(nsIPresContext* aPresContext,
|
1999-08-01 22:21:03 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList);
|
1999-11-24 06:03:41 +00:00
|
|
|
NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext,
|
1999-08-01 22:21:03 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame);
|
|
|
|
|
2002-04-10 21:32:41 +00:00
|
|
|
virtual void NotifyPercentHeight(const nsHTMLReflowState& aReflowState);
|
2001-12-07 14:51:12 +00:00
|
|
|
|
2002-04-10 21:32:41 +00:00
|
|
|
virtual PRBool NeedsToObserve(const nsHTMLReflowState& aReflowState);
|
|
|
|
|
1998-09-15 17:58:24 +00:00
|
|
|
void InitCellFrame(PRInt32 aColIndex);
|
|
|
|
|
1998-12-21 06:38:18 +00:00
|
|
|
|
1998-09-15 17:58:24 +00:00
|
|
|
/** instantiate a new instance of nsTableCellFrame.
|
|
|
|
* @param aResult the new object is returned in this out-param
|
|
|
|
*
|
|
|
|
* @return NS_OK if the frame was properly allocated, otherwise an error code
|
|
|
|
*/
|
|
|
|
friend nsresult
|
1999-12-04 23:49:50 +00:00
|
|
|
NS_NewTableCellFrame(nsIPresShell* aPresShell, nsIFrame** aResult);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2001-09-19 12:35:19 +00:00
|
|
|
NS_IMETHOD Paint(nsIPresContext* aPresContext,
|
1998-04-17 01:41:24 +00:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
2001-09-19 12:35:19 +00:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
PRUint32 aFlags = 0);
|
1998-04-17 01:41:24 +00:00
|
|
|
|
2000-03-22 02:43:08 +00:00
|
|
|
NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
|
|
|
|
const nsPoint& aPoint,
|
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
nsIFrame** aFrame);
|
|
|
|
|
1999-10-26 04:44:41 +00:00
|
|
|
NS_IMETHOD SetSelected(nsIPresContext* aPresContext,
|
|
|
|
nsIDOMRange *aRange,
|
|
|
|
PRBool aSelected,
|
|
|
|
nsSpread aSpread);
|
1999-06-01 23:04:13 +00:00
|
|
|
|
1999-11-24 06:03:41 +00:00
|
|
|
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
1998-10-01 04:46:11 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
1998-10-02 04:10:00 +00:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
1998-05-25 17:31:49 +00:00
|
|
|
nsReflowStatus& aStatus);
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-02-24 05:54:31 +00:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsLayoutAtoms::tableCellFrame
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
|
|
|
|
|
1999-09-01 01:02:16 +00:00
|
|
|
#ifdef DEBUG
|
2001-11-14 01:33:42 +00:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
1999-08-31 03:09:40 +00:00
|
|
|
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
1999-09-01 01:02:16 +00:00
|
|
|
#endif
|
1999-08-31 03:09:40 +00:00
|
|
|
|
2000-06-05 08:25:11 +00:00
|
|
|
virtual void VerticallyAlignChild(nsIPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nscoord aMaxAscent);
|
|
|
|
|
|
|
|
PRBool HasVerticalAlignBaseline();
|
1998-04-13 20:24:54 +00:00
|
|
|
|
1999-02-21 19:55:22 +00:00
|
|
|
/**
|
|
|
|
* return the cell's specified row span. this is what was specified in the
|
|
|
|
* content model or in the style info, and is always >= 1.
|
|
|
|
* to get the effective row span (the actual value that applies), use GetEffectiveRowSpan()
|
|
|
|
* @see nsTableFrame::GetEffectiveRowSpan()
|
|
|
|
*/
|
1998-04-13 20:24:54 +00:00
|
|
|
virtual PRInt32 GetRowSpan();
|
|
|
|
|
1998-07-11 00:00:31 +00:00
|
|
|
// there is no set row index because row index depends on the cell's parent row only
|
|
|
|
|
1999-08-01 16:20:14 +00:00
|
|
|
/*---------------- nsITableCellLayout methods ------------------------*/
|
|
|
|
|
1999-02-21 19:55:22 +00:00
|
|
|
/**
|
|
|
|
* return the cell's starting row index (starting at 0 for the first row).
|
|
|
|
* for continued cell frames the row index is that of the cell's first-in-flow
|
1999-08-04 02:04:45 +00:00
|
|
|
* and the column index (starting at 0 for the first column
|
1999-02-21 19:55:22 +00:00
|
|
|
*/
|
1999-08-04 02:04:45 +00:00
|
|
|
NS_IMETHOD GetCellIndexes(PRInt32 &aRowIndex, PRInt32 &aColIndex);
|
|
|
|
|
|
|
|
/** return the mapped cell's row index (starting at 0 for the first row) */
|
1999-08-19 19:52:37 +00:00
|
|
|
virtual nsresult GetRowIndex(PRInt32 &aRowIndex) const;
|
1998-07-11 00:00:31 +00:00
|
|
|
|
2000-03-23 04:24:58 +00:00
|
|
|
/** return the previous cell having the same column index as current cell
|
|
|
|
* returns null if no cell is present (but nsresult is still NS_OK)
|
|
|
|
* (When used within layout, you can QI aCellLayout to get an nsIFrame*)
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetPreviousCellInColumn(nsITableCellLayout **aCellLayout);
|
|
|
|
|
|
|
|
/** return the next cell having the same column index
|
|
|
|
* returns null if no cell is present (but nsresult is still NS_OK)
|
|
|
|
* (When used within layout, you can QI aCellLayout to get an nsIFrame*)
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetNextCellInColumn(nsITableCellLayout **aCellLayout);
|
|
|
|
|
1999-02-21 19:55:22 +00:00
|
|
|
/**
|
|
|
|
* return the cell's specified col span. this is what was specified in the
|
|
|
|
* content model or in the style info, and is always >= 1.
|
|
|
|
* to get the effective col span (the actual value that applies), use GetEffectiveColSpan()
|
|
|
|
* @see nsTableFrame::GetEffectiveColSpan()
|
|
|
|
*/
|
1998-04-23 17:29:07 +00:00
|
|
|
virtual PRInt32 GetColSpan();
|
1998-07-11 00:00:31 +00:00
|
|
|
|
1999-02-21 19:55:22 +00:00
|
|
|
/** return the cell's column index (starting at 0 for the first column) */
|
1999-08-19 19:52:37 +00:00
|
|
|
virtual nsresult GetColIndex(PRInt32 &aColIndex) const;
|
1999-07-28 08:09:02 +00:00
|
|
|
virtual nsresult SetColIndex(PRInt32 aColIndex);
|
1998-04-23 17:29:07 +00:00
|
|
|
|
1998-07-11 00:00:31 +00:00
|
|
|
/** return the available width given to this frame during its last reflow */
|
1998-07-02 17:40:56 +00:00
|
|
|
virtual nscoord GetPriorAvailWidth();
|
|
|
|
|
1998-07-11 00:00:31 +00:00
|
|
|
/** set the available width given to this frame during its last reflow */
|
1998-07-02 17:40:56 +00:00
|
|
|
virtual void SetPriorAvailWidth(nscoord aPriorAvailWidth);
|
|
|
|
|
1998-07-11 00:00:31 +00:00
|
|
|
/** return the desired size returned by this frame during its last reflow */
|
|
|
|
virtual nsSize GetDesiredSize();
|
2000-06-05 08:25:11 +00:00
|
|
|
virtual nscoord GetDesiredAscent();
|
1998-07-11 00:00:31 +00:00
|
|
|
|
|
|
|
/** set the desired size returned by this frame during its last reflow */
|
1998-10-01 04:46:11 +00:00
|
|
|
virtual void SetDesiredSize(const nsHTMLReflowMetrics & aDesiredSize);
|
1998-07-11 00:00:31 +00:00
|
|
|
|
1999-12-24 03:46:21 +00:00
|
|
|
/** return the maximum width of the cell */
|
|
|
|
virtual nscoord GetMaximumWidth() const;
|
1998-07-11 00:00:31 +00:00
|
|
|
|
1999-12-24 03:46:21 +00:00
|
|
|
/** set the maximum width of the cell */
|
|
|
|
virtual void SetMaximumWidth(nscoord aMaximumWidth);
|
1998-07-11 00:00:31 +00:00
|
|
|
|
|
|
|
/** return the MaxElement size returned by this frame during its last reflow
|
|
|
|
* not counting reflows where MaxElementSize is not requested.
|
|
|
|
* That is, the cell frame will always remember the last non-null MaxElementSize
|
|
|
|
*/
|
2001-11-30 15:05:51 +00:00
|
|
|
virtual nscoord GetPass1MaxElementWidth() const;
|
1998-07-11 00:00:31 +00:00
|
|
|
|
|
|
|
/** set the MaxElement size returned by this frame during its last reflow.
|
|
|
|
* should never be called with a null MaxElementSize
|
|
|
|
*/
|
2001-11-30 15:05:51 +00:00
|
|
|
virtual void SetPass1MaxElementWidth(nscoord aMaxWidth,
|
|
|
|
nscoord aMaxElementWidth);
|
1998-07-07 01:06:51 +00:00
|
|
|
|
1998-12-10 19:57:42 +00:00
|
|
|
PRBool GetContentEmpty();
|
|
|
|
void SetContentEmpty(PRBool aContentEmpty);
|
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
PRBool NeedSpecialReflow();
|
|
|
|
void SetNeedSpecialReflow(PRBool aContentEmpty);
|
|
|
|
|
2001-12-07 14:51:12 +00:00
|
|
|
PRBool HadSpecialReflow();
|
|
|
|
void SetHadSpecialReflow(PRBool aValue);
|
|
|
|
|
2001-11-28 00:50:08 +00:00
|
|
|
PRBool HasPctOverHeight();
|
|
|
|
void SetHasPctOverHeight(PRBool aValue);
|
|
|
|
|
2001-12-07 14:51:12 +00:00
|
|
|
nscoord GetLastBlockHeight();
|
|
|
|
void SetLastBlockHeight(nscoord aValue);
|
|
|
|
|
1999-02-11 06:22:33 +00:00
|
|
|
// The collapse offset is (0,0) except for cells originating in a row/col which is collapsed
|
1999-10-22 02:06:22 +00:00
|
|
|
void SetCollapseOffsetX(nsIPresContext* aPresContext, nscoord aXOffset);
|
|
|
|
void SetCollapseOffsetY(nsIPresContext* aPresContext, nscoord aYOffset);
|
|
|
|
void GetCollapseOffset(nsIPresContext* aPresContext, nsPoint& aOffset);
|
1999-02-11 06:22:33 +00:00
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
nsTableCellFrame* GetNextCell() const;
|
|
|
|
|
2002-02-19 15:48:28 +00:00
|
|
|
virtual nsMargin* GetBorderWidth(float aPixelsToTwips,
|
|
|
|
nsMargin& aBorder) const;
|
|
|
|
|
1998-10-20 17:45:07 +00:00
|
|
|
protected:
|
|
|
|
/** implement abstract method on nsHTMLContainerFrame */
|
|
|
|
virtual PRIntn GetSkipSides() const;
|
|
|
|
|
1999-06-01 23:04:13 +00:00
|
|
|
virtual PRBool ParentDisablesSelection() const; //override default behavior
|
|
|
|
|
1998-07-11 00:00:31 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
// All these methods are support methods for RecalcLayoutData
|
|
|
|
nsIFrame* GetFrameAt(nsVoidArray* aList, PRInt32 aIndex);
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
protected:
|
|
|
|
|
2000-11-15 16:01:26 +00:00
|
|
|
friend class nsTableRowFrame;
|
1999-10-20 14:18:56 +00:00
|
|
|
void MapBorderPadding(nsIPresContext* aPresContext);
|
1998-11-11 19:56:02 +00:00
|
|
|
|
1999-01-03 19:22:40 +00:00
|
|
|
void MapVAlignAttribute(nsIPresContext* aPresContext, nsTableFrame *aTableFrame);
|
|
|
|
void MapHAlignAttribute(nsIPresContext* aPresContext, nsTableFrame *aTableFrame);
|
|
|
|
|
2002-03-07 15:23:08 +00:00
|
|
|
// paint backgrounds and borders (in separate border model) if aVisibleBackground, always set aPaintChildren
|
|
|
|
virtual void PaintUnderlay(nsIPresContext& aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
PRUint32& aFlags,
|
|
|
|
const nsStyleTableBorder& aCellTableStyle,
|
|
|
|
const nsStyleBorder& aStyleBorder,
|
|
|
|
PRBool aVisibleBackground,
|
|
|
|
PRBool& aPaintChildren);
|
|
|
|
|
1998-05-21 23:43:18 +00:00
|
|
|
PRBool ConvertToPixelValue(nsHTMLValue& aValue, PRInt32 aDefault, PRInt32& aResult);
|
2001-05-03 23:57:08 +00:00
|
|
|
nsresult DecorateForSelection(nsIPresContext* aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
2001-05-31 22:19:43 +00:00
|
|
|
const nsStyleBackground* aStyleColor);
|
1998-06-11 00:13:18 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2001-12-07 14:51:12 +00:00
|
|
|
struct Bits {
|
|
|
|
PRUint32 mColIndex:15;
|
|
|
|
PRUint32 mLastBlockHeight:17;
|
|
|
|
} mBits;
|
2001-11-30 15:05:51 +00:00
|
|
|
PRInt32 mColIndex; // the starting column for this cell
|
1998-06-11 00:13:18 +00:00
|
|
|
|
2001-11-30 15:05:51 +00:00
|
|
|
// XXX these could be stored as pixels for a savings of 6 x 2 bytes
|
1998-07-02 17:40:56 +00:00
|
|
|
|
2001-11-30 15:05:51 +00:00
|
|
|
nscoord mPriorAvailWidth; // the avail width during the last reflow
|
|
|
|
nsSize mDesiredSize; // the last desired width & height
|
|
|
|
nscoord mDesiredAscent; // the last desired ascent
|
|
|
|
nscoord mMaximumWidth; // the last preferred width
|
|
|
|
nscoord mPass1MaxElementWidth; // the last max element width
|
1998-07-07 01:06:51 +00:00
|
|
|
|
1998-12-30 06:48:15 +00:00
|
|
|
public:
|
1998-06-11 00:13:18 +00:00
|
|
|
|
2001-01-25 15:55:51 +00:00
|
|
|
#ifdef DEBUG_TABLE_REFLOW_TIMING
|
|
|
|
nsReflowTimer* mTimer;
|
|
|
|
nsReflowTimer* mBlockTimer;
|
|
|
|
#endif
|
1998-12-21 06:38:18 +00:00
|
|
|
};
|
1998-06-11 00:13:18 +00:00
|
|
|
|
1998-07-02 17:40:56 +00:00
|
|
|
inline nscoord nsTableCellFrame::GetPriorAvailWidth()
|
|
|
|
{ return mPriorAvailWidth;}
|
|
|
|
|
|
|
|
inline void nsTableCellFrame::SetPriorAvailWidth(nscoord aPriorAvailWidth)
|
|
|
|
{ mPriorAvailWidth = aPriorAvailWidth;}
|
|
|
|
|
1998-07-11 00:00:31 +00:00
|
|
|
inline nsSize nsTableCellFrame::GetDesiredSize()
|
|
|
|
{ return mDesiredSize; }
|
|
|
|
|
2000-06-05 08:25:11 +00:00
|
|
|
inline nscoord nsTableCellFrame::GetDesiredAscent()
|
|
|
|
{ return mDesiredAscent; }
|
|
|
|
|
1998-10-01 04:46:11 +00:00
|
|
|
inline void nsTableCellFrame::SetDesiredSize(const nsHTMLReflowMetrics & aDesiredSize)
|
1998-07-11 00:00:31 +00:00
|
|
|
{
|
|
|
|
mDesiredSize.width = aDesiredSize.width;
|
|
|
|
mDesiredSize.height = aDesiredSize.height;
|
2000-06-05 08:25:11 +00:00
|
|
|
mDesiredAscent = aDesiredSize.ascent;
|
1998-07-11 00:00:31 +00:00
|
|
|
}
|
|
|
|
|
1999-12-24 03:46:21 +00:00
|
|
|
inline nscoord nsTableCellFrame::GetMaximumWidth() const
|
|
|
|
{ return mMaximumWidth; }
|
1998-07-11 00:00:31 +00:00
|
|
|
|
1999-12-24 03:46:21 +00:00
|
|
|
inline void nsTableCellFrame::SetMaximumWidth(nscoord aMaximumWidth)
|
1998-07-11 00:00:31 +00:00
|
|
|
{
|
1999-12-24 03:46:21 +00:00
|
|
|
mMaximumWidth = aMaximumWidth;
|
1998-07-11 00:00:31 +00:00
|
|
|
}
|
|
|
|
|
2001-11-30 15:05:51 +00:00
|
|
|
inline nscoord nsTableCellFrame::GetPass1MaxElementWidth() const
|
|
|
|
{ return mPass1MaxElementWidth; }
|
1998-07-11 00:00:31 +00:00
|
|
|
|
1999-10-08 18:52:19 +00:00
|
|
|
inline PRBool nsTableCellFrame::GetContentEmpty()
|
|
|
|
{
|
2001-11-05 00:15:51 +00:00
|
|
|
return (mState & NS_TABLE_CELL_CONTENT_EMPTY) ==
|
|
|
|
NS_TABLE_CELL_CONTENT_EMPTY;
|
1999-10-08 18:52:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void nsTableCellFrame::SetContentEmpty(PRBool aContentEmpty)
|
|
|
|
{
|
1999-10-15 03:14:59 +00:00
|
|
|
if (aContentEmpty) {
|
2001-11-05 00:15:51 +00:00
|
|
|
mState |= NS_TABLE_CELL_CONTENT_EMPTY;
|
1999-10-15 03:14:59 +00:00
|
|
|
} else {
|
2001-11-05 00:15:51 +00:00
|
|
|
mState &= ~NS_TABLE_CELL_CONTENT_EMPTY;
|
1999-10-15 03:14:59 +00:00
|
|
|
}
|
1999-10-08 18:52:19 +00:00
|
|
|
}
|
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
inline PRBool nsTableCellFrame::NeedSpecialReflow()
|
|
|
|
{
|
|
|
|
return (mState & NS_TABLE_CELL_NEED_SPECIAL_REFLOW) ==
|
|
|
|
NS_TABLE_CELL_NEED_SPECIAL_REFLOW;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void nsTableCellFrame::SetNeedSpecialReflow(PRBool aValue)
|
|
|
|
{
|
|
|
|
if (aValue) {
|
|
|
|
mState |= NS_TABLE_CELL_NEED_SPECIAL_REFLOW;
|
|
|
|
} else {
|
|
|
|
mState &= ~NS_TABLE_CELL_NEED_SPECIAL_REFLOW;
|
|
|
|
}
|
|
|
|
}
|
2001-11-28 00:50:08 +00:00
|
|
|
|
2001-12-07 14:51:12 +00:00
|
|
|
inline PRBool nsTableCellFrame::HadSpecialReflow()
|
|
|
|
{
|
|
|
|
return (mState & NS_TABLE_CELL_HAD_SPECIAL_REFLOW) ==
|
|
|
|
NS_TABLE_CELL_HAD_SPECIAL_REFLOW;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void nsTableCellFrame::SetHadSpecialReflow(PRBool aValue)
|
|
|
|
{
|
|
|
|
if (aValue) {
|
|
|
|
mState |= NS_TABLE_CELL_HAD_SPECIAL_REFLOW;
|
|
|
|
} else {
|
|
|
|
mState &= ~NS_TABLE_CELL_HAD_SPECIAL_REFLOW;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-11-28 00:50:08 +00:00
|
|
|
inline PRBool nsTableCellFrame::HasPctOverHeight()
|
|
|
|
{
|
2001-12-07 14:51:12 +00:00
|
|
|
return (mState & NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT) ==
|
|
|
|
NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT;
|
2001-11-28 00:50:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void nsTableCellFrame::SetHasPctOverHeight(PRBool aValue)
|
|
|
|
{
|
|
|
|
if (aValue) {
|
2001-12-07 14:51:12 +00:00
|
|
|
mState |= NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT;
|
2001-11-28 00:50:08 +00:00
|
|
|
} else {
|
2001-12-07 14:51:12 +00:00
|
|
|
mState &= ~NS_TABLE_CELL_HAS_PCT_OVER_HEIGHT;
|
2001-11-28 00:50:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-07 14:51:12 +00:00
|
|
|
inline nscoord nsTableCellFrame::GetLastBlockHeight()
|
|
|
|
{
|
|
|
|
return (nscoord)mBits.mLastBlockHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void nsTableCellFrame::SetLastBlockHeight(nscoord aValue)
|
|
|
|
{
|
|
|
|
mBits.mLastBlockHeight = aValue;
|
|
|
|
}
|
2002-02-19 15:48:28 +00:00
|
|
|
|
|
|
|
// nsBCTableCellFrame
|
|
|
|
class nsBCTableCellFrame : public nsTableCellFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
nsBCTableCellFrame();
|
|
|
|
|
|
|
|
~nsBCTableCellFrame();
|
|
|
|
|
|
|
|
NS_IMETHOD GetFrameType(nsIAtom** aType) const;
|
|
|
|
|
|
|
|
virtual nsMargin* GetBorderWidth(float aPixelsToTwips,
|
|
|
|
nsMargin& aBorder) const;
|
|
|
|
nscoord GetBorderWidth(PRUint8 aSide) const;
|
|
|
|
|
|
|
|
void SetBorderWidth(const nsMargin& aBorder);
|
|
|
|
void SetBorderWidth(PRUint8 aSide, nscoord aPixelValue);
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
|
|
|
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
|
|
|
#endif
|
|
|
|
|
2002-03-07 15:23:08 +00:00
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual void PaintUnderlay(nsIPresContext& aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
PRUint32& aFlags,
|
|
|
|
const nsStyleTableBorder& aCellTableStyle,
|
|
|
|
const nsStyleBorder& aStyleBorder,
|
|
|
|
PRBool aVisibleBackground,
|
|
|
|
PRBool& aPaintChildren);
|
|
|
|
|
2002-02-19 15:48:28 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
PRUint32 mTopBorder: 8;
|
|
|
|
PRUint32 mRightBorder: 8;
|
|
|
|
PRUint32 mBottomBorder: 8;
|
|
|
|
PRUint32 mLeftBorder: 8;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IS_TABLE_CELL(frameType)\
|
|
|
|
((nsLayoutAtoms::tableCellFrame == frameType) || (nsLayoutAtoms::bcTableCellFrame == frameType))
|
|
|
|
|
1998-10-14 22:23:26 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
1998-07-11 00:00:31 +00:00
|
|
|
|