зеркало из https://github.com/mozilla/gecko-dev.git
Clean up CalcAvailWidth. (Bug 444928) r=bernd
This commit is contained in:
Родитель
5b080ed588
Коммит
960d7facd3
|
@ -678,35 +678,25 @@ nsTableRowFrame::CalculateCellActualSize(nsIFrame* aCellFrame,
|
|||
|
||||
// Calculates the available width for the table cell based on the known
|
||||
// column widths taking into account column spans and column spacing
|
||||
static void
|
||||
static nscoord
|
||||
CalcAvailWidth(nsTableFrame& aTableFrame,
|
||||
nsTableCellFrame& aCellFrame,
|
||||
nscoord aCellSpacingX,
|
||||
nscoord& aColAvailWidth,
|
||||
nscoord& aCellAvailWidth)
|
||||
nscoord aCellSpacingX)
|
||||
{
|
||||
aColAvailWidth = aCellAvailWidth = NS_UNCONSTRAINEDSIZE;
|
||||
nscoord cellAvailWidth = 0;
|
||||
PRInt32 colIndex;
|
||||
aCellFrame.GetColIndex(colIndex);
|
||||
PRInt32 colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
|
||||
nscoord cellSpacing = 0;
|
||||
NS_ASSERTION(colspan > 0, "effective colspan should be positive");
|
||||
|
||||
for (PRInt32 spanX = 0; spanX < colspan; spanX++) {
|
||||
nscoord colWidth = aTableFrame.GetColumnWidth(colIndex + spanX);
|
||||
if (NS_UNCONSTRAINEDSIZE == aColAvailWidth) {
|
||||
aColAvailWidth = colWidth;
|
||||
}
|
||||
else {
|
||||
aColAvailWidth += colWidth;
|
||||
}
|
||||
if ((spanX > 0) && aTableFrame.ColumnHasCellSpacingBefore(colIndex + spanX)) {
|
||||
cellSpacing += aCellSpacingX;
|
||||
cellAvailWidth += aTableFrame.GetColumnWidth(colIndex + spanX);
|
||||
if (spanX > 0 &&
|
||||
aTableFrame.ColumnHasCellSpacingBefore(colIndex + spanX)) {
|
||||
cellAvailWidth += aCellSpacingX;
|
||||
}
|
||||
}
|
||||
if (NS_UNCONSTRAINEDSIZE != aColAvailWidth) {
|
||||
aColAvailWidth += cellSpacing;
|
||||
}
|
||||
aCellAvailWidth = aColAvailWidth;
|
||||
return cellAvailWidth;
|
||||
}
|
||||
|
||||
nscoord
|
||||
|
@ -881,9 +871,8 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
|
|||
|
||||
if (doReflowChild) {
|
||||
// Calculate the available width for the table cell using the known column widths
|
||||
nscoord availColWidth, availCellWidth;
|
||||
CalcAvailWidth(aTableFrame, *cellFrame, cellSpacingX,
|
||||
availColWidth, availCellWidth);
|
||||
nscoord availCellWidth =
|
||||
CalcAvailWidth(aTableFrame, *cellFrame, cellSpacingX);
|
||||
|
||||
nsHTMLReflowMetrics desiredSize;
|
||||
|
||||
|
@ -903,7 +892,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
|
|||
HasPctHeight()) {
|
||||
// Reflow the cell to fit the available width, height
|
||||
// XXX The old IR_ChildIsDirty code used availCellWidth here.
|
||||
nsSize kidAvailSize(availColWidth, aReflowState.availableHeight);
|
||||
nsSize kidAvailSize(availCellWidth, aReflowState.availableHeight);
|
||||
|
||||
// Reflow the child
|
||||
nsTableCellReflowState kidReflowState(aPresContext, aReflowState,
|
||||
|
@ -970,9 +959,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
// Place the child
|
||||
if (NS_UNCONSTRAINEDSIZE != availColWidth) {
|
||||
desiredSize.width = PR_MAX(availCellWidth, availColWidth);
|
||||
}
|
||||
desiredSize.width = availCellWidth;
|
||||
|
||||
FinishReflowChild(kidFrame, aPresContext, nsnull, desiredSize, x, 0, 0);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче