2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 18:30:37 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-09-23 06:32:15 +04:00
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1998-09-23 06:32:15 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1998-09-23 06:32:15 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 18:30:37 +04:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 18:30:37 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 18:30:37 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-09-23 06:32:15 +04:00
|
|
|
|
|
|
|
#include "FixedTableLayoutStrategy.h"
|
|
|
|
#include "nsTableFrame.h"
|
|
|
|
#include "nsTableCellFrame.h"
|
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
|
1998-10-20 03:43:06 +04:00
|
|
|
FixedTableLayoutStrategy::FixedTableLayoutStrategy(nsTableFrame *aFrame)
|
|
|
|
: BasicTableLayoutStrategy(aFrame)
|
1998-09-23 06:32:15 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
FixedTableLayoutStrategy::~FixedTableLayoutStrategy()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-12-28 20:02:40 +03:00
|
|
|
PRBool FixedTableLayoutStrategy::BalanceColumnWidths(const nsHTMLReflowState& aReflowState)
|
1998-09-23 06:32:15 +04:00
|
|
|
{
|
1999-07-28 12:09:02 +04:00
|
|
|
return PR_TRUE;
|
1998-09-23 06:32:15 +04:00
|
|
|
}
|
|
|
|
|
1999-06-03 06:42:33 +04:00
|
|
|
/*
|
|
|
|
* assign the width of all columns
|
1998-09-23 06:32:15 +04:00
|
|
|
* if there is a colframe with a width attribute, use it as the column width
|
|
|
|
* otherwise if there is a cell in the first row and it has a width attribute, use it
|
|
|
|
* if this cell includes a colspan, width is divided equally among spanned columns
|
|
|
|
* otherwise the cell get a proportion of the remaining space
|
|
|
|
* as determined by the table width attribute. If no table width attribute, it gets 0 width
|
|
|
|
*/
|
2000-02-12 04:55:40 +03:00
|
|
|
PRBool
|
2003-12-29 19:58:20 +03:00
|
|
|
FixedTableLayoutStrategy::AssignNonPctColumnWidths(nscoord aComputedWidth,
|
|
|
|
const nsHTMLReflowState& aReflowState)
|
1998-09-23 06:32:15 +04:00
|
|
|
{
|
1999-07-24 00:32:18 +04:00
|
|
|
// NS_ASSERTION(aComputedWidth != NS_UNCONSTRAINEDSIZE, "bad computed width");
|
2003-05-15 07:42:21 +04:00
|
|
|
const nsStylePosition* tablePosition = mTableFrame->GetStylePosition();
|
1999-06-03 06:42:33 +04:00
|
|
|
PRBool tableIsFixedWidth = eStyleUnit_Coord == tablePosition->mWidth.GetUnit() ||
|
|
|
|
eStyleUnit_Percent == tablePosition->mWidth.GetUnit();
|
|
|
|
|
1999-12-14 01:56:31 +03:00
|
|
|
PRInt32 numCols = mTableFrame->GetColCount();
|
1999-06-03 06:42:33 +04:00
|
|
|
PRInt32 colX;
|
2004-07-29 23:41:39 +04:00
|
|
|
float pixelToTwips = mTableFrame->GetPresContext()->ScaledPixelsToTwips();
|
1999-06-03 06:42:33 +04:00
|
|
|
// availWidth is used as the basis for percentage width columns. It is aComputedWidth
|
|
|
|
// minus table border, padding, & cellspacing
|
2003-10-21 23:29:14 +04:00
|
|
|
nscoord spacingX = mTableFrame->GetCellSpacingX();
|
|
|
|
mCellSpacingTotal = spacingX;
|
|
|
|
for (colX = 0; colX < numCols; colX++){
|
|
|
|
if (mTableFrame->GetNumCellsOriginatingInCol(colX) > 0) {
|
|
|
|
mCellSpacingTotal += spacingX;
|
|
|
|
}
|
|
|
|
}
|
2000-02-12 04:55:40 +03:00
|
|
|
nscoord availWidth = (NS_UNCONSTRAINEDSIZE == aComputedWidth)
|
|
|
|
? NS_UNCONSTRAINEDSIZE
|
|
|
|
: aComputedWidth - aReflowState.mComputedBorderPadding.left -
|
|
|
|
aReflowState.mComputedBorderPadding.right -
|
2003-10-21 23:29:14 +04:00
|
|
|
mCellSpacingTotal;
|
1998-09-23 06:32:15 +04:00
|
|
|
|
1999-06-03 06:42:33 +04:00
|
|
|
PRInt32 specifiedCols = 0; // the number of columns whose width is given
|
|
|
|
nscoord totalColWidth = 0; // the sum of the widths of the columns
|
1998-09-23 06:32:15 +04:00
|
|
|
|
2006-05-25 18:56:44 +04:00
|
|
|
nsAutoArrayPtr<nscoord> colWidths(new nscoord[numCols]);
|
|
|
|
if (!colWidths) {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
2002-02-05 04:41:13 +03:00
|
|
|
memset(colWidths, WIDTH_NOT_SET, numCols*sizeof(nscoord));
|
1999-08-29 10:00:32 +04:00
|
|
|
|
2006-05-25 18:56:44 +04:00
|
|
|
nsAutoArrayPtr<nscoord> propInfo(new nscoord[numCols]);
|
2000-11-30 18:53:55 +03:00
|
|
|
if (!propInfo) {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
2001-11-19 18:51:28 +03:00
|
|
|
|
2002-02-05 04:41:13 +03:00
|
|
|
memset(propInfo, 0, numCols*sizeof(nscoord));
|
1999-08-29 10:00:32 +04:00
|
|
|
nscoord propTotal = 0;
|
2001-01-27 02:44:59 +03:00
|
|
|
nscoord percTotal = 0;
|
1999-07-24 03:41:05 +04:00
|
|
|
// for every column, determine its specified width
|
1999-12-14 01:56:31 +03:00
|
|
|
for (colX = 0; colX < numCols; colX++) {
|
1998-09-23 06:32:15 +04:00
|
|
|
// Get column information
|
1999-06-03 06:42:33 +04:00
|
|
|
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX);
|
1999-07-28 12:09:02 +04:00
|
|
|
if (!colFrame) {
|
|
|
|
NS_ASSERTION(PR_FALSE, "bad col frame");
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
1998-09-23 06:32:15 +04:00
|
|
|
|
|
|
|
// Get the columns's style
|
2003-05-15 07:42:21 +04:00
|
|
|
const nsStylePosition* colPosition = colFrame->GetStylePosition();
|
1998-09-23 06:32:15 +04:00
|
|
|
|
1999-06-03 06:42:33 +04:00
|
|
|
// get the fixed width if available
|
|
|
|
if (eStyleUnit_Coord == colPosition->mWidth.GetUnit()) {
|
|
|
|
colWidths[colX] = colPosition->mWidth.GetCoordValue();
|
2001-01-27 02:44:59 +03:00
|
|
|
colFrame->SetWidth(MIN_CON, colWidths[colX]);
|
1999-06-03 06:42:33 +04:00
|
|
|
} // get the percentage width
|
1999-07-24 00:32:18 +04:00
|
|
|
else if ((eStyleUnit_Percent == colPosition->mWidth.GetUnit()) &&
|
|
|
|
(aComputedWidth != NS_UNCONSTRAINEDSIZE)) {
|
2000-02-12 04:55:40 +03:00
|
|
|
// Only apply percentages if we're constrained.
|
1999-06-03 06:42:33 +04:00
|
|
|
float percent = colPosition->mWidth.GetPercentValue();
|
2003-12-29 19:58:20 +03:00
|
|
|
colWidths[colX] = nsTableFrame::RoundToPixel(NSToCoordRound(percent * (float)availWidth), pixelToTwips);
|
2001-01-27 02:44:59 +03:00
|
|
|
colFrame->SetWidth(PCT, colWidths[colX]);
|
|
|
|
percTotal+=colWidths[colX];
|
1998-09-23 06:32:15 +04:00
|
|
|
}
|
1999-08-29 10:00:32 +04:00
|
|
|
else if (eStyleUnit_Proportional == colPosition->mWidth.GetUnit() &&
|
|
|
|
colPosition->mWidth.GetIntValue() > 0) {
|
|
|
|
propInfo[colX] = colPosition->mWidth.GetIntValue();
|
|
|
|
propTotal += propInfo[colX];
|
|
|
|
}
|
1999-06-03 06:42:33 +04:00
|
|
|
else { // get width from the cell
|
1999-12-14 01:56:31 +03:00
|
|
|
|
1999-06-03 06:42:33 +04:00
|
|
|
nsTableCellFrame* cellFrame = mTableFrame->GetCellFrameAt(0, colX);
|
|
|
|
if (nsnull != cellFrame) {
|
1998-09-23 06:32:15 +04:00
|
|
|
// Get the cell's style
|
2003-05-15 07:42:21 +04:00
|
|
|
const nsStylePosition* cellPosition = cellFrame->GetStylePosition();
|
1998-09-23 06:32:15 +04:00
|
|
|
|
2003-03-21 22:35:36 +03:00
|
|
|
nscoord cellWidth = 0;
|
2000-01-15 23:10:00 +03:00
|
|
|
PRInt32 colSpan = mTableFrame->GetEffectiveColSpan(*cellFrame);
|
1999-06-03 06:42:33 +04:00
|
|
|
// Get fixed cell width if available
|
|
|
|
if (eStyleUnit_Coord == cellPosition->mWidth.GetUnit()) {
|
2003-03-21 22:35:36 +03:00
|
|
|
// need to add border and padding into fixed width
|
|
|
|
nsMargin borderPadding = nsTableFrame::GetBorderPadding(nsSize(aReflowState.mComputedWidth, 0),
|
2003-12-29 19:58:20 +03:00
|
|
|
pixelToTwips, cellFrame);
|
2003-03-21 22:35:36 +03:00
|
|
|
cellWidth = cellPosition->mWidth.GetCoordValue() + borderPadding.left + borderPadding.right;
|
2003-03-22 15:21:22 +03:00
|
|
|
colWidths[colX] = nsTableFrame::RoundToPixel(NSToCoordRound(((float) cellWidth) / ((float) colSpan)),
|
2003-12-29 19:58:20 +03:00
|
|
|
pixelToTwips);
|
2001-11-19 18:51:28 +03:00
|
|
|
colFrame->SetWidth(MIN_CON, colWidths[colX]);
|
1999-06-03 06:42:33 +04:00
|
|
|
}
|
1999-07-24 00:32:18 +04:00
|
|
|
else if ((eStyleUnit_Percent == cellPosition->mWidth.GetUnit()) &&
|
|
|
|
(aComputedWidth != NS_UNCONSTRAINEDSIZE)) {
|
1999-06-03 06:42:33 +04:00
|
|
|
float percent = cellPosition->mWidth.GetPercentValue();
|
2003-03-21 22:35:36 +03:00
|
|
|
// need to add border and padding into percent width
|
|
|
|
nsMargin borderPadding = nsTableFrame::GetBorderPadding(nsSize(aReflowState.mComputedWidth, 0),
|
2003-12-29 19:58:20 +03:00
|
|
|
pixelToTwips, cellFrame);
|
2003-04-05 19:36:31 +04:00
|
|
|
cellWidth = NSToCoordRound(percent * (float) availWidth) + borderPadding.left + borderPadding.right;
|
2003-03-22 15:21:22 +03:00
|
|
|
colWidths[colX] = nsTableFrame::RoundToPixel(NSToCoordRound(((float) cellWidth) / ((float) colSpan)),
|
2003-12-29 19:58:20 +03:00
|
|
|
pixelToTwips);
|
2001-01-27 02:44:59 +03:00
|
|
|
colFrame->SetWidth(PCT, colWidths[colX]);
|
|
|
|
percTotal += colWidths[colX];
|
1998-09-23 06:32:15 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-06-03 06:42:33 +04:00
|
|
|
if (colWidths[colX] >= 0) {
|
|
|
|
totalColWidth += colWidths[colX];
|
|
|
|
specifiedCols++;
|
|
|
|
}
|
1998-09-23 06:32:15 +04:00
|
|
|
}
|
1999-06-03 06:42:33 +04:00
|
|
|
|
|
|
|
nscoord lastColAllocated = -1;
|
|
|
|
nscoord remainingWidth = availWidth - totalColWidth;
|
2001-01-27 02:44:59 +03:00
|
|
|
if(availWidth == NS_UNCONSTRAINEDSIZE)
|
|
|
|
remainingWidth = 0;
|
1999-07-24 04:32:21 +04:00
|
|
|
if (remainingWidth >= 500000) {
|
1999-07-24 03:41:05 +04:00
|
|
|
// let's put a cap on the width so that it doesn't become insane.
|
|
|
|
remainingWidth = 100;
|
|
|
|
}
|
|
|
|
|
1999-08-29 10:00:32 +04:00
|
|
|
if (0 < remainingWidth) {
|
|
|
|
if (propTotal > 0) {
|
2002-07-30 06:29:03 +04:00
|
|
|
nscoord amountToAllocate = 0;
|
1999-12-14 01:56:31 +03:00
|
|
|
for (colX = 0; colX < numCols; colX++) {
|
1999-08-29 10:00:32 +04:00
|
|
|
if (propInfo[colX] > 0) {
|
|
|
|
// We're proportional
|
|
|
|
float percent = ((float)propInfo[colX])/((float)propTotal);
|
2002-07-30 06:29:03 +04:00
|
|
|
amountToAllocate += NSToCoordRound(percent * (float)remainingWidth);
|
|
|
|
colWidths[colX] = (amountToAllocate > 0) ?
|
2003-12-29 19:58:20 +03:00
|
|
|
nsTableFrame::RoundToPixel(amountToAllocate, pixelToTwips,
|
2002-07-30 06:29:03 +04:00
|
|
|
eRoundUpIfHalfOrMore) : 0;
|
1999-08-29 10:00:32 +04:00
|
|
|
totalColWidth += colWidths[colX];
|
2002-07-30 06:29:03 +04:00
|
|
|
amountToAllocate -= colWidths[colX];
|
1999-06-03 06:42:33 +04:00
|
|
|
lastColAllocated = colX;
|
1998-09-23 06:32:15 +04:00
|
|
|
}
|
1999-08-29 10:00:32 +04:00
|
|
|
}
|
1998-09-23 06:32:15 +04:00
|
|
|
}
|
1999-08-29 10:00:32 +04:00
|
|
|
else if (tableIsFixedWidth) {
|
1999-12-14 01:56:31 +03:00
|
|
|
if (numCols > specifiedCols) {
|
1999-08-29 10:00:32 +04:00
|
|
|
// allocate the extra space to the columns which have no width specified
|
2002-07-30 06:29:03 +04:00
|
|
|
nscoord colAlloc =
|
|
|
|
NSToCoordRound(((float)remainingWidth) /
|
|
|
|
(((float)numCols) - ((float)specifiedCols)));
|
|
|
|
nscoord amountToAllocate = 0;
|
1999-12-14 01:56:31 +03:00
|
|
|
for (colX = 0; colX < numCols; colX++) {
|
1999-08-29 10:00:32 +04:00
|
|
|
if (-1 == colWidths[colX]) {
|
2002-07-30 06:29:03 +04:00
|
|
|
amountToAllocate += colAlloc;
|
|
|
|
colWidths[colX] = (amountToAllocate > 0) ?
|
|
|
|
nsTableFrame::RoundToPixel(amountToAllocate,
|
2003-12-29 19:58:20 +03:00
|
|
|
pixelToTwips,
|
2002-07-30 06:29:03 +04:00
|
|
|
eRoundUpIfHalfOrMore) : 0;
|
|
|
|
totalColWidth += colWidths[colX];
|
|
|
|
amountToAllocate -= colWidths[colX];
|
1999-08-29 10:00:32 +04:00
|
|
|
lastColAllocated = colX;
|
|
|
|
}
|
1999-06-03 06:42:33 +04:00
|
|
|
}
|
|
|
|
}
|
1999-08-29 10:00:32 +04:00
|
|
|
else { // allocate the extra space to the columns which have width specified
|
|
|
|
float divisor = (float)totalColWidth;
|
2002-07-30 06:29:03 +04:00
|
|
|
nscoord amountToAllocate = 0;
|
1999-12-14 01:56:31 +03:00
|
|
|
for (colX = 0; colX < numCols; colX++) {
|
1999-08-29 10:00:32 +04:00
|
|
|
if (colWidths[colX] > 0) {
|
2002-07-30 06:29:03 +04:00
|
|
|
amountToAllocate += NSToCoordRound(remainingWidth * colWidths[colX] / divisor);
|
|
|
|
nscoord colAlloc = (amountToAllocate > 0) ?
|
2003-12-29 19:58:20 +03:00
|
|
|
nsTableFrame::RoundToPixel(amountToAllocate, pixelToTwips,
|
2002-07-30 06:29:03 +04:00
|
|
|
eRoundUpIfHalfOrMore) : 0;
|
1999-08-29 10:00:32 +04:00
|
|
|
colWidths[colX] += colAlloc;
|
2002-07-30 06:29:03 +04:00
|
|
|
totalColWidth += colAlloc;
|
|
|
|
amountToAllocate -= colAlloc;
|
1999-08-29 10:00:32 +04:00
|
|
|
lastColAllocated = colX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1998-09-23 06:32:15 +04:00
|
|
|
}
|
1999-06-03 06:42:33 +04:00
|
|
|
|
2001-01-27 02:44:59 +03:00
|
|
|
nscoord overAllocation = ((availWidth >= 0) && (availWidth != NS_UNCONSTRAINEDSIZE))
|
1999-06-03 06:42:33 +04:00
|
|
|
? totalColWidth - availWidth : 0;
|
|
|
|
// set the column widths
|
1999-12-14 01:56:31 +03:00
|
|
|
for (colX = 0; colX < numCols; colX++) {
|
2006-02-11 14:12:40 +03:00
|
|
|
if (colWidths[colX] < 0) {
|
1999-06-03 06:42:33 +04:00
|
|
|
colWidths[colX] = 0;
|
2006-02-11 14:12:40 +03:00
|
|
|
// make sure there is at least space for the border and padding of the first cell
|
|
|
|
nsTableCellFrame* cellFrame = mTableFrame->GetCellFrameAt(0, colX);
|
|
|
|
if (nsnull != cellFrame) {
|
|
|
|
PRInt32 colSpan = mTableFrame->GetEffectiveColSpan(*cellFrame);
|
|
|
|
PRInt32 colIndex;
|
|
|
|
cellFrame->GetColIndex(colIndex);
|
|
|
|
nscoord minWidth = 0;
|
|
|
|
nsMargin borderPadding = nsTableFrame::GetBorderPadding(nsSize(aReflowState.mComputedWidth, 0),
|
|
|
|
pixelToTwips, cellFrame);
|
|
|
|
if (colX == colIndex )
|
|
|
|
minWidth += borderPadding.left;
|
|
|
|
if (colX == colIndex + (colSpan - 1))
|
|
|
|
minWidth += borderPadding.right;
|
|
|
|
colWidths[colX] = minWidth;
|
|
|
|
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX);
|
|
|
|
colFrame->SetWidth(MIN_CON, minWidth);
|
|
|
|
totalColWidth += minWidth;
|
|
|
|
if (overAllocation > 0) {
|
|
|
|
overAllocation = PR_MAX(0, overAllocation - minWidth);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-06-03 06:42:33 +04:00
|
|
|
// if there was too much allocated due to rounding, remove it from the last col
|
|
|
|
if ((colX == lastColAllocated) && (overAllocation != 0)) {
|
2003-12-29 19:58:20 +03:00
|
|
|
nscoord thisRemoval = nsTableFrame::RoundToPixel(overAllocation, pixelToTwips);
|
2002-07-30 06:29:03 +04:00
|
|
|
colWidths[colX] -= thisRemoval;
|
|
|
|
totalColWidth -= thisRemoval;
|
|
|
|
|
2001-01-27 02:44:59 +03:00
|
|
|
totalColWidth -= colWidths[colX] - PR_MAX(0, colWidths[colX]);
|
1999-06-03 06:42:33 +04:00
|
|
|
colWidths[colX] = PR_MAX(0, colWidths[colX]);
|
|
|
|
}
|
2001-01-27 02:44:59 +03:00
|
|
|
}
|
|
|
|
overAllocation = ((availWidth >= 0) && (availWidth != NS_UNCONSTRAINEDSIZE))
|
|
|
|
? totalColWidth - availWidth : 0;
|
|
|
|
if(overAllocation > 0){
|
|
|
|
// reduce over specified percent col
|
2002-07-30 06:29:03 +04:00
|
|
|
nscoord amountToRemove = 0;
|
2001-01-27 02:44:59 +03:00
|
|
|
for (colX = 0; colX < numCols; colX++) {
|
|
|
|
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX);
|
|
|
|
if(( colFrame->GetWidth(PCT) > 0) && ( percTotal > 0)){
|
2002-07-30 06:29:03 +04:00
|
|
|
amountToRemove += NSToCoordRound(overAllocation* colWidths[colX] / (float) percTotal);
|
|
|
|
nscoord thisRemoval = (amountToRemove > 0) ?
|
2003-12-29 19:58:20 +03:00
|
|
|
nsTableFrame::RoundToPixel(amountToRemove, pixelToTwips,
|
2002-07-30 06:29:03 +04:00
|
|
|
eRoundUpIfHalfOrMore) : 0;
|
|
|
|
colWidths[colX] -= thisRemoval;
|
|
|
|
amountToRemove -= thisRemoval;
|
|
|
|
totalColWidth -= thisRemoval;
|
|
|
|
|
2001-01-27 02:44:59 +03:00
|
|
|
totalColWidth -= colWidths[colX] - PR_MAX(0, colWidths[colX]);
|
2002-07-30 06:29:03 +04:00
|
|
|
colWidths[colX] = PR_MAX(0, colWidths[colX]);
|
2001-01-27 02:44:59 +03:00
|
|
|
colFrame->SetWidth(PCT, colWidths[colX]);
|
2002-07-30 06:29:03 +04:00
|
|
|
}
|
2001-01-27 02:44:59 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
for (colX = 0; colX < numCols; colX++) {
|
1999-06-03 06:42:33 +04:00
|
|
|
mTableFrame->SetColumnWidth(colX, colWidths[colX]);
|
|
|
|
}
|
1998-09-23 06:32:15 +04:00
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|