Convert border spacing storage from nsStyleCoord to nscoord. (Bug 443057) r+sr=bzbarsky

This commit is contained in:
L. David Baron 2008-09-12 20:45:37 -07:00
Родитель 703aefde59
Коммит 9272a92fdf
6 изменённых файлов: 32 добавлений и 25 удалений

Просмотреть файл

@ -1251,8 +1251,8 @@ nsComputedDOMStyle::GetBorderSpacing(nsIDOMCSSValue** aValue)
}
const nsStyleTableBorder *border = GetStyleTableBorder();
SetValueToCoord(xSpacing, border->mBorderSpacingX);
SetValueToCoord(ySpacing, border->mBorderSpacingY);
xSpacing->SetAppUnits(border->mBorderSpacingX);
ySpacing->SetAppUnits(border->mBorderSpacingY);
return CallQueryInterface(valueList, aValue);
}

Просмотреть файл

@ -4162,13 +4162,27 @@ nsRuleNode::ComputeTableBorderData(void* aStartStruct,
NS_STYLE_BORDER_SEPARATE, 0, 0, 0, 0);
// border-spacing-x: length, inherit
SetCoord(tableData.mBorderSpacing.mXValue, table->mBorderSpacingX,
parentTable->mBorderSpacingX, SETCOORD_LH | SETCOORD_INITIAL_ZERO,
aContext, mPresContext, inherited);
nsStyleCoord tempCoord;
if (SetCoord(tableData.mBorderSpacing.mXValue, tempCoord,
parentTable->mBorderSpacingX,
SETCOORD_LH | SETCOORD_INITIAL_ZERO,
aContext, mPresContext, inherited)) {
table->mBorderSpacingX = tempCoord.GetCoordValue();
} else {
NS_ASSERTION(tableData.mBorderSpacing.mXValue.GetUnit() == eCSSUnit_Null,
"unexpected unit");
}
// border-spacing-y: length, inherit
SetCoord(tableData.mBorderSpacing.mYValue, table->mBorderSpacingY,
parentTable->mBorderSpacingY, SETCOORD_LH | SETCOORD_INITIAL_ZERO,
aContext, mPresContext, inherited);
if (SetCoord(tableData.mBorderSpacing.mYValue, tempCoord,
parentTable->mBorderSpacingY,
SETCOORD_LH | SETCOORD_INITIAL_ZERO,
aContext, mPresContext, inherited)) {
table->mBorderSpacingY = tempCoord.GetCoordValue();
} else {
NS_ASSERTION(tableData.mBorderSpacing.mYValue.GetUnit() == eCSSUnit_Null,
"unexpected unit");
}
// caption-side: enum, inherit, initial
SetDiscrete(tableData.mCaptionSide, table->mCaptionSide, inherited,

Просмотреть файл

@ -767,13 +767,10 @@ void nsStyleContext::DumpRegressionData(nsPresContext* aPresContext, FILE* out,
// TABLEBORDER
IndentBy(out,aIndent);
const nsStyleTableBorder* tableBorder = GetStyleTableBorder();
fprintf(out, "<tableborder data=\"%d ",
(int)tableBorder->mBorderCollapse);
tableBorder->mBorderSpacingX.ToString(str);
fprintf(out, "%s ", NS_ConvertUTF16toUTF8(str).get());
tableBorder->mBorderSpacingY.ToString(str);
fprintf(out, "%s ", NS_ConvertUTF16toUTF8(str).get());
fprintf(out, "%d %d ",
fprintf(out, "<tableborder data=\"%d %d %d %d %d ",
(int)tableBorder->mBorderCollapse,
(int)tableBorder->mBorderSpacingX,
(int)tableBorder->mBorderSpacingY,
(int)tableBorder->mCaptionSide,
(int)tableBorder->mEmptyCells);
fprintf(out, "\" />\n");

Просмотреть файл

@ -1077,8 +1077,8 @@ nsStyleTableBorder::nsStyleTableBorder(nsPresContext* aPresContext)
? NS_STYLE_TABLE_EMPTY_CELLS_SHOW_BACKGROUND
: NS_STYLE_TABLE_EMPTY_CELLS_SHOW;
mCaptionSide = NS_STYLE_CAPTION_SIDE_TOP;
mBorderSpacingX.SetCoordValue(0);
mBorderSpacingY.SetCoordValue(0);
mBorderSpacingX = 0;
mBorderSpacingY = 0;
}
nsStyleTableBorder::~nsStyleTableBorder(void)

Просмотреть файл

@ -978,8 +978,8 @@ struct nsStyleTableBorder {
static nsChangeHint MaxDifference();
#endif
nsStyleCoord mBorderSpacingX;// [inherited] coord
nsStyleCoord mBorderSpacingY;// [inherited] coord
nscoord mBorderSpacingX;// [inherited]
nscoord mBorderSpacingY;// [inherited]
PRUint8 mBorderCollapse;// [inherited]
PRUint8 mCaptionSide; // [inherited]
PRUint8 mEmptyCells; // [inherited]

Просмотреть файл

@ -3561,9 +3561,7 @@ nscoord nsTableFrame::GetCellSpacingX()
if (IsBorderCollapse())
return 0;
NS_ASSERTION(GetStyleTableBorder()->mBorderSpacingX.GetUnit() == eStyleUnit_Coord,
"Not a coord value!");
return GetStyleTableBorder()->mBorderSpacingX.GetCoordValue();
return GetStyleTableBorder()->mBorderSpacingX;
}
// XXX: could cache this. But be sure to check style changes if you do!
@ -3572,9 +3570,7 @@ nscoord nsTableFrame::GetCellSpacingY()
if (IsBorderCollapse())
return 0;
NS_ASSERTION(GetStyleTableBorder()->mBorderSpacingY.GetUnit() == eStyleUnit_Coord,
"Not a coord value!");
return GetStyleTableBorder()->mBorderSpacingY.GetCoordValue();
return GetStyleTableBorder()->mBorderSpacingY;
}