зеркало из https://github.com/mozilla/gecko-dev.git
replaced debug flags with class. removed compiler warnings.
This commit is contained in:
Родитель
183b86f662
Коммит
b8e618df7b
|
@ -376,7 +376,7 @@ void BasicTableLayoutStrategy::AllocateUnconstrained(PRInt32 aAllocAmount,
|
|||
// and calculate min/max table width
|
||||
PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth)
|
||||
{
|
||||
if (gsDebugAssign) {printf("AssignPrelimColWidths en max=%d\n"); mTableFrame->Dump(PR_TRUE, PR_FALSE);}
|
||||
if (gsDebugAssign) {printf("AssignPrelimColWidths en max=%d\n", aMaxWidth); mTableFrame->Dump(PR_TRUE, PR_FALSE);}
|
||||
PRBool rv = PR_FALSE;
|
||||
PRInt32 numRows = mTableFrame->GetRowCount();
|
||||
nscoord spacingX = mTableFrame->GetCellSpacingX();
|
||||
|
@ -385,7 +385,6 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth
|
|||
mCellSpacingTotal = 0;
|
||||
|
||||
PRInt32 propTotal = 0; // total of numbers of the type 1*, 2*, etc
|
||||
PRInt32 propTotalMin = 0;
|
||||
PRInt32 numColsForColsAttr = 0; // Nav Quirks cols attribute for equal width cols
|
||||
if (NS_STYLE_TABLE_COLS_NONE != mCols) {
|
||||
numColsForColsAttr = (NS_STYLE_TABLE_COLS_ALL == mCols) ? mNumCols : mCols;
|
||||
|
@ -478,9 +477,9 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth
|
|||
else {
|
||||
colFrame->SetConstraint(e0ProportionConstraint);
|
||||
// override the desired, proportional widths
|
||||
nscoord minWidth = colFrame->GetWidth(MIN_CON);
|
||||
colFrame->SetWidth(DES_CON, minWidth);
|
||||
colFrame->SetWidth(MIN_PRO, minWidth);
|
||||
nscoord colMinWidth = colFrame->GetWidth(MIN_CON);
|
||||
colFrame->SetWidth(DES_CON, colMinWidth);
|
||||
colFrame->SetWidth(MIN_PRO, colMinWidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -513,7 +512,6 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth
|
|||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX);
|
||||
nscoord colProp = colFrame->GetWidth(MIN_PRO);
|
||||
if (colProp > 0) {
|
||||
nscoord minWidth = colFrame->GetWidth(MIN_CON);
|
||||
nscoord minProp = NSToCoordRound(((float)colProp * minPropTotal) / (float)propTotal);
|
||||
colFrame->SetWidth(MIN_PRO, minProp);
|
||||
colFrame->SetWidth(DES_CON, NSToCoordRound(((float)minProp) * mMinToDesProportionRatio));
|
||||
|
@ -589,7 +587,7 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth
|
|||
spanTotal -= spanCellSpacing;
|
||||
nscoord cellWidth = cellWidths[widthX] - spanCellSpacing;
|
||||
if ((cellWidth > 0) && !((widthX == MIN_CON) && (cellWidth <= spanTotal))) {
|
||||
for (PRInt32 spanX = 0; spanX < colSpan; spanX++) {
|
||||
for (spanX = 0; spanX < colSpan; spanX++) {
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX + spanX);
|
||||
nscoord colWidth = PR_MAX(colFrame->GetWidth(widthX),
|
||||
colFrame->GetWidth(widthX + NUM_MAJOR_WIDTHS));
|
||||
|
@ -676,7 +674,7 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth
|
|||
}
|
||||
SetMinAndMaxTableContentWidths();
|
||||
|
||||
if (gsDebugAssign) {printf("AssignPrelimColWidths ex max=%d\n"); mTableFrame->Dump(PR_TRUE, PR_FALSE);}
|
||||
if (gsDebugAssign) {printf("AssignPrelimColWidths ex\n"); mTableFrame->Dump(PR_TRUE, PR_FALSE);}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -853,7 +851,8 @@ nscoord BasicTableLayoutStrategy::AssignPercentageColumnWidths(nscoord aBasisIn,
|
|||
nscoord spanTotal = 0;
|
||||
nscoord colPctWidthTotal = 0;
|
||||
// accumulate the spanTotal as the max of MIN, DES, FIX, PCT
|
||||
for (PRInt32 spanX = 0; spanX < colSpan; spanX++) {
|
||||
PRInt32 spanX;
|
||||
for (spanX = 0; spanX < colSpan; spanX++) {
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX + spanX);
|
||||
nscoord colPctWidth = colFrame->GetWidth(PCT);
|
||||
if (colPctWidth > 0) { // skip pct cols
|
||||
|
@ -874,7 +873,7 @@ nscoord BasicTableLayoutStrategy::AssignPercentageColumnWidths(nscoord aBasisIn,
|
|||
}
|
||||
if (colPctWidthTotal < cellPctWidth) {
|
||||
// record the percent contributions for the spanned cols
|
||||
for (PRInt32 spanX = 0; spanX < colSpan; spanX++) {
|
||||
for (spanX = 0; spanX < colSpan; spanX++) {
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX + spanX);
|
||||
if (colFrame->GetWidth(PCT) > 0) { // skip pct cols
|
||||
continue;
|
||||
|
@ -917,9 +916,6 @@ nscoord BasicTableLayoutStrategy::AssignPercentageColumnWidths(nscoord aBasisIn,
|
|||
for (colX = mNumCols - 1; colX >= 0; colX--) {
|
||||
if (colPcts[colX] > 0) {
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX);
|
||||
nscoord fixWidth = colFrame->GetFixWidth();
|
||||
nscoord pctWidth = colFrame->GetWidth(PCT);
|
||||
nscoord pctAdjWidth = colFrame->GetWidth(PCT_ADJ);
|
||||
nscoord newPct = colPcts[colX] - (colPctTotal - 100);
|
||||
if (newPct > 0) { // this col has enough percent alloc to handle it
|
||||
nscoord newPctWidth = NSToCoordRound( ((float)basis) * ((float)newPct) / 100.0f );
|
||||
|
@ -1315,6 +1311,8 @@ PRBool BasicTableLayoutStrategy::ColumnsCanBeInvalidatedBy(nsStyleCoord*
|
|||
return PR_TRUE; // XXX see comments above
|
||||
}
|
||||
// AUTO to AUTO is not a style change
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
@ -1330,10 +1328,6 @@ PRBool BasicTableLayoutStrategy::ColumnsCanBeInvalidatedBy(const nsTableCellFram
|
|||
if (aConsiderMinWidth || !mTableFrame)
|
||||
return PR_TRUE;
|
||||
|
||||
const nsStylePosition* cellPosition;
|
||||
aCellFrame.GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)cellPosition);
|
||||
const nsStyleCoord& styleWidth = cellPosition->mWidth;
|
||||
|
||||
PRInt32 colIndex;
|
||||
aCellFrame.GetColIndex(colIndex);
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colIndex);
|
||||
|
@ -1365,10 +1359,6 @@ PRBool BasicTableLayoutStrategy::ColumnsAreValidFor(const nsTableCellFrame& aCel
|
|||
nscoord aPrevCellMin,
|
||||
nscoord aPrevCellDes) const
|
||||
{
|
||||
const nsStylePosition* cellPosition;
|
||||
aCellFrame.GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)cellPosition);
|
||||
const nsStyleCoord& styleWidth = cellPosition->mWidth;
|
||||
|
||||
PRInt32 colIndex;
|
||||
aCellFrame.GetColIndex(colIndex);
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colIndex);
|
||||
|
@ -1483,7 +1473,7 @@ void BasicTableLayoutStrategy::Dump(PRInt32 aIndent)
|
|||
}
|
||||
indent[aIndent] = 0;
|
||||
|
||||
printf("%s**START BASIC STRATEGY DUMP** table=%X cols=%d numCols=%d",
|
||||
printf("%s**START BASIC STRATEGY DUMP** table=%X cols=%X numCols=%d",
|
||||
indent, mTableFrame, mCols, mNumCols);
|
||||
printf("\n%s minConWidth=%d maxConWidth=%d cellSpacing=%d propRatio=%.2f navQuirks=%d",
|
||||
indent, mMinTableContentWidth, mMaxTableContentWidth, mCellSpacingTotal, mMinToDesProportionRatio, mIsNavQuirksMode);
|
||||
|
|
|
@ -21,6 +21,20 @@
|
|||
#include "nsTableFrame.h"
|
||||
#include "nsTableCellFrame.h"
|
||||
|
||||
// CellData
|
||||
|
||||
CellData::CellData()
|
||||
{
|
||||
mOrigCell = nsnull;
|
||||
mRowSpanData = nsnull;
|
||||
mColSpanData = nsnull;
|
||||
}
|
||||
|
||||
CellData::~CellData()
|
||||
{}
|
||||
|
||||
// nsCellMap
|
||||
|
||||
nsCellMap::nsCellMap(int aRowCount, int aColCount)
|
||||
: mRowCount(0),
|
||||
mNumCollapsedRows(0),
|
||||
|
@ -248,10 +262,10 @@ void nsCellMap::Dump() const
|
|||
nsTableCellFrame* cell = nsnull;
|
||||
int rr, cc;
|
||||
if (cd->mRowSpanData) {
|
||||
nsTableCellFrame* cell = cd->mRowSpanData->mOrigCell;
|
||||
nsTableRowFrame* row;
|
||||
cell->GetParent((nsIFrame**)&row);
|
||||
rr = row->GetRowIndex();
|
||||
cell = cd->mRowSpanData->mOrigCell;
|
||||
nsTableRowFrame* rowFrame;
|
||||
cell->GetParent((nsIFrame**)&rowFrame);
|
||||
rr = rowFrame->GetRowIndex();
|
||||
cell->GetColIndex(cc);
|
||||
printf("r%d,%d ", rr, cc);
|
||||
}
|
||||
|
|
|
@ -496,7 +496,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
if (DEBUG_REFLOW_CELL) nsTableFrame::DebugReflow("TC::Rfl", this, &aReflowState, nsnull);
|
||||
if (nsDebugTable::gRflCell) nsTableFrame::DebugReflow("TC::Rfl", this, &aReflowState, nsnull);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
// this should probably be cached somewhere
|
||||
|
@ -564,7 +564,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
|
|||
aReflowState.reflowCommand->GetType(type);
|
||||
if (nsIReflowCommand::StyleChanged==type)
|
||||
{
|
||||
nsresult rv = IR_StyleChanged(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
rv = IR_StyleChanged(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
return rv;
|
||||
}
|
||||
|
@ -588,9 +588,9 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
|
|||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstKid,
|
||||
availSize);
|
||||
|
||||
if (DEBUG_REFLOW_AREA) nsTableFrame::DebugReflow("Area::Rfl en", firstKid, &kidReflowState, nsnull);
|
||||
if (nsDebugTable::gRflArea) nsTableFrame::DebugReflow("Area::Rfl en", firstKid, &kidReflowState, nsnull);
|
||||
ReflowChild(firstKid, aPresContext, kidSize, kidReflowState, aStatus);
|
||||
if (DEBUG_REFLOW_AREA) nsTableFrame::DebugReflow("Area::Rfl ex", firstKid, nsnull, &kidSize);
|
||||
if (nsDebugTable::gRflArea) nsTableFrame::DebugReflow("Area::Rfl ex", firstKid, nsnull, &kidSize);
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
DebugCheckChildSize(firstKid, kidSize, availSize, (NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth));
|
||||
|
@ -681,7 +681,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
|
|||
aDesiredSize.ascent=aDesiredSize.height;
|
||||
aDesiredSize.descent=0;
|
||||
|
||||
if (DEBUG_REFLOW_CELL) nsTableFrame::DebugReflow("TC::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
if (nsDebugTable::gRflCell) nsTableFrame::DebugReflow("TC::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -858,13 +858,13 @@ void nsTableCellFrame::MapBorderMarginPadding(nsIPresContext* aPresContext)
|
|||
}
|
||||
|
||||
// if the padding is not already set, set it to the table's cellpadding
|
||||
if (eHTMLUnit_Null == spacingData->mPadding.GetTopUnit())
|
||||
if (eStyleUnit_Null == spacingData->mPadding.GetTopUnit())
|
||||
spacingData->mPadding.SetTop(defaultPadding);
|
||||
if (eHTMLUnit_Null == spacingData->mPadding.GetRightUnit())
|
||||
if (eStyleUnit_Null == spacingData->mPadding.GetRightUnit())
|
||||
spacingData->mPadding.SetRight(defaultPadding);
|
||||
if (eHTMLUnit_Null == spacingData->mPadding.GetBottomUnit())
|
||||
if (eStyleUnit_Null == spacingData->mPadding.GetBottomUnit())
|
||||
spacingData->mPadding.SetBottom(defaultPadding);
|
||||
if (eHTMLUnit_Null == spacingData->mPadding.GetLeftUnit())
|
||||
if (eStyleUnit_Null == spacingData->mPadding.GetLeftUnit())
|
||||
spacingData->mPadding.SetLeft(defaultPadding);
|
||||
|
||||
// get border information from the table
|
||||
|
|
|
@ -59,19 +59,19 @@ static NS_DEFINE_IID(kITableRowGroupFrameIID, NS_ITABLEROWGROUPFRAME_IID);
|
|||
|
||||
static const PRInt32 kColumnWidthIncrement=100;
|
||||
|
||||
/* ----------- CellData ---------- */
|
||||
|
||||
/* CellData is the info stored in the cell map */
|
||||
CellData::CellData()
|
||||
{
|
||||
mOrigCell = nsnull;
|
||||
mRowSpanData = nsnull;
|
||||
mColSpanData = nsnull;
|
||||
}
|
||||
|
||||
CellData::~CellData()
|
||||
{}
|
||||
|
||||
#if 1
|
||||
PRBool nsDebugTable::gRflTable = PR_FALSE;
|
||||
PRBool nsDebugTable::gRflRowGrp = PR_FALSE;
|
||||
PRBool nsDebugTable::gRflRow = PR_FALSE;
|
||||
PRBool nsDebugTable::gRflCell = PR_FALSE;
|
||||
PRBool nsDebugTable::gRflArea = PR_FALSE;
|
||||
#else
|
||||
PRBool nsDebugTable::gRflTable = PR_TRUE;
|
||||
PRBool nsDebugTable::gRflRowGrp = PR_TRUE;
|
||||
PRBool nsDebugTable::gRflRow = PR_TRUE;
|
||||
PRBool nsDebugTable::gRflCell = PR_TRUE;
|
||||
PRBool nsDebugTable::gRflArea = PR_TRUE;
|
||||
#endif
|
||||
/* ----------- InnerTableReflowState ---------- */
|
||||
|
||||
struct InnerTableReflowState {
|
||||
|
@ -2010,7 +2010,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext,
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
if (DEBUG_REFLOW_TABLE) nsTableFrame::DebugReflow("T::Rfl en", this, &aReflowState, nsnull);
|
||||
if (nsDebugTable::gRflTable) nsTableFrame::DebugReflow("T::Rfl en", this, &aReflowState, nsnull);
|
||||
|
||||
// Initialize out parameter
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
|
@ -2122,7 +2122,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext,
|
|||
Invalidate(damageRect);
|
||||
}
|
||||
|
||||
if (DEBUG_REFLOW_TABLE) nsTableFrame::DebugReflow("T::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
if (nsDebugTable::gRflTable) nsTableFrame::DebugReflow("T::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -5334,11 +5334,11 @@ void nsTableFrame::DebugGetIndent(const nsIFrame* aFrame,
|
|||
while (parent) {
|
||||
nsIAtom* frameType = nsnull;
|
||||
parent->GetFrameType(&frameType);
|
||||
if ((DEBUG_REFLOW_TABLE && (nsLayoutAtoms::tableFrame == frameType)) ||
|
||||
(DEBUG_REFLOW_ROWGRP && (nsLayoutAtoms::tableRowGroupFrame == frameType)) ||
|
||||
(DEBUG_REFLOW_ROW && (nsLayoutAtoms::tableRowFrame == frameType)) ||
|
||||
(DEBUG_REFLOW_CELL && (nsLayoutAtoms::tableCellFrame == frameType)) ||
|
||||
(DEBUG_REFLOW_AREA && (nsLayoutAtoms::areaFrame == frameType))) {
|
||||
if ((nsDebugTable::gRflTable && (nsLayoutAtoms::tableFrame == frameType)) ||
|
||||
(nsDebugTable::gRflRowGrp && (nsLayoutAtoms::tableRowGroupFrame == frameType)) ||
|
||||
(nsDebugTable::gRflRow && (nsLayoutAtoms::tableRowFrame == frameType)) ||
|
||||
(nsDebugTable::gRflCell && (nsLayoutAtoms::tableCellFrame == frameType)) ||
|
||||
(nsDebugTable::gRflArea && (nsLayoutAtoms::areaFrame == frameType))) {
|
||||
numLevels++;
|
||||
}
|
||||
NS_IF_RELEASE(frameType);
|
||||
|
|
|
@ -47,11 +47,14 @@ struct nsStyleSpacing;
|
|||
#define NS_TABLE_FRAME_COLGROUP_LIST_INDEX 0
|
||||
#define NS_TABLE_FRAME_LAST_LIST_INDEX NS_TABLE_FRAME_COLGROUP_LIST_INDEX
|
||||
|
||||
static PRBool DEBUG_REFLOW_TABLE = PR_FALSE;
|
||||
static PRBool DEBUG_REFLOW_ROWGRP = PR_FALSE;
|
||||
static PRBool DEBUG_REFLOW_ROW = PR_FALSE;
|
||||
static PRBool DEBUG_REFLOW_CELL = PR_FALSE;
|
||||
static PRBool DEBUG_REFLOW_AREA = PR_FALSE;
|
||||
struct nsDebugTable
|
||||
{
|
||||
static PRBool gRflTable;
|
||||
static PRBool gRflRowGrp;
|
||||
static PRBool gRflRow;
|
||||
static PRBool gRflCell;
|
||||
static PRBool gRflArea;
|
||||
};
|
||||
/* ============================================================================ */
|
||||
|
||||
/** nsTableFrame maps the inner portion of a table (everything except captions.)
|
||||
|
|
|
@ -283,7 +283,6 @@ nsTableRowFrame::InitChildren()
|
|||
mInitializedChildren=PR_TRUE;
|
||||
PRInt32 rowIndex = table->GetNextAvailRowIndex();
|
||||
SetRowIndex(rowIndex);
|
||||
PRInt32 colIndex = 0;
|
||||
for (nsIFrame* kidFrame = mFrames.FirstChild(); nsnull != kidFrame; kidFrame->GetNextSibling(&kidFrame))
|
||||
{
|
||||
const nsStyleDisplay *kidDisplay;
|
||||
|
@ -1388,7 +1387,7 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext,
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
if (DEBUG_REFLOW_ROW) nsTableFrame::DebugReflow("TR::Rfl en", this, &aReflowState, nsnull);
|
||||
if (nsDebugTable::gRflRow) nsTableFrame::DebugReflow("TR::Rfl en", this, &aReflowState, nsnull);
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Initialize 'out' parameters (aStatus set below, undefined if rv returns an error)
|
||||
|
@ -1444,7 +1443,7 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext,
|
|||
break;
|
||||
}
|
||||
|
||||
if (DEBUG_REFLOW_ROW) nsTableFrame::DebugReflow("TR::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
if (nsDebugTable::gRflRow) nsTableFrame::DebugReflow("TR::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -992,7 +992,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext,
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
if (DEBUG_REFLOW_ROWGRP) nsTableFrame::DebugReflow("TRG::Rfl", this, &aReflowState, nsnull);
|
||||
if (nsDebugTable::gRflRowGrp) nsTableFrame::DebugReflow("TRG::Rfl", this, &aReflowState, nsnull);
|
||||
nsresult rv=NS_OK;
|
||||
|
||||
// Initialize out parameter
|
||||
|
@ -1071,7 +1071,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
if (DEBUG_REFLOW_ROWGRP) nsTableFrame::DebugReflow("TRG::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
if (nsDebugTable::gRflRowGrp) nsTableFrame::DebugReflow("TRG::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -376,7 +376,7 @@ void BasicTableLayoutStrategy::AllocateUnconstrained(PRInt32 aAllocAmount,
|
|||
// and calculate min/max table width
|
||||
PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth)
|
||||
{
|
||||
if (gsDebugAssign) {printf("AssignPrelimColWidths en max=%d\n"); mTableFrame->Dump(PR_TRUE, PR_FALSE);}
|
||||
if (gsDebugAssign) {printf("AssignPrelimColWidths en max=%d\n", aMaxWidth); mTableFrame->Dump(PR_TRUE, PR_FALSE);}
|
||||
PRBool rv = PR_FALSE;
|
||||
PRInt32 numRows = mTableFrame->GetRowCount();
|
||||
nscoord spacingX = mTableFrame->GetCellSpacingX();
|
||||
|
@ -385,7 +385,6 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth
|
|||
mCellSpacingTotal = 0;
|
||||
|
||||
PRInt32 propTotal = 0; // total of numbers of the type 1*, 2*, etc
|
||||
PRInt32 propTotalMin = 0;
|
||||
PRInt32 numColsForColsAttr = 0; // Nav Quirks cols attribute for equal width cols
|
||||
if (NS_STYLE_TABLE_COLS_NONE != mCols) {
|
||||
numColsForColsAttr = (NS_STYLE_TABLE_COLS_ALL == mCols) ? mNumCols : mCols;
|
||||
|
@ -478,9 +477,9 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth
|
|||
else {
|
||||
colFrame->SetConstraint(e0ProportionConstraint);
|
||||
// override the desired, proportional widths
|
||||
nscoord minWidth = colFrame->GetWidth(MIN_CON);
|
||||
colFrame->SetWidth(DES_CON, minWidth);
|
||||
colFrame->SetWidth(MIN_PRO, minWidth);
|
||||
nscoord colMinWidth = colFrame->GetWidth(MIN_CON);
|
||||
colFrame->SetWidth(DES_CON, colMinWidth);
|
||||
colFrame->SetWidth(MIN_PRO, colMinWidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -513,7 +512,6 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth
|
|||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX);
|
||||
nscoord colProp = colFrame->GetWidth(MIN_PRO);
|
||||
if (colProp > 0) {
|
||||
nscoord minWidth = colFrame->GetWidth(MIN_CON);
|
||||
nscoord minProp = NSToCoordRound(((float)colProp * minPropTotal) / (float)propTotal);
|
||||
colFrame->SetWidth(MIN_PRO, minProp);
|
||||
colFrame->SetWidth(DES_CON, NSToCoordRound(((float)minProp) * mMinToDesProportionRatio));
|
||||
|
@ -589,7 +587,7 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth
|
|||
spanTotal -= spanCellSpacing;
|
||||
nscoord cellWidth = cellWidths[widthX] - spanCellSpacing;
|
||||
if ((cellWidth > 0) && !((widthX == MIN_CON) && (cellWidth <= spanTotal))) {
|
||||
for (PRInt32 spanX = 0; spanX < colSpan; spanX++) {
|
||||
for (spanX = 0; spanX < colSpan; spanX++) {
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX + spanX);
|
||||
nscoord colWidth = PR_MAX(colFrame->GetWidth(widthX),
|
||||
colFrame->GetWidth(widthX + NUM_MAJOR_WIDTHS));
|
||||
|
@ -676,7 +674,7 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nscoord aMaxWidth
|
|||
}
|
||||
SetMinAndMaxTableContentWidths();
|
||||
|
||||
if (gsDebugAssign) {printf("AssignPrelimColWidths ex max=%d\n"); mTableFrame->Dump(PR_TRUE, PR_FALSE);}
|
||||
if (gsDebugAssign) {printf("AssignPrelimColWidths ex\n"); mTableFrame->Dump(PR_TRUE, PR_FALSE);}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -853,7 +851,8 @@ nscoord BasicTableLayoutStrategy::AssignPercentageColumnWidths(nscoord aBasisIn,
|
|||
nscoord spanTotal = 0;
|
||||
nscoord colPctWidthTotal = 0;
|
||||
// accumulate the spanTotal as the max of MIN, DES, FIX, PCT
|
||||
for (PRInt32 spanX = 0; spanX < colSpan; spanX++) {
|
||||
PRInt32 spanX;
|
||||
for (spanX = 0; spanX < colSpan; spanX++) {
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX + spanX);
|
||||
nscoord colPctWidth = colFrame->GetWidth(PCT);
|
||||
if (colPctWidth > 0) { // skip pct cols
|
||||
|
@ -874,7 +873,7 @@ nscoord BasicTableLayoutStrategy::AssignPercentageColumnWidths(nscoord aBasisIn,
|
|||
}
|
||||
if (colPctWidthTotal < cellPctWidth) {
|
||||
// record the percent contributions for the spanned cols
|
||||
for (PRInt32 spanX = 0; spanX < colSpan; spanX++) {
|
||||
for (spanX = 0; spanX < colSpan; spanX++) {
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX + spanX);
|
||||
if (colFrame->GetWidth(PCT) > 0) { // skip pct cols
|
||||
continue;
|
||||
|
@ -917,9 +916,6 @@ nscoord BasicTableLayoutStrategy::AssignPercentageColumnWidths(nscoord aBasisIn,
|
|||
for (colX = mNumCols - 1; colX >= 0; colX--) {
|
||||
if (colPcts[colX] > 0) {
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX);
|
||||
nscoord fixWidth = colFrame->GetFixWidth();
|
||||
nscoord pctWidth = colFrame->GetWidth(PCT);
|
||||
nscoord pctAdjWidth = colFrame->GetWidth(PCT_ADJ);
|
||||
nscoord newPct = colPcts[colX] - (colPctTotal - 100);
|
||||
if (newPct > 0) { // this col has enough percent alloc to handle it
|
||||
nscoord newPctWidth = NSToCoordRound( ((float)basis) * ((float)newPct) / 100.0f );
|
||||
|
@ -1315,6 +1311,8 @@ PRBool BasicTableLayoutStrategy::ColumnsCanBeInvalidatedBy(nsStyleCoord*
|
|||
return PR_TRUE; // XXX see comments above
|
||||
}
|
||||
// AUTO to AUTO is not a style change
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
@ -1330,10 +1328,6 @@ PRBool BasicTableLayoutStrategy::ColumnsCanBeInvalidatedBy(const nsTableCellFram
|
|||
if (aConsiderMinWidth || !mTableFrame)
|
||||
return PR_TRUE;
|
||||
|
||||
const nsStylePosition* cellPosition;
|
||||
aCellFrame.GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)cellPosition);
|
||||
const nsStyleCoord& styleWidth = cellPosition->mWidth;
|
||||
|
||||
PRInt32 colIndex;
|
||||
aCellFrame.GetColIndex(colIndex);
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colIndex);
|
||||
|
@ -1365,10 +1359,6 @@ PRBool BasicTableLayoutStrategy::ColumnsAreValidFor(const nsTableCellFrame& aCel
|
|||
nscoord aPrevCellMin,
|
||||
nscoord aPrevCellDes) const
|
||||
{
|
||||
const nsStylePosition* cellPosition;
|
||||
aCellFrame.GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)cellPosition);
|
||||
const nsStyleCoord& styleWidth = cellPosition->mWidth;
|
||||
|
||||
PRInt32 colIndex;
|
||||
aCellFrame.GetColIndex(colIndex);
|
||||
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colIndex);
|
||||
|
@ -1483,7 +1473,7 @@ void BasicTableLayoutStrategy::Dump(PRInt32 aIndent)
|
|||
}
|
||||
indent[aIndent] = 0;
|
||||
|
||||
printf("%s**START BASIC STRATEGY DUMP** table=%X cols=%d numCols=%d",
|
||||
printf("%s**START BASIC STRATEGY DUMP** table=%X cols=%X numCols=%d",
|
||||
indent, mTableFrame, mCols, mNumCols);
|
||||
printf("\n%s minConWidth=%d maxConWidth=%d cellSpacing=%d propRatio=%.2f navQuirks=%d",
|
||||
indent, mMinTableContentWidth, mMaxTableContentWidth, mCellSpacingTotal, mMinToDesProportionRatio, mIsNavQuirksMode);
|
||||
|
|
|
@ -21,6 +21,20 @@
|
|||
#include "nsTableFrame.h"
|
||||
#include "nsTableCellFrame.h"
|
||||
|
||||
// CellData
|
||||
|
||||
CellData::CellData()
|
||||
{
|
||||
mOrigCell = nsnull;
|
||||
mRowSpanData = nsnull;
|
||||
mColSpanData = nsnull;
|
||||
}
|
||||
|
||||
CellData::~CellData()
|
||||
{}
|
||||
|
||||
// nsCellMap
|
||||
|
||||
nsCellMap::nsCellMap(int aRowCount, int aColCount)
|
||||
: mRowCount(0),
|
||||
mNumCollapsedRows(0),
|
||||
|
@ -248,10 +262,10 @@ void nsCellMap::Dump() const
|
|||
nsTableCellFrame* cell = nsnull;
|
||||
int rr, cc;
|
||||
if (cd->mRowSpanData) {
|
||||
nsTableCellFrame* cell = cd->mRowSpanData->mOrigCell;
|
||||
nsTableRowFrame* row;
|
||||
cell->GetParent((nsIFrame**)&row);
|
||||
rr = row->GetRowIndex();
|
||||
cell = cd->mRowSpanData->mOrigCell;
|
||||
nsTableRowFrame* rowFrame;
|
||||
cell->GetParent((nsIFrame**)&rowFrame);
|
||||
rr = rowFrame->GetRowIndex();
|
||||
cell->GetColIndex(cc);
|
||||
printf("r%d,%d ", rr, cc);
|
||||
}
|
||||
|
|
|
@ -496,7 +496,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
if (DEBUG_REFLOW_CELL) nsTableFrame::DebugReflow("TC::Rfl", this, &aReflowState, nsnull);
|
||||
if (nsDebugTable::gRflCell) nsTableFrame::DebugReflow("TC::Rfl", this, &aReflowState, nsnull);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
// this should probably be cached somewhere
|
||||
|
@ -564,7 +564,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
|
|||
aReflowState.reflowCommand->GetType(type);
|
||||
if (nsIReflowCommand::StyleChanged==type)
|
||||
{
|
||||
nsresult rv = IR_StyleChanged(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
rv = IR_StyleChanged(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
return rv;
|
||||
}
|
||||
|
@ -588,9 +588,9 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
|
|||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstKid,
|
||||
availSize);
|
||||
|
||||
if (DEBUG_REFLOW_AREA) nsTableFrame::DebugReflow("Area::Rfl en", firstKid, &kidReflowState, nsnull);
|
||||
if (nsDebugTable::gRflArea) nsTableFrame::DebugReflow("Area::Rfl en", firstKid, &kidReflowState, nsnull);
|
||||
ReflowChild(firstKid, aPresContext, kidSize, kidReflowState, aStatus);
|
||||
if (DEBUG_REFLOW_AREA) nsTableFrame::DebugReflow("Area::Rfl ex", firstKid, nsnull, &kidSize);
|
||||
if (nsDebugTable::gRflArea) nsTableFrame::DebugReflow("Area::Rfl ex", firstKid, nsnull, &kidSize);
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
DebugCheckChildSize(firstKid, kidSize, availSize, (NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth));
|
||||
|
@ -681,7 +681,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
|
|||
aDesiredSize.ascent=aDesiredSize.height;
|
||||
aDesiredSize.descent=0;
|
||||
|
||||
if (DEBUG_REFLOW_CELL) nsTableFrame::DebugReflow("TC::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
if (nsDebugTable::gRflCell) nsTableFrame::DebugReflow("TC::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -858,13 +858,13 @@ void nsTableCellFrame::MapBorderMarginPadding(nsIPresContext* aPresContext)
|
|||
}
|
||||
|
||||
// if the padding is not already set, set it to the table's cellpadding
|
||||
if (eHTMLUnit_Null == spacingData->mPadding.GetTopUnit())
|
||||
if (eStyleUnit_Null == spacingData->mPadding.GetTopUnit())
|
||||
spacingData->mPadding.SetTop(defaultPadding);
|
||||
if (eHTMLUnit_Null == spacingData->mPadding.GetRightUnit())
|
||||
if (eStyleUnit_Null == spacingData->mPadding.GetRightUnit())
|
||||
spacingData->mPadding.SetRight(defaultPadding);
|
||||
if (eHTMLUnit_Null == spacingData->mPadding.GetBottomUnit())
|
||||
if (eStyleUnit_Null == spacingData->mPadding.GetBottomUnit())
|
||||
spacingData->mPadding.SetBottom(defaultPadding);
|
||||
if (eHTMLUnit_Null == spacingData->mPadding.GetLeftUnit())
|
||||
if (eStyleUnit_Null == spacingData->mPadding.GetLeftUnit())
|
||||
spacingData->mPadding.SetLeft(defaultPadding);
|
||||
|
||||
// get border information from the table
|
||||
|
|
|
@ -59,19 +59,19 @@ static NS_DEFINE_IID(kITableRowGroupFrameIID, NS_ITABLEROWGROUPFRAME_IID);
|
|||
|
||||
static const PRInt32 kColumnWidthIncrement=100;
|
||||
|
||||
/* ----------- CellData ---------- */
|
||||
|
||||
/* CellData is the info stored in the cell map */
|
||||
CellData::CellData()
|
||||
{
|
||||
mOrigCell = nsnull;
|
||||
mRowSpanData = nsnull;
|
||||
mColSpanData = nsnull;
|
||||
}
|
||||
|
||||
CellData::~CellData()
|
||||
{}
|
||||
|
||||
#if 1
|
||||
PRBool nsDebugTable::gRflTable = PR_FALSE;
|
||||
PRBool nsDebugTable::gRflRowGrp = PR_FALSE;
|
||||
PRBool nsDebugTable::gRflRow = PR_FALSE;
|
||||
PRBool nsDebugTable::gRflCell = PR_FALSE;
|
||||
PRBool nsDebugTable::gRflArea = PR_FALSE;
|
||||
#else
|
||||
PRBool nsDebugTable::gRflTable = PR_TRUE;
|
||||
PRBool nsDebugTable::gRflRowGrp = PR_TRUE;
|
||||
PRBool nsDebugTable::gRflRow = PR_TRUE;
|
||||
PRBool nsDebugTable::gRflCell = PR_TRUE;
|
||||
PRBool nsDebugTable::gRflArea = PR_TRUE;
|
||||
#endif
|
||||
/* ----------- InnerTableReflowState ---------- */
|
||||
|
||||
struct InnerTableReflowState {
|
||||
|
@ -2010,7 +2010,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext,
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
if (DEBUG_REFLOW_TABLE) nsTableFrame::DebugReflow("T::Rfl en", this, &aReflowState, nsnull);
|
||||
if (nsDebugTable::gRflTable) nsTableFrame::DebugReflow("T::Rfl en", this, &aReflowState, nsnull);
|
||||
|
||||
// Initialize out parameter
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
|
@ -2122,7 +2122,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext& aPresContext,
|
|||
Invalidate(damageRect);
|
||||
}
|
||||
|
||||
if (DEBUG_REFLOW_TABLE) nsTableFrame::DebugReflow("T::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
if (nsDebugTable::gRflTable) nsTableFrame::DebugReflow("T::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -5334,11 +5334,11 @@ void nsTableFrame::DebugGetIndent(const nsIFrame* aFrame,
|
|||
while (parent) {
|
||||
nsIAtom* frameType = nsnull;
|
||||
parent->GetFrameType(&frameType);
|
||||
if ((DEBUG_REFLOW_TABLE && (nsLayoutAtoms::tableFrame == frameType)) ||
|
||||
(DEBUG_REFLOW_ROWGRP && (nsLayoutAtoms::tableRowGroupFrame == frameType)) ||
|
||||
(DEBUG_REFLOW_ROW && (nsLayoutAtoms::tableRowFrame == frameType)) ||
|
||||
(DEBUG_REFLOW_CELL && (nsLayoutAtoms::tableCellFrame == frameType)) ||
|
||||
(DEBUG_REFLOW_AREA && (nsLayoutAtoms::areaFrame == frameType))) {
|
||||
if ((nsDebugTable::gRflTable && (nsLayoutAtoms::tableFrame == frameType)) ||
|
||||
(nsDebugTable::gRflRowGrp && (nsLayoutAtoms::tableRowGroupFrame == frameType)) ||
|
||||
(nsDebugTable::gRflRow && (nsLayoutAtoms::tableRowFrame == frameType)) ||
|
||||
(nsDebugTable::gRflCell && (nsLayoutAtoms::tableCellFrame == frameType)) ||
|
||||
(nsDebugTable::gRflArea && (nsLayoutAtoms::areaFrame == frameType))) {
|
||||
numLevels++;
|
||||
}
|
||||
NS_IF_RELEASE(frameType);
|
||||
|
|
|
@ -47,11 +47,14 @@ struct nsStyleSpacing;
|
|||
#define NS_TABLE_FRAME_COLGROUP_LIST_INDEX 0
|
||||
#define NS_TABLE_FRAME_LAST_LIST_INDEX NS_TABLE_FRAME_COLGROUP_LIST_INDEX
|
||||
|
||||
static PRBool DEBUG_REFLOW_TABLE = PR_FALSE;
|
||||
static PRBool DEBUG_REFLOW_ROWGRP = PR_FALSE;
|
||||
static PRBool DEBUG_REFLOW_ROW = PR_FALSE;
|
||||
static PRBool DEBUG_REFLOW_CELL = PR_FALSE;
|
||||
static PRBool DEBUG_REFLOW_AREA = PR_FALSE;
|
||||
struct nsDebugTable
|
||||
{
|
||||
static PRBool gRflTable;
|
||||
static PRBool gRflRowGrp;
|
||||
static PRBool gRflRow;
|
||||
static PRBool gRflCell;
|
||||
static PRBool gRflArea;
|
||||
};
|
||||
/* ============================================================================ */
|
||||
|
||||
/** nsTableFrame maps the inner portion of a table (everything except captions.)
|
||||
|
|
|
@ -283,7 +283,6 @@ nsTableRowFrame::InitChildren()
|
|||
mInitializedChildren=PR_TRUE;
|
||||
PRInt32 rowIndex = table->GetNextAvailRowIndex();
|
||||
SetRowIndex(rowIndex);
|
||||
PRInt32 colIndex = 0;
|
||||
for (nsIFrame* kidFrame = mFrames.FirstChild(); nsnull != kidFrame; kidFrame->GetNextSibling(&kidFrame))
|
||||
{
|
||||
const nsStyleDisplay *kidDisplay;
|
||||
|
@ -1388,7 +1387,7 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext,
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
if (DEBUG_REFLOW_ROW) nsTableFrame::DebugReflow("TR::Rfl en", this, &aReflowState, nsnull);
|
||||
if (nsDebugTable::gRflRow) nsTableFrame::DebugReflow("TR::Rfl en", this, &aReflowState, nsnull);
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Initialize 'out' parameters (aStatus set below, undefined if rv returns an error)
|
||||
|
@ -1444,7 +1443,7 @@ nsTableRowFrame::Reflow(nsIPresContext& aPresContext,
|
|||
break;
|
||||
}
|
||||
|
||||
if (DEBUG_REFLOW_ROW) nsTableFrame::DebugReflow("TR::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
if (nsDebugTable::gRflRow) nsTableFrame::DebugReflow("TR::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -992,7 +992,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext,
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
if (DEBUG_REFLOW_ROWGRP) nsTableFrame::DebugReflow("TRG::Rfl", this, &aReflowState, nsnull);
|
||||
if (nsDebugTable::gRflRowGrp) nsTableFrame::DebugReflow("TRG::Rfl", this, &aReflowState, nsnull);
|
||||
nsresult rv=NS_OK;
|
||||
|
||||
// Initialize out parameter
|
||||
|
@ -1071,7 +1071,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext& aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
if (DEBUG_REFLOW_ROWGRP) nsTableFrame::DebugReflow("TRG::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
if (nsDebugTable::gRflRowGrp) nsTableFrame::DebugReflow("TRG::Rfl ex", this, nsnull, &aDesiredSize);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче