2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 14:30:37 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-04-13 20:24:54 +00:00
|
|
|
*
|
2004-04-18 14:30:37 +00: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-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.
|
|
|
|
*
|
2004-04-18 14:30:37 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-28 20:14:13 +00:00
|
|
|
* 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
|
2004-04-18 14:30:37 +00: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-28 20:14:13 +00: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 14:30:37 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-28 20:14:13 +00: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 14:30:37 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-28 20:14:13 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsTableRowFrame.h"
|
2001-11-05 15:15:24 +00:00
|
|
|
#include "nsTableRowGroupFrame.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsIRenderingContext.h"
|
1999-07-28 08:09:02 +00:00
|
|
|
#include "nsIPresShell.h"
|
2004-07-31 23:15:21 +00:00
|
|
|
#include "nsPresContext.h"
|
2003-02-22 00:32:13 +00:00
|
|
|
#include "nsStyleContext.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsStyleConsts.h"
|
1998-08-26 17:26:38 +00:00
|
|
|
#include "nsHTMLAtoms.h"
|
1998-04-13 20:24:54 +00:00
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsTableFrame.h"
|
|
|
|
#include "nsTableCellFrame.h"
|
1998-04-14 21:49:29 +00:00
|
|
|
#include "nsIView.h"
|
2002-05-10 18:22:41 +00:00
|
|
|
#include "nsReflowPath.h"
|
1998-07-20 23:56:17 +00:00
|
|
|
#include "nsCSSRendering.h"
|
1999-02-24 05:54:31 +00:00
|
|
|
#include "nsLayoutAtoms.h"
|
1999-07-28 08:09:02 +00:00
|
|
|
#include "nsHTMLParts.h"
|
|
|
|
#include "nsTableColGroupFrame.h"
|
|
|
|
#include "nsTableColFrame.h"
|
|
|
|
#include "nsCOMPtr.h"
|
1998-06-03 00:43:53 +00:00
|
|
|
|
1998-04-23 17:29:07 +00:00
|
|
|
|
2000-05-04 23:16:42 +00:00
|
|
|
struct nsTableCellReflowState : public nsHTMLReflowState
|
|
|
|
{
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableCellReflowState(nsPresContext* aPresContext,
|
2000-05-04 23:16:42 +00:00
|
|
|
const nsHTMLReflowState& aParentReflowState,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
const nsSize& aAvailableSpace,
|
|
|
|
nsReflowReason aReason);
|
|
|
|
|
2002-09-09 18:46:06 +00:00
|
|
|
void FixUp(const nsSize& aAvailSpace,
|
|
|
|
PRBool aResetComputedWidth);
|
2000-05-04 23:16:42 +00:00
|
|
|
};
|
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableCellReflowState::nsTableCellReflowState(nsPresContext* aPresContext,
|
2000-05-04 23:16:42 +00:00
|
|
|
const nsHTMLReflowState& aParentRS,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
const nsSize& aAvailSpace,
|
|
|
|
nsReflowReason aReason)
|
|
|
|
:nsHTMLReflowState(aPresContext, aParentRS, aFrame, aAvailSpace, aReason)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-09-09 18:46:06 +00:00
|
|
|
void nsTableCellReflowState::FixUp(const nsSize& aAvailSpace,
|
|
|
|
PRBool aResetComputedWidth)
|
2000-05-04 23:16:42 +00:00
|
|
|
{
|
2002-02-19 15:48:28 +00:00
|
|
|
// fix the mComputed values during a pass 2 reflow since the cell can be a percentage base
|
|
|
|
if (NS_UNCONSTRAINEDSIZE != aAvailSpace.width) {
|
2002-09-09 18:46:06 +00:00
|
|
|
if (aResetComputedWidth) {
|
|
|
|
mComputedWidth = NS_UNCONSTRAINEDSIZE;
|
|
|
|
}
|
|
|
|
else if (NS_UNCONSTRAINEDSIZE != mComputedWidth) {
|
2002-02-19 15:48:28 +00:00
|
|
|
mComputedWidth = aAvailSpace.width - mComputedBorderPadding.left - mComputedBorderPadding.right;
|
|
|
|
mComputedWidth = PR_MAX(0, mComputedWidth);
|
|
|
|
}
|
|
|
|
if (NS_UNCONSTRAINEDSIZE != mComputedHeight) {
|
|
|
|
if (NS_UNCONSTRAINEDSIZE != aAvailSpace.height) {
|
|
|
|
mComputedHeight = aAvailSpace.height - mComputedBorderPadding.top - mComputedBorderPadding.bottom;
|
|
|
|
mComputedHeight = PR_MAX(0, mComputedHeight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::InitChildReflowState(nsPresContext& aPresContext,
|
2002-02-19 15:48:28 +00:00
|
|
|
const nsSize& aAvailSize,
|
|
|
|
PRBool aBorderCollapse,
|
|
|
|
float aPixelsToTwips,
|
2002-09-09 18:46:06 +00:00
|
|
|
nsTableCellReflowState& aReflowState,
|
|
|
|
PRBool aResetComputedWidth)
|
2002-02-19 15:48:28 +00:00
|
|
|
{
|
|
|
|
nsMargin collapseBorder;
|
|
|
|
nsMargin* pCollapseBorder = nsnull;
|
|
|
|
if (aBorderCollapse) {
|
|
|
|
// we only reflow cells, so don't need to check frame type
|
|
|
|
nsBCTableCellFrame* bcCellFrame = (nsBCTableCellFrame*)aReflowState.frame;
|
|
|
|
if (bcCellFrame) {
|
|
|
|
pCollapseBorder = bcCellFrame->GetBorderWidth(aPixelsToTwips, collapseBorder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
aReflowState.Init(&aPresContext, -1, -1, pCollapseBorder);
|
2002-09-09 18:46:06 +00:00
|
|
|
aReflowState.FixUp(aAvailSize, aResetComputedWidth);
|
2000-05-04 23:16:42 +00:00
|
|
|
}
|
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
void
|
|
|
|
nsTableRowFrame::SetFixedHeight(nscoord aValue)
|
|
|
|
{
|
2003-01-05 14:16:58 +00:00
|
|
|
nscoord height = PR_MAX(0, aValue);
|
|
|
|
if (HasFixedHeight()) {
|
|
|
|
if (height > mStyleFixedHeight) {
|
|
|
|
mStyleFixedHeight = height;
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
2003-01-05 14:16:58 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
mStyleFixedHeight = height;
|
|
|
|
if (height > 0) {
|
|
|
|
SetHasFixedHeight(PR_TRUE);
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-11-05 15:15:24 +00:00
|
|
|
nsTableRowFrame::SetPctHeight(float aPctValue,
|
|
|
|
PRBool aForce)
|
2001-11-05 00:15:51 +00:00
|
|
|
{
|
|
|
|
nscoord height = PR_MAX(0, NSToCoordRound(aPctValue * 100.0f));
|
|
|
|
if (HasPctHeight()) {
|
2003-01-05 14:16:58 +00:00
|
|
|
if ((height > mStylePctHeight) || aForce) {
|
|
|
|
mStylePctHeight = height;
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2003-01-05 14:16:58 +00:00
|
|
|
mStylePctHeight = height;
|
2001-11-05 00:15:51 +00:00
|
|
|
if (height > 0.0f) {
|
|
|
|
SetHasPctHeight(PR_TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-06-05 08:25:11 +00:00
|
|
|
// 'old' is old cached cell's desired size
|
|
|
|
// 'new' is new cell's size including style constraints
|
|
|
|
static PRBool
|
|
|
|
TallestCellGotShorter(nscoord aOld,
|
|
|
|
nscoord aNew,
|
|
|
|
nscoord aTallest)
|
|
|
|
{
|
2000-12-21 23:03:42 +00:00
|
|
|
return ((aNew < aOld) && (aOld == aTallest));
|
2000-06-05 08:25:11 +00:00
|
|
|
}
|
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
/* ----------- nsTableRowFrame ---------- */
|
1998-04-23 17:29:07 +00:00
|
|
|
|
1998-12-03 06:31:43 +00:00
|
|
|
nsTableRowFrame::nsTableRowFrame()
|
2001-11-05 00:15:51 +00:00
|
|
|
: nsHTMLContainerFrame()
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2001-11-05 00:15:51 +00:00
|
|
|
mBits.mRowIndex = mBits.mFirstInserted = 0;
|
|
|
|
ResetHeight(0);
|
2001-01-25 15:55:51 +00:00
|
|
|
#ifdef DEBUG_TABLE_REFLOW_TIMING
|
|
|
|
mTimer = new nsReflowTimer(this);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
nsTableRowFrame::~nsTableRowFrame()
|
|
|
|
{
|
|
|
|
#ifdef DEBUG_TABLE_REFLOW_TIMING
|
|
|
|
nsTableFrame::DebugReflowDone(this);
|
|
|
|
#endif
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-02-25 05:31:15 +00:00
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::Init(nsPresContext* aPresContext,
|
1999-02-25 05:31:15 +00:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
2003-02-22 00:32:13 +00:00
|
|
|
nsStyleContext* aContext,
|
1999-02-25 05:31:15 +00:00
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
// Let the the base class do its initialization
|
|
|
|
rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext,
|
|
|
|
aPrevInFlow);
|
|
|
|
|
2001-02-23 12:35:34 +00:00
|
|
|
// record that children that are ignorable whitespace should be excluded
|
|
|
|
mState |= NS_FRAME_EXCLUDE_IGNORABLE_WHITESPACE;
|
|
|
|
|
1999-02-25 05:31:15 +00:00
|
|
|
if (aPrevInFlow) {
|
|
|
|
// Set the row index
|
|
|
|
nsTableRowFrame* rowFrame = (nsTableRowFrame*)aPrevInFlow;
|
|
|
|
|
|
|
|
SetRowIndex(rowFrame->GetRowIndex());
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1999-08-03 02:41:27 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::AppendFrames(nsPresContext* aPresContext,
|
1999-08-03 02:41:27 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
|
|
|
// Append the frames
|
|
|
|
mFrames.AppendFrames(nsnull, aFrameList);
|
|
|
|
|
|
|
|
// Add the new cell frames to the table
|
|
|
|
nsTableFrame *tableFrame = nsnull;
|
|
|
|
nsTableFrame::GetTableFrame(this, tableFrame);
|
2003-07-07 02:01:29 +00:00
|
|
|
for (nsIFrame* childFrame = aFrameList; childFrame;
|
|
|
|
childFrame = childFrame->GetNextSibling()) {
|
2003-10-31 20:19:18 +00:00
|
|
|
if (IS_TABLE_CELL(childFrame->GetType())) {
|
1999-08-03 02:41:27 +00:00
|
|
|
// Add the cell to the cell map
|
1999-12-13 22:56:31 +00:00
|
|
|
tableFrame->AppendCell(*aPresContext, (nsTableCellFrame&)*childFrame, GetRowIndex());
|
2001-03-13 06:38:59 +00:00
|
|
|
// XXX this could be optimized with some effort
|
|
|
|
tableFrame->SetNeedStrategyInit(PR_TRUE);
|
1999-08-03 02:41:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reflow the new frames. They're already marked dirty, so generate a reflow
|
|
|
|
// command that tells us to reflow our dirty child frames
|
2001-03-13 06:38:59 +00:00
|
|
|
tableFrame->AppendDirtyReflowCommand(&aPresShell, this);
|
1999-08-03 02:41:27 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-12-13 22:56:31 +00:00
|
|
|
|
1999-08-03 02:41:27 +00:00
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::InsertFrames(nsPresContext* aPresContext,
|
1999-08-03 02:41:27 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
|
|
|
// Get the table frame
|
|
|
|
nsTableFrame* tableFrame = nsnull;
|
|
|
|
nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
|
1999-12-13 22:56:31 +00:00
|
|
|
// gather the new frames (only those which are cells) into an array
|
2002-02-19 15:48:28 +00:00
|
|
|
nsIAtom* cellFrameType = (tableFrame->IsBorderCollapse()) ? nsLayoutAtoms::bcTableCellFrame : nsLayoutAtoms::tableCellFrame;
|
2004-01-18 10:28:40 +00:00
|
|
|
nsTableCellFrame* prevCellFrame = (nsTableCellFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, cellFrameType);
|
1999-12-13 22:56:31 +00:00
|
|
|
nsVoidArray cellChildren;
|
2003-07-07 02:01:29 +00:00
|
|
|
for (nsIFrame* childFrame = aFrameList; childFrame;
|
2003-07-07 05:15:41 +00:00
|
|
|
childFrame = childFrame->GetNextSibling()) {
|
2003-10-31 20:19:18 +00:00
|
|
|
if (IS_TABLE_CELL(childFrame->GetType())) {
|
1999-12-13 22:56:31 +00:00
|
|
|
cellChildren.AppendElement(childFrame);
|
2001-03-13 06:38:59 +00:00
|
|
|
// XXX this could be optimized with some effort
|
|
|
|
tableFrame->SetNeedStrategyInit(PR_TRUE);
|
1999-12-13 22:56:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// insert the cells into the cell map
|
|
|
|
PRInt32 colIndex = -1;
|
|
|
|
if (prevCellFrame) {
|
|
|
|
prevCellFrame->GetColIndex(colIndex);
|
|
|
|
}
|
|
|
|
tableFrame->InsertCells(*aPresContext, cellChildren, GetRowIndex(), colIndex);
|
|
|
|
|
|
|
|
// Insert the frames in the frame list
|
1999-08-03 02:41:27 +00:00
|
|
|
mFrames.InsertFrames(nsnull, aPrevFrame, aFrameList);
|
|
|
|
|
1999-12-13 22:56:31 +00:00
|
|
|
// Reflow the new frames. They're already marked dirty, so generate a reflow
|
|
|
|
// command that tells us to reflow our dirty child frames
|
2001-03-13 06:38:59 +00:00
|
|
|
tableFrame->AppendDirtyReflowCommand(&aPresShell, this);
|
1999-08-03 02:41:27 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::RemoveFrame(nsPresContext* aPresContext,
|
1999-08-03 02:41:27 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame)
|
|
|
|
{
|
|
|
|
// Get the table frame
|
|
|
|
nsTableFrame* tableFrame=nsnull;
|
|
|
|
nsTableFrame::GetTableFrame(this, tableFrame);
|
1999-12-13 22:56:31 +00:00
|
|
|
if (tableFrame) {
|
2003-10-31 20:19:18 +00:00
|
|
|
if (IS_TABLE_CELL(aOldFrame->GetType())) {
|
1999-12-13 22:56:31 +00:00
|
|
|
nsTableCellFrame* cellFrame = (nsTableCellFrame*)aOldFrame;
|
|
|
|
PRInt32 colIndex;
|
|
|
|
cellFrame->GetColIndex(colIndex);
|
2001-03-13 06:38:59 +00:00
|
|
|
// remove the cell from the cell map
|
1999-12-13 22:56:31 +00:00
|
|
|
tableFrame->RemoveCell(*aPresContext, cellFrame, GetRowIndex());
|
2001-03-13 06:38:59 +00:00
|
|
|
// XXX this could be optimized with some effort
|
|
|
|
tableFrame->SetNeedStrategyInit(PR_TRUE);
|
1999-12-13 22:56:31 +00:00
|
|
|
|
|
|
|
// Remove the frame and destroy it
|
|
|
|
mFrames.DestroyFrame(aPresContext, aOldFrame);
|
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
// XXX This could probably be optimized with much effort
|
|
|
|
tableFrame->SetNeedStrategyInit(PR_TRUE);
|
|
|
|
// Generate a reflow command so we reflow the table itself.
|
2000-03-09 08:45:26 +00:00
|
|
|
// Target the row so that it gets a dirty reflow before a resize reflow
|
|
|
|
// in case another cell gets added to the row during a reflow coallesce.
|
2001-03-13 06:38:59 +00:00
|
|
|
tableFrame->AppendDirtyReflowCommand(&aPresShell, this);
|
1998-09-23 21:48:26 +00:00
|
|
|
}
|
|
|
|
}
|
1998-09-16 17:19:20 +00:00
|
|
|
|
1999-08-30 00:01:09 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2000-09-05 14:57:34 +00:00
|
|
|
nscoord
|
|
|
|
GetHeightOfRowsSpannedBelowFirst(nsTableCellFrame& aTableCellFrame,
|
|
|
|
nsTableFrame& aTableFrame)
|
|
|
|
{
|
|
|
|
nscoord height = 0;
|
|
|
|
nscoord cellSpacingY = aTableFrame.GetCellSpacingY();
|
|
|
|
PRInt32 rowSpan = aTableFrame.GetEffectiveRowSpan(aTableCellFrame);
|
|
|
|
// add in height of rows spanned beyond the 1st one
|
2003-07-07 02:01:29 +00:00
|
|
|
nsIFrame* nextRow = aTableCellFrame.GetParent()->GetNextSibling();
|
2000-09-05 14:57:34 +00:00
|
|
|
for (PRInt32 rowX = 1; ((rowX < rowSpan) && nextRow);) {
|
2003-10-31 20:19:18 +00:00
|
|
|
if (nsLayoutAtoms::tableRowFrame == nextRow->GetType()) {
|
2003-07-07 02:01:29 +00:00
|
|
|
height += nextRow->GetSize().height;
|
2000-09-05 14:57:34 +00:00
|
|
|
rowX++;
|
|
|
|
}
|
|
|
|
height += cellSpacingY;
|
2003-07-07 02:01:29 +00:00
|
|
|
nextRow = nextRow->GetNextSibling();
|
2000-09-05 14:57:34 +00:00
|
|
|
}
|
|
|
|
return height;
|
|
|
|
}
|
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
nsTableCellFrame*
|
|
|
|
nsTableRowFrame::GetFirstCell()
|
|
|
|
{
|
|
|
|
nsIFrame* childFrame = mFrames.FirstChild();
|
|
|
|
while (childFrame) {
|
2003-10-31 20:19:18 +00:00
|
|
|
if (IS_TABLE_CELL(childFrame->GetType())) {
|
2001-11-05 00:15:51 +00:00
|
|
|
return (nsTableCellFrame*)childFrame;
|
|
|
|
}
|
2003-07-07 02:01:29 +00:00
|
|
|
childFrame = childFrame->GetNextSibling();
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
|
|
|
return nsnull;
|
|
|
|
}
|
2000-09-05 14:57:34 +00:00
|
|
|
|
1998-07-02 20:35:23 +00:00
|
|
|
/**
|
|
|
|
* Post-reflow hook. This is where the table row does its post-processing
|
|
|
|
*/
|
1998-11-20 01:01:25 +00:00
|
|
|
void
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::DidResize(nsPresContext* aPresContext,
|
1998-11-20 01:01:25 +00:00
|
|
|
const nsHTMLReflowState& aReflowState)
|
1998-07-02 20:35:23 +00:00
|
|
|
{
|
1998-11-20 01:01:25 +00:00
|
|
|
// Resize and re-align the cell frames based on our row height
|
|
|
|
nsTableFrame* tableFrame;
|
|
|
|
nsTableFrame::GetTableFrame(this, tableFrame);
|
2000-04-28 21:05:31 +00:00
|
|
|
if (!tableFrame) return;
|
2003-09-13 16:26:30 +00:00
|
|
|
|
2004-01-18 10:28:40 +00:00
|
|
|
nsTableIterator iter(*this, eTableDIR);
|
2001-03-13 06:38:59 +00:00
|
|
|
nsIFrame* childFrame = iter.First();
|
2003-09-13 16:26:30 +00:00
|
|
|
|
|
|
|
nsHTMLReflowMetrics desiredSize(PR_FALSE);
|
|
|
|
desiredSize.width = mRect.width;
|
|
|
|
desiredSize.height = mRect.height;
|
|
|
|
desiredSize.mOverflowArea = nsRect(0, 0, desiredSize.width,
|
|
|
|
desiredSize.height);
|
1999-05-04 19:15:56 +00:00
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
while (childFrame) {
|
2003-10-31 20:19:18 +00:00
|
|
|
if (IS_TABLE_CELL(childFrame->GetType())) {
|
2001-03-13 06:38:59 +00:00
|
|
|
nsTableCellFrame* cellFrame = (nsTableCellFrame*)childFrame;
|
|
|
|
nscoord cellHeight = mRect.height + GetHeightOfRowsSpannedBelowFirst(*cellFrame, *tableFrame);
|
1999-05-04 19:15:56 +00:00
|
|
|
|
|
|
|
// resize the cell's height
|
|
|
|
//if (cellFrameSize.height!=cellHeight)
|
1998-11-20 01:01:25 +00:00
|
|
|
{
|
1999-11-19 15:33:29 +00:00
|
|
|
// XXX If the cell frame has a view, then we need to resize
|
|
|
|
// it as well. We would like to only do that if the cell's size
|
|
|
|
// is changing. Why is the 'if' stmt above commented out?
|
2003-07-07 02:01:29 +00:00
|
|
|
cellFrame->SetSize(nsSize(cellFrame->GetSize().width, cellHeight));
|
1999-05-04 19:15:56 +00:00
|
|
|
// realign cell content based on the new height
|
|
|
|
/*nsHTMLReflowMetrics desiredSize(nsnull);
|
|
|
|
nsHTMLReflowState kidReflowState(aPresContext, aReflowState,
|
|
|
|
cellFrame,
|
|
|
|
nsSize(cellFrameSize.width, cellHeight),
|
|
|
|
eReflowReason_Resize);*/
|
|
|
|
//XXX: the following reflow is necessary for any content of the cell
|
|
|
|
// whose height is a percent of the cell's height (maybe indirectly.)
|
|
|
|
// But some content crashes when this reflow is issued, to be investigated
|
|
|
|
//XXX nsReflowStatus status;
|
|
|
|
//ReflowChild(cellFrame, aPresContext, desiredSize, kidReflowState, status);
|
2000-07-28 09:19:26 +00:00
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
cellFrame->VerticallyAlignChild(aPresContext, aReflowState, mMaxCellAscent);
|
2003-09-13 16:26:30 +00:00
|
|
|
ConsiderChildOverflow(aPresContext, desiredSize.mOverflowArea, cellFrame);
|
1998-07-02 20:35:23 +00:00
|
|
|
}
|
|
|
|
}
|
2001-03-13 06:38:59 +00:00
|
|
|
// Get the next child
|
|
|
|
childFrame = iter.Next();
|
1998-07-02 20:35:23 +00:00
|
|
|
}
|
2004-07-16 16:56:21 +00:00
|
|
|
FinishAndStoreOverflow(&desiredSize);
|
2004-04-14 06:22:52 +00:00
|
|
|
if (HasView()) {
|
|
|
|
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, this, GetView(), &desiredSize.mOverflowArea, 0);
|
|
|
|
}
|
1998-07-02 20:35:23 +00:00
|
|
|
// Let our base class do the usual work
|
|
|
|
}
|
|
|
|
|
2000-06-05 08:25:11 +00:00
|
|
|
// returns max-ascent amongst all cells that have 'vertical-align: baseline'
|
2000-07-28 09:19:26 +00:00
|
|
|
// *including* cells with rowspans
|
2000-06-05 08:25:11 +00:00
|
|
|
nscoord nsTableRowFrame::GetMaxCellAscent() const
|
|
|
|
{
|
|
|
|
return mMaxCellAscent;
|
|
|
|
}
|
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
nscoord
|
|
|
|
nsTableRowFrame::GetHeight(nscoord aPctBasis) const
|
2000-05-25 22:40:21 +00:00
|
|
|
{
|
2001-11-05 00:15:51 +00:00
|
|
|
nscoord height = 0;
|
|
|
|
if ((aPctBasis > 0) && HasPctHeight()) {
|
|
|
|
height = NSToCoordRound(GetPctHeight() * (float)aPctBasis);
|
|
|
|
}
|
2003-01-05 14:16:58 +00:00
|
|
|
if (HasFixedHeight()) {
|
|
|
|
height = PR_MAX(height, GetFixedHeight());
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
|
|
|
return PR_MAX(height, GetContentHeight());
|
2000-05-25 22:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-11-05 00:15:51 +00:00
|
|
|
nsTableRowFrame::ResetHeight(nscoord aFixedHeight)
|
2000-05-25 22:40:21 +00:00
|
|
|
{
|
2001-11-05 00:15:51 +00:00
|
|
|
SetHasFixedHeight(PR_FALSE);
|
|
|
|
SetHasPctHeight(PR_FALSE);
|
|
|
|
SetFixedHeight(0);
|
2003-01-05 14:16:58 +00:00
|
|
|
SetPctHeight(0);
|
2001-11-05 00:15:51 +00:00
|
|
|
SetContentHeight(0);
|
|
|
|
|
|
|
|
if (aFixedHeight > 0) {
|
|
|
|
SetFixedHeight(aFixedHeight);
|
|
|
|
}
|
|
|
|
|
2000-06-05 08:25:11 +00:00
|
|
|
mMaxCellAscent = 0;
|
|
|
|
mMaxCellDescent = 0;
|
2000-05-25 22:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-11-05 00:15:51 +00:00
|
|
|
nsTableRowFrame::UpdateHeight(nscoord aHeight,
|
|
|
|
nscoord aAscent,
|
|
|
|
nscoord aDescent,
|
|
|
|
nsTableFrame* aTableFrame,
|
|
|
|
nsTableCellFrame* aCellFrame)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2001-11-05 00:15:51 +00:00
|
|
|
if (!aTableFrame || !aCellFrame) {
|
|
|
|
NS_ASSERTION(PR_FALSE , "invalid call");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-06-05 08:25:11 +00:00
|
|
|
if (aHeight != NS_UNCONSTRAINEDSIZE) {
|
|
|
|
if (!(aCellFrame->HasVerticalAlignBaseline())) { // only the cell's height matters
|
2001-11-05 00:15:51 +00:00
|
|
|
if (GetHeight() < aHeight) {
|
2000-06-05 08:25:11 +00:00
|
|
|
PRInt32 rowSpan = aTableFrame->GetEffectiveRowSpan(*aCellFrame);
|
|
|
|
if (rowSpan == 1) {
|
2001-11-05 00:15:51 +00:00
|
|
|
SetContentHeight(aHeight);
|
2000-06-05 08:25:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else { // the alignment on the baseline can change the height
|
|
|
|
NS_ASSERTION((aAscent != NS_UNCONSTRAINEDSIZE) && (aDescent != NS_UNCONSTRAINEDSIZE), "invalid call");
|
|
|
|
// see if this is a long ascender
|
|
|
|
if (mMaxCellAscent < aAscent) {
|
|
|
|
mMaxCellAscent = aAscent;
|
|
|
|
}
|
|
|
|
// see if this is a long descender and without rowspan
|
|
|
|
if (mMaxCellDescent < aDescent) {
|
|
|
|
PRInt32 rowSpan = aTableFrame->GetEffectiveRowSpan(*aCellFrame);
|
|
|
|
if (rowSpan == 1) {
|
|
|
|
mMaxCellDescent = aDescent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// keep the tallest height in sync
|
2001-11-05 00:15:51 +00:00
|
|
|
if (GetHeight() < mMaxCellAscent + mMaxCellDescent) {
|
|
|
|
SetContentHeight(mMaxCellAscent + mMaxCellDescent);
|
2000-06-05 08:25:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
nscoord
|
|
|
|
nsTableRowFrame::CalcHeight(const nsHTMLReflowState& aReflowState)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2000-05-25 22:40:21 +00:00
|
|
|
nsTableFrame* tableFrame = nsnull;
|
2003-04-05 15:36:31 +00:00
|
|
|
nsTableFrame::GetTableFrame(this, tableFrame);
|
2001-11-05 00:15:51 +00:00
|
|
|
if (!tableFrame) return 0;
|
2000-05-25 22:40:21 +00:00
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
nscoord computedHeight = (NS_UNCONSTRAINEDSIZE == aReflowState.mComputedHeight)
|
|
|
|
? 0 : aReflowState.mComputedHeight;
|
|
|
|
ResetHeight(computedHeight);
|
2000-05-25 22:40:21 +00:00
|
|
|
|
2003-05-15 03:42:21 +00:00
|
|
|
const nsStylePosition* position = GetStylePosition();
|
2001-11-05 15:15:24 +00:00
|
|
|
if (eStyleUnit_Coord == position->mHeight.GetUnit()) {
|
|
|
|
SetFixedHeight(position->mHeight.GetCoordValue());
|
|
|
|
}
|
|
|
|
else if (eStyleUnit_Percent == position->mHeight.GetUnit()) {
|
|
|
|
SetPctHeight(position->mHeight.GetPercentValue());
|
|
|
|
}
|
|
|
|
|
2003-07-07 02:01:29 +00:00
|
|
|
for (nsIFrame* kidFrame = mFrames.FirstChild(); kidFrame;
|
|
|
|
kidFrame = kidFrame->GetNextSibling()) {
|
2003-10-31 20:19:18 +00:00
|
|
|
if (IS_TABLE_CELL(kidFrame->GetType())) {
|
2000-06-05 08:25:11 +00:00
|
|
|
nscoord availWidth = ((nsTableCellFrame *)kidFrame)->GetPriorAvailWidth();
|
|
|
|
nsSize desSize = ((nsTableCellFrame *)kidFrame)->GetDesiredSize();
|
2001-11-29 15:41:07 +00:00
|
|
|
if ((NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) && !mPrevInFlow) {
|
|
|
|
CalculateCellActualSize(kidFrame, desSize.width, desSize.height, availWidth);
|
|
|
|
}
|
2000-06-05 08:25:11 +00:00
|
|
|
// height may have changed, adjust descent to absorb any excess difference
|
|
|
|
nscoord ascent = ((nsTableCellFrame *)kidFrame)->GetDesiredAscent();
|
|
|
|
nscoord descent = desSize.height - ascent;
|
2001-11-05 00:15:51 +00:00
|
|
|
UpdateHeight(desSize.height, ascent, descent, tableFrame, (nsTableCellFrame*)kidFrame);
|
2000-05-25 22:40:21 +00:00
|
|
|
}
|
|
|
|
}
|
2001-11-05 00:15:51 +00:00
|
|
|
return GetHeight();
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_METHOD nsTableRowFrame::Paint(nsPresContext* aPresContext,
|
1999-06-07 21:10:25 +00:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
2001-09-19 12:35:19 +00:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
PRUint32 aFlags)
|
1999-06-07 21:10:25 +00:00
|
|
|
{
|
2001-01-27 14:09:34 +00:00
|
|
|
PRBool isVisible;
|
|
|
|
if (NS_SUCCEEDED(IsVisibleForPainting(aPresContext, aRenderingContext, PR_FALSE, &isVisible)) && !isVisible) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
1999-11-01 22:12:45 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
1999-06-07 21:10:25 +00:00
|
|
|
// for debug...
|
|
|
|
if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) {
|
|
|
|
aRenderingContext.SetColor(NS_RGB(0,255,0));
|
|
|
|
aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height);
|
|
|
|
}
|
1999-11-01 22:12:45 +00:00
|
|
|
#endif
|
2004-03-09 06:48:35 +00:00
|
|
|
|
|
|
|
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer &&
|
|
|
|
//direct (not table-called) background paint
|
|
|
|
!(aFlags & (NS_PAINT_FLAG_TABLE_BG_PAINT | NS_PAINT_FLAG_TABLE_CELL_BG_PASS))) {
|
2004-04-18 18:17:00 +00:00
|
|
|
nsTableFrame* tableFrame;
|
|
|
|
nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
NS_ASSERTION(tableFrame, "null table frame");
|
|
|
|
|
|
|
|
TableBackgroundPainter painter(tableFrame,
|
|
|
|
TableBackgroundPainter::eOrigin_TableRow,
|
|
|
|
aPresContext, aRenderingContext,
|
|
|
|
aDirtyRect);
|
|
|
|
nsresult rv = painter.PaintRow(this);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
aFlags |= NS_PAINT_FLAG_TABLE_BG_PAINT;
|
2004-03-09 06:48:35 +00:00
|
|
|
}
|
1999-06-07 21:10:25 +00:00
|
|
|
|
2004-09-02 23:27:23 +00:00
|
|
|
PRBool clip = GetStyleDisplay()->IsTableClip();
|
2003-12-12 23:00:54 +00:00
|
|
|
if (clip) {
|
2002-02-21 05:36:16 +00:00
|
|
|
aRenderingContext.PushState();
|
|
|
|
SetOverflowClipRect(aRenderingContext);
|
|
|
|
}
|
2004-03-09 06:48:35 +00:00
|
|
|
PaintChildren(aPresContext, aRenderingContext, aDirtyRect,
|
|
|
|
aWhichLayer, aFlags);
|
2004-04-18 13:13:35 +00:00
|
|
|
if (clip)
|
|
|
|
aRenderingContext.PopState();
|
1999-06-10 21:08:17 +00:00
|
|
|
return NS_OK;
|
1999-06-07 21:10:25 +00:00
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1998-10-20 17:45:07 +00:00
|
|
|
PRIntn
|
|
|
|
nsTableRowFrame::GetSkipSides() const
|
|
|
|
{
|
|
|
|
PRIntn skip = 0;
|
|
|
|
if (nsnull != mPrevInFlow) {
|
|
|
|
skip |= 1 << NS_SIDE_TOP;
|
|
|
|
}
|
|
|
|
if (nsnull != mNextInFlow) {
|
|
|
|
skip |= 1 << NS_SIDE_BOTTOM;
|
|
|
|
}
|
|
|
|
return skip;
|
|
|
|
}
|
|
|
|
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2000-03-22 02:43:08 +00:00
|
|
|
/* we overload this here because rows have children that can span outside of themselves.
|
|
|
|
* so the default "get the child rect, see if it contains the event point" action isn't
|
|
|
|
* sufficient. We have to ask the row if it has a child that contains the point.
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::GetFrameForPoint(nsPresContext* aPresContext,
|
2001-03-13 06:38:59 +00:00
|
|
|
const nsPoint& aPoint,
|
2000-03-22 02:43:08 +00:00
|
|
|
nsFramePaintLayer aWhichLayer,
|
2001-03-13 06:38:59 +00:00
|
|
|
nsIFrame** aFrame)
|
2000-03-22 02:43:08 +00:00
|
|
|
{
|
|
|
|
// XXX This would not need to exist (except as a one-liner, to make this
|
|
|
|
// frame work like a block frame) if rows with rowspan cells made the
|
|
|
|
// the NS_FRAME_OUTSIDE_CHILDREN bit of mState set correctly (see
|
|
|
|
// nsIFrame.h).
|
|
|
|
|
2003-12-12 22:58:25 +00:00
|
|
|
// XXXldb Do we need this anymore?
|
|
|
|
|
2000-03-22 02:43:08 +00:00
|
|
|
// I imagine fixing this would help performance of GetFrameForPoint in
|
|
|
|
// tables. It may also fix problems with relative positioning.
|
|
|
|
|
|
|
|
// This is basically copied from nsContainerFrame::GetFrameForPointUsing,
|
|
|
|
// except for one bit removed
|
|
|
|
|
2004-01-09 14:20:53 +00:00
|
|
|
nsIFrame *hit;
|
2000-03-22 02:43:08 +00:00
|
|
|
nsPoint tmp;
|
|
|
|
|
2004-01-09 14:20:53 +00:00
|
|
|
nsIFrame* kid = GetFirstChild(nsnull);
|
2000-03-22 02:43:08 +00:00
|
|
|
*aFrame = nsnull;
|
|
|
|
tmp.MoveTo(aPoint.x - mRect.x, aPoint.y - mRect.y);
|
|
|
|
while (nsnull != kid) {
|
|
|
|
nsresult rv = kid->GetFrameForPoint(aPresContext, tmp, aWhichLayer, &hit);
|
|
|
|
|
|
|
|
if (NS_SUCCEEDED(rv) && hit) {
|
|
|
|
*aFrame = hit;
|
|
|
|
}
|
2003-07-07 02:01:29 +00:00
|
|
|
kid = kid->GetNextSibling();
|
2000-03-22 02:43:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (*aFrame) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
1999-08-21 20:16:32 +00:00
|
|
|
// Calculate the cell's actual size given its pass2 desired width and height.
|
|
|
|
// Takes into account the specified height (in the style), and any special logic
|
|
|
|
// needed for backwards compatibility.
|
|
|
|
// Modifies the desired width and height that are passed in.
|
|
|
|
nsresult
|
2000-05-25 22:40:21 +00:00
|
|
|
nsTableRowFrame::CalculateCellActualSize(nsIFrame* aCellFrame,
|
|
|
|
nscoord& aDesiredWidth,
|
|
|
|
nscoord& aDesiredHeight,
|
|
|
|
nscoord aAvailWidth)
|
1999-08-21 20:16:32 +00:00
|
|
|
{
|
2001-11-05 00:15:51 +00:00
|
|
|
nscoord specifiedHeight = 0;
|
1999-08-21 20:16:32 +00:00
|
|
|
|
|
|
|
// Get the height specified in the style information
|
2003-05-15 03:42:21 +00:00
|
|
|
const nsStylePosition* position = aCellFrame->GetStylePosition();
|
2001-11-05 00:15:51 +00:00
|
|
|
|
|
|
|
nsTableFrame* tableFrame = nsnull;
|
|
|
|
nsTableFrame::GetTableFrame(this, tableFrame);
|
|
|
|
if (!tableFrame) return NS_ERROR_NULL_POINTER;
|
|
|
|
|
|
|
|
PRInt32 rowSpan = tableFrame->GetEffectiveRowSpan((nsTableCellFrame&)*aCellFrame);
|
1999-08-21 20:16:32 +00:00
|
|
|
|
|
|
|
switch (position->mHeight.GetUnit()) {
|
2001-03-13 06:38:59 +00:00
|
|
|
case eStyleUnit_Coord:
|
|
|
|
specifiedHeight = position->mHeight.GetCoordValue();
|
2001-11-05 00:15:51 +00:00
|
|
|
if (1 == rowSpan)
|
|
|
|
SetFixedHeight(specifiedHeight);
|
2001-03-13 06:38:59 +00:00
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent: {
|
2001-11-05 00:15:51 +00:00
|
|
|
if (1 == rowSpan)
|
|
|
|
SetPctHeight(position->mHeight.GetPercentValue());
|
|
|
|
// pct heights are handled when all of the cells are finished, so don't set specifiedHeight
|
1999-08-25 21:49:18 +00:00
|
|
|
break;
|
|
|
|
}
|
2001-03-13 06:38:59 +00:00
|
|
|
case eStyleUnit_Auto:
|
|
|
|
default:
|
|
|
|
break;
|
1999-08-21 20:16:32 +00:00
|
|
|
}
|
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
// If the specified height is greater than the desired height, then use the specified height
|
1999-08-21 20:16:32 +00:00
|
|
|
if (specifiedHeight > aDesiredHeight)
|
|
|
|
aDesiredHeight = specifiedHeight;
|
2000-05-25 22:40:21 +00:00
|
|
|
|
2001-09-26 13:49:26 +00:00
|
|
|
if ((0 == aDesiredWidth) && (NS_UNCONSTRAINEDSIZE != aAvailWidth)) { // special Nav4 compatibility code for the width
|
1999-08-21 20:16:32 +00:00
|
|
|
aDesiredWidth = aAvailWidth;
|
2000-05-25 22:40:21 +00:00
|
|
|
}
|
1999-08-21 20:16:32 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calculates the available width for the table cell based on the known
|
|
|
|
// column widths taking into account column spans and column spacing
|
2001-10-26 02:30:38 +00:00
|
|
|
static void
|
|
|
|
CalcAvailWidth(nsTableFrame& aTableFrame,
|
|
|
|
nscoord aTableComputedWidth,
|
2003-03-21 19:35:36 +00:00
|
|
|
float aPixelToTwips,
|
2001-10-26 02:30:38 +00:00
|
|
|
nsTableCellFrame& aCellFrame,
|
|
|
|
nscoord aCellSpacingX,
|
|
|
|
nscoord& aColAvailWidth,
|
|
|
|
nscoord& aCellAvailWidth)
|
1999-08-21 20:16:32 +00:00
|
|
|
{
|
2001-10-26 02:30:38 +00:00
|
|
|
aColAvailWidth = aCellAvailWidth = 0;
|
2002-09-09 18:46:06 +00:00
|
|
|
PRInt32 colIndex;
|
|
|
|
aCellFrame.GetColIndex(colIndex);
|
|
|
|
PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
|
|
|
|
nscoord cellSpacing = 0;
|
|
|
|
|
|
|
|
for (PRInt32 spanX = 0; spanX < colspan; spanX++) {
|
|
|
|
nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX);
|
|
|
|
if (colWidth > 0) {
|
|
|
|
aColAvailWidth += colWidth;
|
|
|
|
}
|
|
|
|
if ((spanX > 0) && (aTableFrame.GetNumCellsOriginatingInCol(colIndex + spanX) > 0)) {
|
|
|
|
cellSpacing += aCellSpacingX;
|
2001-10-26 02:30:38 +00:00
|
|
|
}
|
|
|
|
}
|
2002-09-09 18:46:06 +00:00
|
|
|
if (aColAvailWidth > 0) {
|
|
|
|
aColAvailWidth += cellSpacing;
|
|
|
|
}
|
|
|
|
aCellAvailWidth = aColAvailWidth;
|
2001-10-26 02:30:38 +00:00
|
|
|
|
2002-06-14 14:21:03 +00:00
|
|
|
// for a cell with a colspan > 1, use its fix width (if set) as the avail width
|
|
|
|
// if this is its initial reflow
|
2003-07-07 02:01:29 +00:00
|
|
|
if ((aCellFrame.GetStateBits() & NS_FRAME_FIRST_REFLOW)
|
|
|
|
&& (aTableFrame.GetEffectiveColSpan(aCellFrame) > 1)) {
|
2001-10-26 02:30:38 +00:00
|
|
|
// see if the cell has a style width specified
|
2003-05-15 03:42:21 +00:00
|
|
|
const nsStylePosition* cellPosition = aCellFrame.GetStylePosition();
|
2001-10-26 02:30:38 +00:00
|
|
|
if (eStyleUnit_Coord == cellPosition->mWidth.GetUnit()) {
|
|
|
|
// need to add padding into fixed width
|
2003-03-21 19:35:36 +00:00
|
|
|
nsMargin borderPadding(0,0,0,0);
|
2001-10-26 02:30:38 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE != aTableComputedWidth) {
|
2003-03-21 19:35:36 +00:00
|
|
|
borderPadding = nsTableFrame::GetBorderPadding(nsSize(aTableComputedWidth, 0),
|
|
|
|
aPixelToTwips, &aCellFrame);
|
2001-10-26 02:30:38 +00:00
|
|
|
}
|
2003-03-21 19:35:36 +00:00
|
|
|
nscoord fixWidth = cellPosition->mWidth.GetCoordValue() + borderPadding.left + borderPadding.right;
|
2001-10-26 02:30:38 +00:00
|
|
|
aCellAvailWidth = PR_MIN(aColAvailWidth, fixWidth);
|
1999-08-21 20:16:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
nscoord
|
|
|
|
GetSpaceBetween(PRInt32 aPrevColIndex,
|
|
|
|
PRInt32 aColIndex,
|
|
|
|
PRInt32 aColSpan,
|
|
|
|
nsTableFrame& aTableFrame,
|
|
|
|
nscoord aCellSpacingX,
|
|
|
|
PRBool aIsLeftToRight)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
2001-03-13 06:38:59 +00:00
|
|
|
nscoord space = 0;
|
|
|
|
PRInt32 colX;
|
|
|
|
if (aIsLeftToRight) {
|
|
|
|
for (colX = aPrevColIndex + 1; aColIndex > colX; colX++) {
|
|
|
|
space += aTableFrame.GetColumnWidth(colX);
|
|
|
|
if (aTableFrame.GetNumCellsOriginatingInCol(colX) > 0) {
|
|
|
|
space += aCellSpacingX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
PRInt32 lastCol = aColIndex + aColSpan - 1;
|
|
|
|
for (colX = aPrevColIndex - 1; colX > lastCol; colX--) {
|
|
|
|
space += aTableFrame.GetColumnWidth(colX);
|
|
|
|
if (aTableFrame.GetNumCellsOriginatingInCol(colX) > 0) {
|
|
|
|
space += aCellSpacingX;
|
|
|
|
}
|
|
|
|
}
|
1999-04-22 03:51:58 +00:00
|
|
|
}
|
2001-03-13 06:38:59 +00:00
|
|
|
return space;
|
|
|
|
}
|
1999-04-22 03:51:58 +00:00
|
|
|
|
2001-10-26 02:30:38 +00:00
|
|
|
static nscoord
|
|
|
|
GetComputedWidth(const nsHTMLReflowState& aReflowState,
|
|
|
|
nsTableFrame& aTableFrame)
|
|
|
|
{
|
|
|
|
const nsHTMLReflowState* parentReflow = aReflowState.parentReflowState;
|
|
|
|
nscoord computedWidth = 0;
|
|
|
|
while (parentReflow) {
|
|
|
|
if (parentReflow->frame == &aTableFrame) {
|
|
|
|
computedWidth = parentReflow->mComputedWidth;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
parentReflow = parentReflow->parentReflowState;
|
|
|
|
}
|
|
|
|
return computedWidth;
|
|
|
|
}
|
1999-10-17 03:17:53 +00:00
|
|
|
|
2002-03-27 05:50:24 +00:00
|
|
|
// subtract the heights of aRow's prev in flows from the unpaginated height
|
|
|
|
static
|
2004-07-31 23:15:21 +00:00
|
|
|
nscoord CalcHeightFromUnpaginatedHeight(nsPresContext* aPresContext,
|
2002-03-27 05:50:24 +00:00
|
|
|
nsTableRowFrame& aRow)
|
|
|
|
{
|
|
|
|
nscoord height = 0;
|
2003-07-07 02:01:29 +00:00
|
|
|
nsTableRowFrame* firstInFlow = (nsTableRowFrame*)aRow.GetFirstInFlow();
|
|
|
|
if (!firstInFlow) ABORT1(0);
|
2002-03-27 05:50:24 +00:00
|
|
|
if (firstInFlow->HasUnpaginatedHeight()) {
|
|
|
|
height = firstInFlow->GetUnpaginatedHeight(aPresContext);
|
2003-07-07 02:01:29 +00:00
|
|
|
for (nsIFrame* prevInFlow = aRow.GetPrevInFlow(); prevInFlow;
|
2004-09-14 02:28:03 +00:00
|
|
|
prevInFlow = prevInFlow->GetPrevInFlow()) {
|
2003-07-07 02:01:29 +00:00
|
|
|
height -= prevInFlow->GetSize().height;
|
2002-03-27 05:50:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return PR_MAX(height, 0);
|
|
|
|
}
|
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
// Called for a dirty or resize reflow. Reflows all the existing table cell
|
|
|
|
// frames unless aDirtyOnly is PR_TRUE in which case only reflow the dirty frames
|
1999-10-17 03:17:53 +00:00
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
NS_METHOD
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
|
2001-03-13 06:38:59 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsTableFrame& aTableFrame,
|
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
PRBool aDirtyOnly)
|
|
|
|
{
|
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
1998-11-20 01:01:25 +00:00
|
|
|
|
2002-02-19 15:48:28 +00:00
|
|
|
GET_PIXELS_TO_TWIPS(aPresContext, p2t);
|
|
|
|
PRBool borderCollapse = (((nsTableFrame*)aTableFrame.GetFirstInFlow())->IsBorderCollapse());
|
|
|
|
|
2004-09-14 02:28:03 +00:00
|
|
|
nsIFrame* tablePrevInFlow = aTableFrame.GetPrevInFlow();
|
2004-03-03 18:24:20 +00:00
|
|
|
PRBool isPaginated = aPresContext->IsPaginated();
|
2001-03-13 06:38:59 +00:00
|
|
|
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
2002-02-19 15:48:28 +00:00
|
|
|
nscoord cellSpacingX = aTableFrame.GetCellSpacingX();
|
2001-03-13 06:38:59 +00:00
|
|
|
PRInt32 cellColSpan = 1; // must be defined here so it's set properly for non-cell kids
|
|
|
|
|
|
|
|
nsTableIteration dir = (aReflowState.availableWidth == NS_UNCONSTRAINEDSIZE)
|
1999-05-04 19:15:56 +00:00
|
|
|
? eTableLTR : eTableDIR;
|
2004-01-18 10:28:40 +00:00
|
|
|
nsTableIterator iter(*this, dir);
|
2001-03-13 06:38:59 +00:00
|
|
|
// remember the col index of the previous cell to handle rowspans into this row
|
2002-02-19 15:48:28 +00:00
|
|
|
PRInt32 firstPrevColIndex = (iter.IsLeftToRight()) ? -1 : aTableFrame.GetColCount();
|
2001-03-13 06:38:59 +00:00
|
|
|
PRInt32 prevColIndex = firstPrevColIndex;
|
|
|
|
nscoord x = 0; // running total of children x offset
|
1999-05-04 19:15:56 +00:00
|
|
|
|
2002-02-19 15:48:28 +00:00
|
|
|
PRBool isAutoLayout = aTableFrame.IsAutoLayout();
|
2001-03-13 06:38:59 +00:00
|
|
|
PRBool needToNotifyTable = PR_TRUE;
|
2001-11-15 14:58:27 +00:00
|
|
|
nscoord paginatedHeight = 0;
|
2001-11-14 11:40:03 +00:00
|
|
|
// If the incremental reflow command is a StyleChanged reflow and
|
|
|
|
// it's target is the current frame, then make sure we send
|
|
|
|
// StyleChange reflow reasons down to the children so that they
|
|
|
|
// don't over-optimize their reflow.
|
2002-05-10 18:22:41 +00:00
|
|
|
|
2001-11-14 11:40:03 +00:00
|
|
|
PRBool notifyStyleChange = PR_FALSE;
|
|
|
|
if (eReflowReason_Incremental == aReflowState.reason) {
|
2002-05-10 18:22:41 +00:00
|
|
|
nsHTMLReflowCommand* command = aReflowState.path->mReflowCommand;
|
|
|
|
if (command) {
|
2001-12-17 22:39:59 +00:00
|
|
|
nsReflowType type;
|
2002-05-10 18:22:41 +00:00
|
|
|
command->GetType(type);
|
2001-12-17 22:39:59 +00:00
|
|
|
if (eReflowType_StyleChanged == type) {
|
2001-11-14 11:40:03 +00:00
|
|
|
notifyStyleChange = PR_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1998-07-10 22:56:13 +00:00
|
|
|
// Reflow each of our existing cell frames
|
1999-04-22 03:51:58 +00:00
|
|
|
nsIFrame* kidFrame = iter.First();
|
2001-03-13 06:38:59 +00:00
|
|
|
while (kidFrame) {
|
2003-10-31 20:19:18 +00:00
|
|
|
nsIAtom* frameType = kidFrame->GetType();
|
2001-11-05 00:15:51 +00:00
|
|
|
|
1999-08-03 02:41:27 +00:00
|
|
|
// See if we should only reflow the dirty child frames
|
2001-03-13 06:38:59 +00:00
|
|
|
PRBool doReflowChild = PR_TRUE;
|
2003-07-07 02:01:29 +00:00
|
|
|
if (aDirtyOnly && ((kidFrame->GetStateBits() & NS_FRAME_IS_DIRTY) == 0)) {
|
2001-03-13 06:38:59 +00:00
|
|
|
doReflowChild = PR_FALSE;
|
1999-08-03 02:41:27 +00:00
|
|
|
}
|
2002-10-03 14:33:23 +00:00
|
|
|
else if ((NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight) && IS_TABLE_CELL(frameType)) {
|
|
|
|
// We don't reflow a rowspan >1 cell here with a constrained height.
|
|
|
|
// That happens in nsTableRowGroupFrame::SplitSpanningCells.
|
|
|
|
if (aTableFrame.GetEffectiveRowSpan((nsTableCellFrame&)*kidFrame) > 1) {
|
|
|
|
doReflowChild = PR_FALSE;
|
|
|
|
}
|
|
|
|
}
|
2001-12-07 14:51:12 +00:00
|
|
|
if (aReflowState.mFlags.mSpecialHeightReflow) {
|
2003-10-31 20:19:18 +00:00
|
|
|
if (!isPaginated && (IS_TABLE_CELL(frameType) &&
|
2001-11-05 00:15:51 +00:00
|
|
|
!((nsTableCellFrame*)kidFrame)->NeedSpecialReflow())) {
|
|
|
|
kidFrame = iter.Next();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2001-03-13 06:38:59 +00:00
|
|
|
|
1999-08-03 02:41:27 +00:00
|
|
|
// Reflow the child frame
|
|
|
|
if (doReflowChild) {
|
2003-10-31 20:19:18 +00:00
|
|
|
if (IS_TABLE_CELL(frameType)) {
|
2001-03-13 06:38:59 +00:00
|
|
|
nsTableCellFrame* cellFrame = (nsTableCellFrame*)kidFrame;
|
1999-08-03 02:41:27 +00:00
|
|
|
PRInt32 cellColIndex;
|
2001-03-13 06:38:59 +00:00
|
|
|
cellFrame->GetColIndex(cellColIndex);
|
2002-02-19 15:48:28 +00:00
|
|
|
cellColSpan = aTableFrame.GetEffectiveColSpan(*cellFrame);
|
2004-03-09 06:48:35 +00:00
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
// If the adjacent cell is in a prior row (because of a rowspan) add in the space
|
|
|
|
if ((iter.IsLeftToRight() && (prevColIndex != (cellColIndex - 1))) ||
|
|
|
|
(!iter.IsLeftToRight() && (prevColIndex != cellColIndex + cellColSpan))) {
|
2002-02-19 15:48:28 +00:00
|
|
|
x += GetSpaceBetween(prevColIndex, cellColIndex, cellColSpan, aTableFrame,
|
2001-03-13 06:38:59 +00:00
|
|
|
cellSpacingX, iter.IsLeftToRight());
|
1998-09-16 00:48:14 +00:00
|
|
|
}
|
2001-03-13 06:38:59 +00:00
|
|
|
// Calculate the available width for the table cell using the known column widths
|
2001-10-26 02:30:38 +00:00
|
|
|
nscoord availColWidth, availCellWidth;
|
2003-03-21 19:35:36 +00:00
|
|
|
CalcAvailWidth(aTableFrame, GetComputedWidth(aReflowState, aTableFrame), p2t,
|
2001-10-26 02:30:38 +00:00
|
|
|
*cellFrame, cellSpacingX, availColWidth, availCellWidth);
|
|
|
|
if (0 == availColWidth) availColWidth = NS_UNCONSTRAINEDSIZE;
|
|
|
|
if (0 == availCellWidth) availCellWidth = NS_UNCONSTRAINEDSIZE;
|
2001-03-13 06:38:59 +00:00
|
|
|
|
1999-08-03 02:41:27 +00:00
|
|
|
// remember the rightmost (ltr) or leftmost (rtl) column this cell spans into
|
|
|
|
prevColIndex = (iter.IsLeftToRight()) ? cellColIndex + (cellColSpan - 1) : cellColIndex;
|
2004-06-06 20:45:23 +00:00
|
|
|
// always request MEW. Since we may turn MEW on for selected cells during incremental
|
|
|
|
// reflow, we need to request MEW *now* so that those incremental reflows will be
|
|
|
|
// able to build on existing MEW data in the children.
|
|
|
|
nsHTMLReflowMetrics desiredSize(PR_TRUE);
|
1999-08-03 02:41:27 +00:00
|
|
|
|
2001-08-06 14:04:58 +00:00
|
|
|
// If the avail width is not the same as last time we reflowed the cell or
|
|
|
|
// the cell wants to be bigger than what was available last time or
|
|
|
|
// it is a style change reflow or we are printing, then we must reflow the
|
|
|
|
// cell. Otherwise we can skip the reflow.
|
2004-09-14 02:28:03 +00:00
|
|
|
nsIFrame* kidNextInFlow = kidFrame->GetNextInFlow();
|
2001-08-06 14:04:58 +00:00
|
|
|
nsSize cellDesiredSize = cellFrame->GetDesiredSize();
|
2002-04-10 21:32:41 +00:00
|
|
|
if ((availCellWidth != cellFrame->GetPriorAvailWidth()) ||
|
2001-08-06 14:04:58 +00:00
|
|
|
(cellDesiredSize.width > cellFrame->GetPriorAvailWidth()) ||
|
|
|
|
(eReflowReason_StyleChange == aReflowState.reason) ||
|
2001-11-05 00:15:51 +00:00
|
|
|
isPaginated ||
|
2002-05-09 14:44:02 +00:00
|
|
|
(cellFrame->NeedPass2Reflow() &&
|
|
|
|
NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth) ||
|
2001-12-07 14:51:12 +00:00
|
|
|
(aReflowState.mFlags.mSpecialHeightReflow && cellFrame->NeedSpecialReflow()) ||
|
2002-04-10 21:32:41 +00:00
|
|
|
(!aReflowState.mFlags.mSpecialHeightReflow && cellFrame->HadSpecialReflow()) ||
|
|
|
|
HasPctHeight() ||
|
|
|
|
notifyStyleChange) {
|
2001-03-13 06:38:59 +00:00
|
|
|
// Reflow the cell to fit the available width, height
|
2001-10-26 02:30:38 +00:00
|
|
|
nsSize kidAvailSize(availColWidth, aReflowState.availableHeight);
|
2001-03-13 06:38:59 +00:00
|
|
|
nsReflowReason reason = eReflowReason_Resize;
|
2001-03-25 20:06:29 +00:00
|
|
|
PRBool cellToWatch = PR_FALSE;
|
1999-08-03 02:41:27 +00:00
|
|
|
// If it's a dirty frame, then check whether it's the initial reflow
|
2003-07-07 02:01:29 +00:00
|
|
|
if (kidFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) {
|
2001-03-13 06:38:59 +00:00
|
|
|
reason = eReflowReason_Initial;
|
2001-03-25 20:06:29 +00:00
|
|
|
cellToWatch = PR_TRUE;
|
|
|
|
}
|
|
|
|
else if (eReflowReason_StyleChange == aReflowState.reason) {
|
|
|
|
reason = eReflowReason_StyleChange;
|
|
|
|
cellToWatch = PR_TRUE;
|
|
|
|
}
|
2001-11-14 11:40:03 +00:00
|
|
|
else if (notifyStyleChange) {
|
|
|
|
reason = eReflowReason_StyleChange;
|
|
|
|
cellToWatch = PR_TRUE;
|
|
|
|
}
|
2001-03-25 20:06:29 +00:00
|
|
|
if (cellToWatch) {
|
2001-03-13 06:38:59 +00:00
|
|
|
cellFrame->DidSetStyleContext(aPresContext); // XXX check this
|
2001-03-22 15:59:37 +00:00
|
|
|
if (!tablePrevInFlow && isAutoLayout) {
|
2001-03-13 06:38:59 +00:00
|
|
|
// request the maximum width if availWidth is constrained
|
|
|
|
// XXX we could just do this always, but blocks have some problems
|
2001-10-26 02:30:38 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE != availCellWidth) {
|
2001-03-13 06:38:59 +00:00
|
|
|
desiredSize.mFlags |= NS_REFLOW_CALC_MAX_WIDTH;
|
|
|
|
}
|
2001-03-25 20:06:29 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
cellToWatch = PR_FALSE;
|
1999-08-03 02:41:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
nscoord oldMaxWidth = cellFrame->GetMaximumWidth();
|
2001-11-30 15:05:51 +00:00
|
|
|
nscoord oldMaxElemWidth = cellFrame->GetPass1MaxElementWidth();
|
2000-05-04 23:16:42 +00:00
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
// Reflow the child
|
|
|
|
nsTableCellReflowState kidReflowState(aPresContext, aReflowState,
|
|
|
|
kidFrame, kidAvailSize, reason);
|
2002-02-19 15:48:28 +00:00
|
|
|
InitChildReflowState(*aPresContext, kidAvailSize, borderCollapse, p2t, kidReflowState);
|
|
|
|
|
1999-08-03 02:41:27 +00:00
|
|
|
nsReflowStatus status;
|
1999-11-19 15:33:29 +00:00
|
|
|
rv = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState,
|
2001-03-13 06:38:59 +00:00
|
|
|
x, 0, 0, status);
|
|
|
|
|
2001-03-25 20:06:29 +00:00
|
|
|
if (cellToWatch) {
|
2001-10-26 02:30:38 +00:00
|
|
|
nscoord maxWidth = (NS_UNCONSTRAINEDSIZE == availCellWidth)
|
2001-03-13 06:38:59 +00:00
|
|
|
? desiredSize.width : desiredSize.mMaximumWidth;
|
|
|
|
// save the max element width and max width
|
2003-01-09 14:26:32 +00:00
|
|
|
if (desiredSize.mComputeMEW) {
|
|
|
|
cellFrame->SetPass1MaxElementWidth(desiredSize.width, desiredSize.mMaxElementWidth);
|
|
|
|
if (desiredSize.mMaxElementWidth > desiredSize.width) {
|
2001-11-30 15:05:51 +00:00
|
|
|
NS_ASSERTION(PR_FALSE, "max element width exceeded desired width");
|
2003-01-09 14:26:32 +00:00
|
|
|
desiredSize.width = desiredSize.mMaxElementWidth;
|
2001-11-30 15:05:51 +00:00
|
|
|
}
|
2001-03-13 06:38:59 +00:00
|
|
|
}
|
|
|
|
cellFrame->SetMaximumWidth(maxWidth);
|
1999-08-03 02:41:27 +00:00
|
|
|
}
|
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
// allow the table to determine if/how the table needs to be rebalanced
|
2001-03-25 20:06:29 +00:00
|
|
|
if (cellToWatch && needToNotifyTable) {
|
2002-02-19 15:48:28 +00:00
|
|
|
needToNotifyTable = !aTableFrame.CellChangedWidth(*cellFrame, oldMaxWidth, oldMaxElemWidth);
|
1999-08-03 02:41:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// If any of the cells are not complete, then we're not complete
|
|
|
|
if (NS_FRAME_IS_NOT_COMPLETE(status)) {
|
|
|
|
aStatus = NS_FRAME_NOT_COMPLETE;
|
|
|
|
}
|
|
|
|
}
|
2001-03-13 06:38:59 +00:00
|
|
|
else {
|
2003-12-12 22:58:25 +00:00
|
|
|
desiredSize.width = cellDesiredSize.width;
|
|
|
|
desiredSize.height = cellDesiredSize.height;
|
|
|
|
nsRect *overflowArea =
|
2004-07-16 16:56:21 +00:00
|
|
|
cellFrame->GetOverflowAreaProperty();
|
2003-12-12 22:58:25 +00:00
|
|
|
if (overflowArea)
|
|
|
|
desiredSize.mOverflowArea = *overflowArea;
|
|
|
|
else
|
|
|
|
desiredSize.mOverflowArea.SetRect(0, 0, cellDesiredSize.width,
|
|
|
|
cellDesiredSize.height);
|
2003-09-13 16:26:30 +00:00
|
|
|
|
2002-04-07 18:26:35 +00:00
|
|
|
// if we are in a floated table, our position is not yet established, so we cannot reposition our views
|
|
|
|
// the containing glock will do this for us after positioning the table
|
2003-05-15 03:42:21 +00:00
|
|
|
if (!aTableFrame.GetStyleDisplay()->IsFloating()) {
|
2002-04-07 18:26:35 +00:00
|
|
|
// Because we may have moved the frame we need to make sure any views are
|
|
|
|
// positioned properly. We have to do this, because any one of our parent
|
|
|
|
// frames could have moved and we have no way of knowing...
|
|
|
|
nsTableFrame::RePositionViews(aPresContext, kidFrame);
|
|
|
|
}
|
1998-10-06 00:27:22 +00:00
|
|
|
}
|
2001-11-15 14:58:27 +00:00
|
|
|
|
2002-03-27 05:50:24 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) {
|
|
|
|
if (!mPrevInFlow) {
|
|
|
|
// Calculate the cell's actual size given its pass2 size. This function
|
|
|
|
// takes into account the specified height (in the style), and any special
|
|
|
|
// logic needed for backwards compatibility
|
|
|
|
CalculateCellActualSize(kidFrame, desiredSize.width,
|
|
|
|
desiredSize.height, availCellWidth);
|
|
|
|
}
|
2001-11-15 14:58:27 +00:00
|
|
|
// height may have changed, adjust descent to absorb any excess difference
|
|
|
|
nscoord ascent = cellFrame->GetDesiredAscent();
|
|
|
|
nscoord descent = desiredSize.height - ascent;
|
2002-02-19 15:48:28 +00:00
|
|
|
UpdateHeight(desiredSize.height, ascent, descent, &aTableFrame, cellFrame);
|
2001-11-15 14:58:27 +00:00
|
|
|
}
|
|
|
|
else {
|
2002-03-27 05:50:24 +00:00
|
|
|
paginatedHeight = PR_MAX(paginatedHeight, desiredSize.height);
|
2002-02-19 15:48:28 +00:00
|
|
|
PRInt32 rowSpan = aTableFrame.GetEffectiveRowSpan((nsTableCellFrame&)*kidFrame);
|
2002-03-27 05:50:24 +00:00
|
|
|
if (1 == rowSpan) {
|
2001-11-15 14:58:27 +00:00
|
|
|
SetContentHeight(paginatedHeight);
|
|
|
|
}
|
|
|
|
}
|
2000-06-05 08:25:11 +00:00
|
|
|
|
1999-08-03 02:41:27 +00:00
|
|
|
// Place the child
|
2001-10-26 02:30:38 +00:00
|
|
|
if (NS_UNCONSTRAINEDSIZE != availColWidth) {
|
|
|
|
desiredSize.width = PR_MAX(availCellWidth, availColWidth);
|
|
|
|
}
|
|
|
|
|
2001-12-07 14:51:12 +00:00
|
|
|
FinishReflowChild(kidFrame, aPresContext, nsnull, desiredSize, x, 0, 0);
|
2003-09-13 16:26:30 +00:00
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
x += desiredSize.width;
|
1998-09-16 00:48:14 +00:00
|
|
|
}
|
2001-03-13 06:38:59 +00:00
|
|
|
else {// it's an unknown frame type, give it a generic reflow and ignore the results
|
|
|
|
nsTableCellReflowState kidReflowState(aPresContext, aReflowState,
|
2000-05-04 23:16:42 +00:00
|
|
|
kidFrame, nsSize(0,0), eReflowReason_Resize);
|
2002-02-19 15:48:28 +00:00
|
|
|
InitChildReflowState(*aPresContext, nsSize(0,0), PR_FALSE, p2t, kidReflowState);
|
2003-09-13 16:26:30 +00:00
|
|
|
nsHTMLReflowMetrics desiredSize(PR_FALSE);
|
1999-08-03 02:41:27 +00:00
|
|
|
nsReflowStatus status;
|
1999-11-19 15:33:29 +00:00
|
|
|
ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState, 0, 0, 0, status);
|
2001-12-07 14:51:12 +00:00
|
|
|
kidFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
|
1998-09-16 00:48:14 +00:00
|
|
|
}
|
1998-10-23 17:24:57 +00:00
|
|
|
}
|
2003-10-31 20:19:18 +00:00
|
|
|
else if (IS_TABLE_CELL(frameType)) {
|
2000-11-15 14:59:47 +00:00
|
|
|
// we need to account for the cell's width even if it isn't reflowed
|
2003-07-07 02:01:29 +00:00
|
|
|
x += kidFrame->GetSize().width;
|
2000-11-15 14:59:47 +00:00
|
|
|
}
|
2003-09-13 16:26:30 +00:00
|
|
|
ConsiderChildOverflow(aPresContext, aDesiredSize.mOverflowArea, kidFrame);
|
1999-04-22 03:51:58 +00:00
|
|
|
kidFrame = iter.Next(); // Get the next child
|
2004-03-09 06:48:35 +00:00
|
|
|
x += cellSpacingX;
|
1998-09-16 17:19:20 +00:00
|
|
|
}
|
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
// just set our width to what was available. The table will calculate the width and not use our value.
|
|
|
|
aDesiredSize.width = aReflowState.availableWidth;
|
2002-03-27 05:50:24 +00:00
|
|
|
|
2002-03-31 17:44:57 +00:00
|
|
|
if (aReflowState.mFlags.mSpecialHeightReflow) {
|
|
|
|
aDesiredSize.height = mRect.height;
|
|
|
|
}
|
|
|
|
else if (NS_UNCONSTRAINEDSIZE == aReflowState.availableHeight) {
|
2002-03-27 05:50:24 +00:00
|
|
|
aDesiredSize.height = CalcHeight(aReflowState);
|
|
|
|
if (mPrevInFlow) {
|
|
|
|
nscoord height = CalcHeightFromUnpaginatedHeight(aPresContext, *this);
|
|
|
|
aDesiredSize.height = PR_MAX(aDesiredSize.height, height);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (isPaginated && HasStyleHeight()) {
|
|
|
|
// set the unpaginated height so next in flows can try to honor it
|
|
|
|
SetHasUnpaginatedHeight(PR_TRUE);
|
|
|
|
SetUnpaginatedHeight(aPresContext, aDesiredSize.height);
|
|
|
|
}
|
|
|
|
if (isPaginated && HasUnpaginatedHeight()) {
|
|
|
|
aDesiredSize.height = PR_MAX(aDesiredSize.height, GetUnpaginatedHeight(aPresContext));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else { // constrained height, paginated
|
|
|
|
aDesiredSize.height = paginatedHeight;
|
|
|
|
if (aDesiredSize.height <= aReflowState.availableHeight) {
|
|
|
|
nscoord height = CalcHeightFromUnpaginatedHeight(aPresContext, *this);
|
|
|
|
aDesiredSize.height = PR_MAX(aDesiredSize.height, height);
|
|
|
|
aDesiredSize.height = PR_MIN(aDesiredSize.height, aReflowState.availableHeight);
|
|
|
|
}
|
|
|
|
}
|
2003-09-13 16:26:30 +00:00
|
|
|
nsRect rowRect(0, 0, aDesiredSize.width, aDesiredSize.height);
|
|
|
|
aDesiredSize.mOverflowArea.UnionRect(aDesiredSize.mOverflowArea, rowRect);
|
2004-07-16 16:56:21 +00:00
|
|
|
FinishAndStoreOverflow(&aDesiredSize);
|
1998-10-20 15:59:56 +00:00
|
|
|
return rv;
|
1998-04-23 17:29:07 +00:00
|
|
|
}
|
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_METHOD nsTableRowFrame::IncrementalReflow(nsPresContext* aPresContext,
|
2001-03-13 06:38:59 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsTableFrame& aTableFrame,
|
|
|
|
nsReflowStatus& aStatus)
|
1998-07-01 03:03:32 +00:00
|
|
|
{
|
2001-11-05 00:15:51 +00:00
|
|
|
CalcHeight(aReflowState); // need to recalculate it based on last reflow sizes
|
2000-05-25 22:40:21 +00:00
|
|
|
|
2002-05-10 18:22:41 +00:00
|
|
|
// the row is a target if its path has a reflow command
|
|
|
|
nsHTMLReflowCommand* command = aReflowState.path->mReflowCommand;
|
|
|
|
if (command)
|
|
|
|
IR_TargetIsMe(aPresContext, aDesiredSize, aReflowState, aTableFrame, aStatus);
|
|
|
|
|
|
|
|
// see if the chidren are targets as well
|
|
|
|
nsReflowPath::iterator iter = aReflowState.path->FirstChild();
|
|
|
|
nsReflowPath::iterator end = aReflowState.path->EndChildren();
|
|
|
|
for (; iter != end; ++iter)
|
|
|
|
IR_TargetIsChild(aPresContext, aDesiredSize, aReflowState, aTableFrame, aStatus, *iter);
|
|
|
|
|
|
|
|
return NS_OK;
|
1998-10-14 16:32:45 +00:00
|
|
|
}
|
1998-07-14 15:29:50 +00:00
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
NS_METHOD
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::IR_TargetIsMe(nsPresContext* aPresContext,
|
2001-03-13 06:38:59 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsTableFrame& aTableFrame,
|
|
|
|
nsReflowStatus& aStatus)
|
1998-10-14 16:32:45 +00:00
|
|
|
{
|
|
|
|
nsresult rv = NS_FRAME_COMPLETE;
|
|
|
|
|
2001-12-17 22:39:59 +00:00
|
|
|
nsReflowType type;
|
2002-05-10 18:22:41 +00:00
|
|
|
aReflowState.path->mReflowCommand->GetType(type);
|
2001-03-13 06:38:59 +00:00
|
|
|
switch (type) {
|
2001-12-17 22:39:59 +00:00
|
|
|
case eReflowType_ReflowDirty:
|
2001-03-13 06:38:59 +00:00
|
|
|
// Reflow the dirty child frames. Typically this is newly added frames.
|
|
|
|
rv = ReflowChildren(aPresContext, aDesiredSize, aReflowState, aTableFrame, aStatus, PR_TRUE);
|
|
|
|
break;
|
2001-12-17 22:39:59 +00:00
|
|
|
case eReflowType_StyleChanged :
|
2001-03-13 06:38:59 +00:00
|
|
|
rv = IR_StyleChanged(aPresContext, aDesiredSize, aReflowState, aTableFrame, aStatus);
|
|
|
|
break;
|
2001-12-17 22:39:59 +00:00
|
|
|
case eReflowType_ContentChanged :
|
2001-03-13 06:38:59 +00:00
|
|
|
NS_ASSERTION(PR_FALSE, "illegal reflow type: ContentChanged");
|
|
|
|
rv = NS_ERROR_ILLEGAL_VALUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_NOTYETIMPLEMENTED("unexpected reflow command type");
|
|
|
|
rv = NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
break;
|
1998-10-06 00:27:22 +00:00
|
|
|
}
|
|
|
|
|
1998-10-14 16:32:45 +00:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
NS_METHOD
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::IR_StyleChanged(nsPresContext* aPresContext,
|
2001-03-13 06:38:59 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsTableFrame& aTableFrame,
|
|
|
|
nsReflowStatus& aStatus)
|
1998-10-30 07:57:44 +00:00
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
// we presume that all the easy optimizations were done in the nsHTMLStyleSheet before we were called here
|
|
|
|
// XXX: we can optimize this when we know which style attribute changed
|
2001-03-13 06:38:59 +00:00
|
|
|
aTableFrame.SetNeedStrategyInit(PR_TRUE);
|
2001-11-14 11:40:03 +00:00
|
|
|
rv = ReflowChildren(aPresContext, aDesiredSize, aReflowState, aTableFrame, aStatus, PR_FALSE);
|
1998-10-30 07:57:44 +00:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
NS_METHOD
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::IR_TargetIsChild(nsPresContext* aPresContext,
|
2001-03-13 06:38:59 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsTableFrame& aTableFrame,
|
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
nsIFrame* aNextFrame)
|
1998-10-14 16:32:45 +00:00
|
|
|
|
|
|
|
{
|
2001-03-13 06:38:59 +00:00
|
|
|
if (!aNextFrame) return NS_ERROR_NULL_POINTER;
|
|
|
|
nsresult rv = NS_OK;
|
1998-10-14 16:32:45 +00:00
|
|
|
|
2003-03-21 19:35:36 +00:00
|
|
|
GET_PIXELS_TO_TWIPS(aPresContext, p2t);
|
2001-03-13 06:38:59 +00:00
|
|
|
PRBool isAutoLayout = aTableFrame.IsAutoLayout();
|
2003-05-15 03:42:21 +00:00
|
|
|
const nsStyleDisplay* childDisplay = aNextFrame->GetStyleDisplay();
|
2001-03-13 06:38:59 +00:00
|
|
|
if (NS_STYLE_DISPLAY_TABLE_CELL == childDisplay->mDisplay) {
|
|
|
|
nsTableCellFrame* cellFrame = (nsTableCellFrame*)aNextFrame;
|
|
|
|
// Get the x coord of the cell
|
2003-07-07 02:01:29 +00:00
|
|
|
nsPoint cellOrigin = cellFrame->GetPosition();
|
1998-10-14 16:32:45 +00:00
|
|
|
|
1999-08-21 21:24:42 +00:00
|
|
|
// At this point, we know the column widths. Compute the cell available width
|
1999-02-11 01:16:28 +00:00
|
|
|
PRInt32 cellColIndex;
|
2001-03-13 06:38:59 +00:00
|
|
|
cellFrame->GetColIndex(cellColIndex);
|
|
|
|
nscoord cellSpacingX = aTableFrame.GetCellSpacingX();
|
1999-08-21 20:16:32 +00:00
|
|
|
|
2001-10-26 02:30:38 +00:00
|
|
|
nscoord colAvailWidth, cellAvailWidth;
|
2003-03-21 19:35:36 +00:00
|
|
|
CalcAvailWidth(aTableFrame, GetComputedWidth(aReflowState, aTableFrame), p2t,
|
2001-10-26 02:30:38 +00:00
|
|
|
*cellFrame, cellSpacingX, colAvailWidth, cellAvailWidth);
|
1998-10-14 16:32:45 +00:00
|
|
|
|
|
|
|
// Always let the cell be as high as it wants. We ignore the height that's
|
|
|
|
// passed in and always place the entire row. Let the row group decide
|
|
|
|
// whether we fit or wehther the entire row is pushed
|
2001-03-13 06:38:59 +00:00
|
|
|
nsSize cellAvailSize(cellAvailWidth, NS_UNCONSTRAINEDSIZE);
|
1998-10-14 16:32:45 +00:00
|
|
|
|
|
|
|
// Pass along the reflow command
|
2000-01-11 15:55:31 +00:00
|
|
|
// Unless this is a fixed-layout table, then have the cell incrementally
|
2001-03-13 06:38:59 +00:00
|
|
|
// update its maximum width.
|
2003-01-09 14:26:32 +00:00
|
|
|
nsHTMLReflowMetrics cellMet(PR_TRUE,
|
|
|
|
isAutoLayout ? NS_REFLOW_CALC_MAX_WIDTH : 0);
|
2002-02-19 15:48:28 +00:00
|
|
|
GET_PIXELS_TO_TWIPS(aPresContext, p2t);
|
|
|
|
nsTableCellReflowState kidRS(aPresContext, aReflowState, aNextFrame, cellAvailSize,
|
|
|
|
aReflowState.reason);
|
2002-09-09 18:46:06 +00:00
|
|
|
// If the table will intialize the strategy (and balance) or balance, make the computed
|
|
|
|
// width unconstrained. This avoids having the cell block compute a bogus max width
|
|
|
|
// which will bias the balancing. Leave the avail width alone, since it is a best guess.
|
|
|
|
// After the table balances, the cell will get reflowed with the correct computed width.
|
|
|
|
PRBool resetComputedWidth = aTableFrame.NeedStrategyInit() || aTableFrame.NeedStrategyBalance();
|
2004-06-05 16:59:46 +00:00
|
|
|
if (resetComputedWidth)
|
|
|
|
cellFrame->SetNeedPass2Reflow(PR_TRUE);
|
2002-09-09 18:46:06 +00:00
|
|
|
InitChildReflowState(*aPresContext, cellAvailSize, aTableFrame.IsBorderCollapse(),
|
|
|
|
p2t, kidRS, resetComputedWidth);
|
1998-10-14 16:32:45 +00:00
|
|
|
|
1999-08-29 04:18:00 +00:00
|
|
|
// Remember the current desired size, we'll need it later
|
2001-11-30 15:05:51 +00:00
|
|
|
nscoord oldCellMinWidth = cellFrame->GetPass1MaxElementWidth();
|
2001-03-13 06:38:59 +00:00
|
|
|
nscoord oldCellMaximumWidth = cellFrame->GetMaximumWidth();
|
|
|
|
nsSize oldCellDesSize = cellFrame->GetDesiredSize();
|
|
|
|
nscoord oldCellDesAscent = cellFrame->GetDesiredAscent();
|
2000-06-05 08:25:11 +00:00
|
|
|
nscoord oldCellDesDescent = oldCellDesSize.height - oldCellDesAscent;
|
1999-08-29 04:18:00 +00:00
|
|
|
|
|
|
|
// Reflow the cell passing it the incremental reflow command. We can't pass
|
|
|
|
// in a max width of NS_UNCONSTRAINEDSIZE, because the max width must match
|
1998-10-14 16:32:45 +00:00
|
|
|
// the width of the previous reflow...
|
2000-05-25 22:40:21 +00:00
|
|
|
rv = ReflowChild(aNextFrame, aPresContext, cellMet, kidRS,
|
2001-03-13 06:38:59 +00:00
|
|
|
cellOrigin.x, 0, 0, aStatus);
|
2000-05-25 22:40:21 +00:00
|
|
|
nsSize initCellDesSize(cellMet.width, cellMet.height);
|
2000-06-05 08:25:11 +00:00
|
|
|
nscoord initCellDesAscent = cellMet.ascent;
|
|
|
|
nscoord initCellDesDescent = cellMet.descent;
|
1999-08-29 04:18:00 +00:00
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
// cache the max-elem and maximum widths
|
2003-01-09 14:26:32 +00:00
|
|
|
cellFrame->SetPass1MaxElementWidth(cellMet.width, cellMet.mMaxElementWidth);
|
2001-03-13 06:38:59 +00:00
|
|
|
cellFrame->SetMaximumWidth(cellMet.mMaximumWidth);
|
2000-01-11 15:55:31 +00:00
|
|
|
|
1999-08-21 20:16:32 +00:00
|
|
|
// Calculate the cell's actual size given its pass2 size. This function
|
|
|
|
// takes into account the specified height (in the style), and any special
|
|
|
|
// logic needed for backwards compatibility
|
2000-05-25 22:40:21 +00:00
|
|
|
CalculateCellActualSize(aNextFrame, cellMet.width, cellMet.height, cellAvailWidth);
|
2000-07-28 09:19:26 +00:00
|
|
|
|
2000-06-05 08:25:11 +00:00
|
|
|
// height may have changed, adjust descent to absorb any excess difference
|
|
|
|
cellMet.descent = cellMet.height - cellMet.ascent;
|
2000-05-25 22:40:21 +00:00
|
|
|
|
|
|
|
// if the cell got shorter and it may have been the tallest, recalc the tallest cell
|
|
|
|
PRBool tallestCellGotShorter = PR_FALSE;
|
2001-03-13 06:38:59 +00:00
|
|
|
PRBool hasVerticalAlignBaseline = cellFrame->HasVerticalAlignBaseline();
|
2000-06-05 08:25:11 +00:00
|
|
|
if (!hasVerticalAlignBaseline) {
|
|
|
|
// only the height matters
|
|
|
|
tallestCellGotShorter =
|
2001-11-05 00:15:51 +00:00
|
|
|
TallestCellGotShorter(oldCellDesSize.height, cellMet.height, GetHeight());
|
2000-06-05 08:25:11 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
// the ascent matters
|
|
|
|
tallestCellGotShorter =
|
2000-12-21 23:03:42 +00:00
|
|
|
TallestCellGotShorter(oldCellDesAscent, cellMet.ascent, mMaxCellAscent);
|
2000-06-05 08:25:11 +00:00
|
|
|
// the descent of cells without rowspan also matters
|
|
|
|
if (!tallestCellGotShorter) {
|
2001-03-13 06:38:59 +00:00
|
|
|
PRInt32 rowSpan = aTableFrame.GetEffectiveRowSpan(*cellFrame);
|
2000-06-05 08:25:11 +00:00
|
|
|
if (rowSpan == 1) {
|
|
|
|
tallestCellGotShorter =
|
2002-10-01 19:40:28 +00:00
|
|
|
TallestCellGotShorter(oldCellDesDescent, cellMet.descent, mMaxCellDescent);
|
2000-06-05 08:25:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (tallestCellGotShorter) {
|
2001-11-05 00:15:51 +00:00
|
|
|
CalcHeight(aReflowState);
|
2000-06-05 08:25:11 +00:00
|
|
|
}
|
|
|
|
else {
|
2001-11-05 00:15:51 +00:00
|
|
|
UpdateHeight(cellMet.height, cellMet.ascent, cellMet.descent, &aTableFrame, cellFrame);
|
2000-06-05 08:25:11 +00:00
|
|
|
}
|
1998-08-07 02:11:51 +00:00
|
|
|
|
2000-05-25 22:40:21 +00:00
|
|
|
// if the cell's desired size didn't changed, our height is unchanged
|
|
|
|
aDesiredSize.mNothingChanged = PR_FALSE;
|
2001-03-13 06:38:59 +00:00
|
|
|
PRInt32 rowSpan = aTableFrame.GetEffectiveRowSpan(*cellFrame);
|
2001-07-13 23:49:30 +00:00
|
|
|
if ((initCellDesSize.width == oldCellDesSize.width) &&
|
|
|
|
(initCellDesSize.height == oldCellDesSize.height) &&
|
|
|
|
(oldCellMaximumWidth == cellMet.mMaximumWidth)) {
|
2000-06-05 08:25:11 +00:00
|
|
|
if (!hasVerticalAlignBaseline) { // only the cell's height matters
|
2000-09-05 14:57:34 +00:00
|
|
|
aDesiredSize.mNothingChanged = PR_TRUE;
|
2000-06-05 08:25:11 +00:00
|
|
|
}
|
|
|
|
else { // cell's ascent and cell's descent matter
|
|
|
|
if (initCellDesAscent == oldCellDesAscent) {
|
|
|
|
if ((rowSpan == 1) && (initCellDesDescent == oldCellDesDescent)) {
|
|
|
|
aDesiredSize.mNothingChanged = PR_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-11-05 00:15:51 +00:00
|
|
|
aDesiredSize.height = (aDesiredSize.mNothingChanged) ? mRect.height : GetHeight();
|
2000-09-05 14:57:34 +00:00
|
|
|
if (1 == rowSpan) {
|
|
|
|
cellMet.height = aDesiredSize.height;
|
|
|
|
}
|
|
|
|
else {
|
2001-03-13 06:38:59 +00:00
|
|
|
nscoord heightOfRows = aDesiredSize.height + GetHeightOfRowsSpannedBelowFirst(*cellFrame, aTableFrame);
|
2000-09-05 14:57:34 +00:00
|
|
|
cellMet.height = PR_MAX(cellMet.height, heightOfRows);
|
|
|
|
// XXX need to check what happens when this height differs from height of the cell's previous mRect.height
|
|
|
|
}
|
2000-07-28 09:19:26 +00:00
|
|
|
|
1998-10-14 16:32:45 +00:00
|
|
|
// Now place the child
|
2001-10-26 02:30:38 +00:00
|
|
|
cellMet.width = colAvailWidth;
|
2001-12-07 14:51:12 +00:00
|
|
|
FinishReflowChild(aNextFrame, aPresContext, nsnull, cellMet, cellOrigin.x, 0, 0);
|
2001-03-13 06:38:59 +00:00
|
|
|
|
|
|
|
// Notify the table if the cell width changed so it can decide whether to rebalance
|
|
|
|
if (!aDesiredSize.mNothingChanged) {
|
2001-11-30 15:05:51 +00:00
|
|
|
aTableFrame.CellChangedWidth(*cellFrame, oldCellMinWidth, oldCellMaximumWidth);
|
2000-10-05 21:05:06 +00:00
|
|
|
}
|
|
|
|
|
1998-10-14 16:32:45 +00:00
|
|
|
// Return our desired size. Note that our desired width is just whatever width
|
|
|
|
// we were given by the row group frame
|
2001-03-13 06:38:59 +00:00
|
|
|
aDesiredSize.width = aReflowState.availableWidth;
|
2000-05-25 22:40:21 +00:00
|
|
|
if (!aDesiredSize.mNothingChanged) {
|
|
|
|
if (aDesiredSize.height == mRect.height) { // our height didn't change
|
2001-03-13 06:38:59 +00:00
|
|
|
cellFrame->VerticallyAlignChild(aPresContext, aReflowState, mMaxCellAscent);
|
2003-07-07 02:01:29 +00:00
|
|
|
nsRect dirtyRect = cellFrame->GetRect();
|
2000-05-25 22:40:21 +00:00
|
|
|
dirtyRect.height = mRect.height;
|
2003-09-13 16:26:30 +00:00
|
|
|
ConsiderChildOverflow(aPresContext, aDesiredSize.mOverflowArea, cellFrame);
|
|
|
|
dirtyRect.UnionRect(dirtyRect, aDesiredSize.mOverflowArea);
|
2004-03-10 03:09:05 +00:00
|
|
|
Invalidate(dirtyRect);
|
2000-05-25 22:40:21 +00:00
|
|
|
}
|
|
|
|
}
|
2004-01-28 18:44:41 +00:00
|
|
|
else { // we dont realign vertical but we need to update the overflow area
|
|
|
|
nsIFrame* cellKidFrame = cellFrame->GetFirstChild(nsnull);
|
|
|
|
if (cellKidFrame) {
|
2004-09-01 13:33:17 +00:00
|
|
|
// XXX This is bogus. The code above changes the cell width
|
|
|
|
// and height but leaves the overflow area alone. How can that
|
|
|
|
// be right?
|
|
|
|
|
|
|
|
// Make sure the overflow area includes the width and height, in any case.
|
|
|
|
cellMet.mOverflowArea.UnionRect(cellMet.mOverflowArea,
|
|
|
|
nsRect(0, 0, cellMet.width, cellMet.height));
|
2004-01-28 18:44:41 +00:00
|
|
|
cellFrame->ConsiderChildOverflow(aPresContext, cellMet.mOverflowArea, cellKidFrame);
|
2004-07-16 16:56:21 +00:00
|
|
|
cellFrame->FinishAndStoreOverflow(&cellMet);
|
2004-03-28 15:13:31 +00:00
|
|
|
if (cellFrame->HasView()) {
|
|
|
|
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, cellFrame, cellFrame->GetView(), &cellMet.mOverflowArea, 0);
|
|
|
|
}
|
|
|
|
}
|
2004-01-28 18:44:41 +00:00
|
|
|
}
|
1998-10-14 16:32:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // pass reflow to unknown frame child
|
|
|
|
// aDesiredSize does not change
|
|
|
|
}
|
2004-01-28 18:44:41 +00:00
|
|
|
|
|
|
|
// recover the overflow area
|
2004-04-15 04:28:28 +00:00
|
|
|
aDesiredSize.mOverflowArea = nsRect(0, 0, aDesiredSize.width, aDesiredSize.height);
|
2004-01-28 18:44:41 +00:00
|
|
|
for (nsIFrame* cell = mFrames.FirstChild(); cell; cell = cell->GetNextSibling()) {
|
|
|
|
ConsiderChildOverflow(aPresContext, aDesiredSize.mOverflowArea, cell);
|
|
|
|
}
|
2004-07-16 16:56:21 +00:00
|
|
|
FinishAndStoreOverflow(&aDesiredSize);
|
2000-01-17 17:45:17 +00:00
|
|
|
// When returning whether we're complete we need to look at each of our cell
|
|
|
|
// frames. If any of them has a continuing frame, then we're not complete. We
|
|
|
|
// can't just return the status of the cell frame we just reflowed...
|
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
|
|
if (mNextInFlow) {
|
2003-07-07 02:01:29 +00:00
|
|
|
for (nsIFrame* cell = mFrames.FirstChild(); cell;
|
|
|
|
cell = cell->GetNextSibling()) {
|
2004-09-14 02:28:03 +00:00
|
|
|
nsIFrame* contFrame = cell->GetNextInFlow();
|
2000-01-17 17:45:17 +00:00
|
|
|
if (contFrame) {
|
|
|
|
aStatus = NS_FRAME_NOT_COMPLETE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1998-10-14 16:32:45 +00:00
|
|
|
return rv;
|
1998-07-01 03:03:32 +00:00
|
|
|
}
|
1998-05-21 23:43:18 +00:00
|
|
|
|
1998-10-14 16:32:45 +00:00
|
|
|
|
1998-04-23 17:29:07 +00:00
|
|
|
/** Layout the entire row.
|
1998-07-02 05:39:10 +00:00
|
|
|
* This method stacks cells horizontally according to HTML 4.0 rules.
|
1998-04-23 17:29:07 +00:00
|
|
|
*/
|
|
|
|
NS_METHOD
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::Reflow(nsPresContext* aPresContext,
|
1998-10-02 04:10:00 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
1998-04-23 17:29:07 +00:00
|
|
|
{
|
2000-04-21 21:36:33 +00:00
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsTableRowFrame", aReflowState.reason);
|
2001-11-14 13:40:03 +00:00
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
2001-10-29 01:43:59 +00:00
|
|
|
#if defined DEBUG_TABLE_REFLOW_TIMING
|
2001-01-25 15:55:51 +00:00
|
|
|
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState);
|
|
|
|
#endif
|
1999-08-19 19:52:37 +00:00
|
|
|
nsresult rv = NS_OK;
|
1998-04-13 20:24:54 +00:00
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
nsTableFrame* tableFrame = nsnull;
|
1998-10-14 16:32:45 +00:00
|
|
|
rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
2001-03-13 06:38:59 +00:00
|
|
|
if (!tableFrame) return NS_ERROR_NULL_POINTER;
|
1999-08-01 22:01:37 +00:00
|
|
|
|
2004-04-28 16:42:59 +00:00
|
|
|
const nsStyleVisibility* rowVis = GetStyleVisibility();
|
|
|
|
PRBool collapseRow = (NS_STYLE_VISIBILITY_COLLAPSE == rowVis->mVisible);
|
|
|
|
if (collapseRow) {
|
|
|
|
tableFrame->SetNeedToCollapseRows(PR_TRUE);
|
|
|
|
}
|
|
|
|
|
2002-04-01 06:46:17 +00:00
|
|
|
// see if a special height reflow needs to occur due to having a pct height
|
2002-04-10 21:32:41 +00:00
|
|
|
if (!NeedSpecialReflow())
|
|
|
|
nsTableFrame::CheckRequestSpecialHeightReflow(aReflowState);
|
2001-11-05 00:15:51 +00:00
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
switch (aReflowState.reason) {
|
1998-07-10 22:56:13 +00:00
|
|
|
case eReflowReason_Initial:
|
2001-04-02 03:21:58 +00:00
|
|
|
rv = ReflowChildren(aPresContext, aDesiredSize, aReflowState, *tableFrame, aStatus, PR_FALSE);
|
1998-07-10 22:56:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case eReflowReason_Resize:
|
2002-11-08 05:29:34 +00:00
|
|
|
case eReflowReason_StyleChange:
|
|
|
|
case eReflowReason_Dirty:
|
2001-03-13 06:38:59 +00:00
|
|
|
rv = ReflowChildren(aPresContext, aDesiredSize, aReflowState, *tableFrame, aStatus, PR_FALSE);
|
1998-07-10 22:56:13 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case eReflowReason_Incremental:
|
2001-03-13 06:38:59 +00:00
|
|
|
rv = IncrementalReflow(aPresContext, aDesiredSize, aReflowState, *tableFrame, aStatus);
|
1998-07-10 22:56:13 +00:00
|
|
|
break;
|
2001-11-25 20:38:30 +00:00
|
|
|
default:
|
|
|
|
NS_ASSERTION(PR_FALSE , "we should handle this reflow reason");
|
|
|
|
rv = NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
break;
|
1998-07-10 22:56:13 +00:00
|
|
|
}
|
1998-07-02 05:39:10 +00:00
|
|
|
|
2001-03-13 06:38:59 +00:00
|
|
|
// just set our width to what was available. The table will calculate the width and not use our value.
|
|
|
|
aDesiredSize.width = aReflowState.availableWidth;
|
1999-08-30 22:30:32 +00:00
|
|
|
|
2001-12-07 14:51:12 +00:00
|
|
|
if (aReflowState.mFlags.mSpecialHeightReflow) {
|
2001-11-05 00:15:51 +00:00
|
|
|
SetNeedSpecialReflow(PR_FALSE);
|
|
|
|
}
|
|
|
|
|
2001-10-29 01:43:59 +00:00
|
|
|
#if defined DEBUG_TABLE_REFLOW_TIMING
|
2001-01-25 15:55:51 +00:00
|
|
|
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState, &aDesiredSize, aStatus);
|
|
|
|
#endif
|
2002-05-28 22:50:43 +00:00
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
1998-10-14 16:32:45 +00:00
|
|
|
return rv;
|
1998-04-13 20:24:54 +00:00
|
|
|
}
|
|
|
|
|
1999-02-22 03:28:00 +00:00
|
|
|
/**
|
|
|
|
* This function is called by the row group frame's SplitRowGroup() code when
|
|
|
|
* pushing a row frame that has cell frames that span into it. The cell frame
|
|
|
|
* should be reflowed with the specified height
|
|
|
|
*/
|
2001-04-16 14:51:52 +00:00
|
|
|
nscoord
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
|
2001-04-16 14:51:52 +00:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsTableCellFrame* aCellFrame,
|
|
|
|
nscoord aAvailableHeight,
|
|
|
|
nsReflowStatus& aStatus)
|
1999-02-22 03:28:00 +00:00
|
|
|
{
|
2002-02-19 15:48:28 +00:00
|
|
|
nsTableFrame* tableFrame = nsnull;
|
|
|
|
nsTableFrame::GetTableFrame(this, tableFrame); if (!tableFrame) ABORT1(0);
|
|
|
|
|
1999-02-22 03:28:00 +00:00
|
|
|
// Reflow the cell frame with the specified height. Use the existing width
|
2003-07-07 02:01:29 +00:00
|
|
|
nsSize cellSize = aCellFrame->GetSize();
|
1999-02-22 03:28:00 +00:00
|
|
|
|
|
|
|
nsSize availSize(cellSize.width, aAvailableHeight);
|
2002-02-19 15:48:28 +00:00
|
|
|
PRBool borderCollapse = ((nsTableFrame*)tableFrame->GetFirstInFlow())->IsBorderCollapse();
|
|
|
|
GET_PIXELS_TO_TWIPS(aPresContext, p2t);
|
2000-05-04 23:16:42 +00:00
|
|
|
nsTableCellReflowState cellReflowState(aPresContext, aReflowState, aCellFrame, availSize,
|
|
|
|
eReflowReason_Resize);
|
2002-02-19 15:48:28 +00:00
|
|
|
InitChildReflowState(*aPresContext, availSize, borderCollapse, p2t, cellReflowState);
|
|
|
|
|
2003-09-13 16:26:30 +00:00
|
|
|
nsHTMLReflowMetrics desiredSize(PR_FALSE);
|
1999-02-22 03:28:00 +00:00
|
|
|
|
1999-11-19 15:33:29 +00:00
|
|
|
ReflowChild(aCellFrame, aPresContext, desiredSize, cellReflowState,
|
|
|
|
0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
|
2002-10-03 14:33:23 +00:00
|
|
|
PRBool fullyComplete = NS_FRAME_IS_COMPLETE(aStatus) && !NS_FRAME_IS_TRUNCATED(aStatus);
|
|
|
|
|
2003-07-07 02:01:29 +00:00
|
|
|
aCellFrame->SetSize(
|
|
|
|
nsSize(cellSize.width, fullyComplete ? aAvailableHeight : desiredSize.height));
|
2001-04-16 14:51:52 +00:00
|
|
|
|
2000-06-05 08:25:11 +00:00
|
|
|
// XXX What happens if this cell has 'vertical-align: baseline' ?
|
|
|
|
// XXX Why is it assumed that the cell's ascent hasn't changed ?
|
2002-10-03 14:33:23 +00:00
|
|
|
if (fullyComplete) {
|
|
|
|
aCellFrame->VerticallyAlignChild(aPresContext, aReflowState, mMaxCellAscent);
|
|
|
|
}
|
2001-12-07 14:51:12 +00:00
|
|
|
aCellFrame->DidReflow(aPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
|
2001-04-16 14:51:52 +00:00
|
|
|
|
|
|
|
return desiredSize.height;
|
1999-02-22 03:28:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-04-16 14:51:52 +00:00
|
|
|
* These 3 functions are called by the row group frame's SplitRowGroup() code when
|
|
|
|
* it creates a continuing cell frame and wants to insert it into the row's child list
|
1999-02-22 03:28:00 +00:00
|
|
|
*/
|
2001-04-16 14:51:52 +00:00
|
|
|
void
|
|
|
|
nsTableRowFrame::InsertCellFrame(nsTableCellFrame* aFrame,
|
|
|
|
nsTableCellFrame* aPrevSibling)
|
1999-02-22 03:28:00 +00:00
|
|
|
{
|
|
|
|
mFrames.InsertFrame(nsnull, aPrevSibling, aFrame);
|
2001-04-16 14:51:52 +00:00
|
|
|
aFrame->SetParent(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsTableRowFrame::InsertCellFrame(nsTableCellFrame* aFrame,
|
|
|
|
PRInt32 aColIndex)
|
|
|
|
{
|
|
|
|
// Find the cell frame where col index < aColIndex
|
|
|
|
nsTableCellFrame* priorCell = nsnull;
|
2003-07-07 02:01:29 +00:00
|
|
|
for (nsIFrame* child = mFrames.FirstChild(); child;
|
|
|
|
child = child->GetNextSibling()) {
|
2003-10-31 20:19:18 +00:00
|
|
|
if (!IS_TABLE_CELL(child->GetType())) {
|
2001-04-16 14:51:52 +00:00
|
|
|
nsTableCellFrame* cellFrame = (nsTableCellFrame*)child;
|
|
|
|
PRInt32 colIndex;
|
|
|
|
cellFrame->GetColIndex(colIndex);
|
|
|
|
if (colIndex < aColIndex) {
|
|
|
|
priorCell = cellFrame;
|
|
|
|
}
|
|
|
|
else break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
InsertCellFrame(aFrame, priorCell);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsTableRowFrame::RemoveCellFrame(nsTableCellFrame* aFrame)
|
|
|
|
{
|
2002-03-04 15:48:56 +00:00
|
|
|
if (!mFrames.RemoveFrame(aFrame))
|
|
|
|
NS_ASSERTION(PR_FALSE, "frame not in list");
|
1999-02-22 03:28:00 +00:00
|
|
|
}
|
|
|
|
|
2003-10-31 20:19:18 +00:00
|
|
|
nsIAtom*
|
|
|
|
nsTableRowFrame::GetType() const
|
1999-02-24 05:54:31 +00:00
|
|
|
{
|
2003-10-31 20:19:18 +00:00
|
|
|
return nsLayoutAtoms::tableRowFrame;
|
1999-02-24 05:54:31 +00:00
|
|
|
}
|
|
|
|
|
2001-11-05 00:15:51 +00:00
|
|
|
nsTableRowFrame*
|
|
|
|
nsTableRowFrame::GetNextRow() const
|
|
|
|
{
|
2003-07-07 02:01:29 +00:00
|
|
|
nsIFrame* childFrame = GetNextSibling();
|
2001-11-05 00:15:51 +00:00
|
|
|
while (childFrame) {
|
2003-10-31 20:19:18 +00:00
|
|
|
if (nsLayoutAtoms::tableRowFrame == childFrame->GetType()) {
|
2001-11-05 00:15:51 +00:00
|
|
|
return (nsTableRowFrame*)childFrame;
|
|
|
|
}
|
2003-07-07 02:01:29 +00:00
|
|
|
childFrame = childFrame->GetNextSibling();
|
2001-11-05 00:15:51 +00:00
|
|
|
}
|
|
|
|
return nsnull;
|
|
|
|
}
|
1999-02-24 05:54:31 +00:00
|
|
|
|
2001-11-29 15:41:07 +00:00
|
|
|
void
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::SetUnpaginatedHeight(nsPresContext* aPresContext,
|
2001-11-29 15:41:07 +00:00
|
|
|
nscoord aValue)
|
|
|
|
{
|
2002-03-27 05:50:24 +00:00
|
|
|
NS_ASSERTION(!mPrevInFlow, "program error");
|
2001-11-29 15:41:07 +00:00
|
|
|
// Get the property
|
|
|
|
nscoord* value = (nscoord*)nsTableFrame::GetProperty(aPresContext, this, nsLayoutAtoms::rowUnpaginatedHeightProperty, PR_TRUE);
|
|
|
|
if (value) {
|
|
|
|
*value = aValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nscoord
|
2004-07-31 23:15:21 +00:00
|
|
|
nsTableRowFrame::GetUnpaginatedHeight(nsPresContext* aPresContext)
|
2001-11-29 15:41:07 +00:00
|
|
|
{
|
|
|
|
// See if the property is set
|
2002-03-27 05:50:24 +00:00
|
|
|
nscoord* value = (nscoord*)nsTableFrame::GetProperty(aPresContext, GetFirstInFlow(), nsLayoutAtoms::rowUnpaginatedHeightProperty);
|
2001-11-29 15:41:07 +00:00
|
|
|
if (value)
|
|
|
|
return *value;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-03-09 06:48:35 +00:00
|
|
|
void nsTableRowFrame::SetContinuousBCBorderWidth(PRUint8 aForSide,
|
|
|
|
BCPixelSize aPixelValue)
|
|
|
|
{
|
|
|
|
switch (aForSide) {
|
|
|
|
case NS_SIDE_RIGHT:
|
|
|
|
mRightContBorderWidth = aPixelValue;
|
|
|
|
return;
|
|
|
|
case NS_SIDE_TOP:
|
|
|
|
mTopContBorderWidth = aPixelValue;
|
|
|
|
return;
|
|
|
|
case NS_SIDE_LEFT:
|
|
|
|
mLeftContBorderWidth = aPixelValue;
|
|
|
|
return;
|
|
|
|
default:
|
|
|
|
NS_ERROR("invalid NS_SIDE arg");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-09-15 17:58:24 +00:00
|
|
|
/* ----- global methods ----- */
|
|
|
|
|
|
|
|
nsresult
|
1999-12-04 23:49:50 +00:00
|
|
|
NS_NewTableRowFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
1998-04-13 20:24:54 +00:00
|
|
|
{
|
1999-05-11 22:03:29 +00:00
|
|
|
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
|
|
|
if (nsnull == aNewFrame) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
1999-12-04 23:49:50 +00:00
|
|
|
nsTableRowFrame* it = new (aPresShell) nsTableRowFrame;
|
1998-04-13 20:24:54 +00:00
|
|
|
if (nsnull == it) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
1999-05-11 22:03:29 +00:00
|
|
|
*aNewFrame = it;
|
1998-04-13 20:24:54 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
#ifdef DEBUG
|
1998-11-19 17:22:29 +00:00
|
|
|
NS_IMETHODIMP
|
2001-11-14 01:33:42 +00:00
|
|
|
nsTableRowFrame::GetFrameName(nsAString& aResult) const
|
1998-11-19 17:22:29 +00:00
|
|
|
{
|
2001-11-14 01:33:42 +00:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("TableRow"), aResult);
|
1998-11-19 17:22:29 +00:00
|
|
|
}
|
1999-09-01 01:02:16 +00:00
|
|
|
#endif
|