Bug 330964 - Make nsTableFrame::GetCellSpacing[XY] take an argument. r=roc

This commit is contained in:
James Kitchener
2014-06-15 00:53:00 +02:00
parent adf6041661
commit 080d8cc6c4
7 changed files with 188 additions and 79 deletions

View File

@@ -51,12 +51,11 @@ FixedTableLayoutStrategy::GetMinWidth(nsRenderingContext* aRenderingContext)
nsTableCellMap *cellMap = mTableFrame->GetCellMap();
int32_t colCount = cellMap->GetColCount();
nscoord spacing = mTableFrame->GetCellSpacingX();
nscoord result = 0;
if (colCount > 0) {
result += spacing * (colCount + 1);
result += mTableFrame->GetCellSpacingX(-1, colCount);
}
for (int32_t col = 0; col < colCount; ++col) {
@@ -65,6 +64,7 @@ FixedTableLayoutStrategy::GetMinWidth(nsRenderingContext* aRenderingContext)
NS_ERROR("column frames out of sync with cell map");
continue;
}
nscoord spacing = mTableFrame->GetCellSpacingX(col);
const nsStyleCoord *styleWidth =
&colFrame->StylePosition()->mWidth;
if (styleWidth->ConvertsToLength()) {
@@ -161,7 +161,6 @@ FixedTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowSt
nsTableCellMap *cellMap = mTableFrame->GetCellMap();
int32_t colCount = cellMap->GetColCount();
nscoord spacing = mTableFrame->GetCellSpacingX();
if (colCount == 0) {
// No Columns - nothing to compute
@@ -169,8 +168,8 @@ FixedTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowSt
}
// border-spacing isn't part of the basis for percentages.
tableWidth -= spacing * (colCount + 1);
tableWidth -= mTableFrame->GetCellSpacingX(-1, colCount);
// store the old column widths. We might call multiple times SetFinalWidth
// on the columns, due to this we can't compare at the last call that the
// width has changed with the respect to the last call to
@@ -281,6 +280,7 @@ FixedTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowSt
// row, split up the space evenly. (XXX This
// isn't quite right if some of the columns it's
// in have specified widths. Should we care?)
nscoord spacing = mTableFrame->GetCellSpacingX(col);
colWidth = ((colWidth + spacing) / colSpan) - spacing;
if (colWidth < 0)
colWidth = 0;