diff --git a/mozilla/content/base/src/nsRuleNode.cpp b/mozilla/content/base/src/nsRuleNode.cpp index dfd700f7e37..7d07eb09405 100644 --- a/mozilla/content/base/src/nsRuleNode.cpp +++ b/mozilla/content/base/src/nsRuleNode.cpp @@ -3841,24 +3841,14 @@ nsRuleNode::ComputeTableBorderData(nsStyleStruct* aStartStruct, table->mBorderCollapse = parentTable->mBorderCollapse; } - nsStyleCoord coord; - // border-spacing-x: length, inherit - if (SetCoord(tableData.mBorderSpacing.mXValue, coord, coord, SETCOORD_LENGTH, aContext, mPresContext, inherited)) { - table->mBorderSpacingX = coord.GetCoordValue(); - } - else if (eCSSUnit_Inherit == tableData.mBorderSpacing.mXValue.GetUnit()) { - inherited = PR_TRUE; - table->mBorderSpacingX = parentTable->mBorderSpacingX; - } + SetCoord(tableData.mBorderSpacing.mXValue, table->mBorderSpacingX, + parentTable->mBorderSpacingX, SETCOORD_LH, + aContext, mPresContext, inherited); // border-spacing-y: length, inherit - if (SetCoord(tableData.mBorderSpacing.mYValue, coord, coord, SETCOORD_LENGTH, aContext, mPresContext, inherited)) { - table->mBorderSpacingY = coord.GetCoordValue(); - } - else if (eCSSUnit_Inherit == tableData.mBorderSpacing.mYValue.GetUnit()) { - inherited = PR_TRUE; - table->mBorderSpacingY = parentTable->mBorderSpacingY; - } + SetCoord(tableData.mBorderSpacing.mYValue, table->mBorderSpacingY, + parentTable->mBorderSpacingY, SETCOORD_LH, + aContext, mPresContext, inherited); // caption-side: enum, inherit if (eCSSUnit_Enumerated == tableData.mCaptionSide.GetUnit()) { diff --git a/mozilla/content/shared/src/nsStyleStruct.cpp b/mozilla/content/shared/src/nsStyleStruct.cpp index 50955403066..029d181b458 100644 --- a/mozilla/content/shared/src/nsStyleStruct.cpp +++ b/mozilla/content/shared/src/nsStyleStruct.cpp @@ -1101,8 +1101,8 @@ nsStyleTableBorder::nsStyleTableBorder(nsPresContext* aPresContext) ? NS_STYLE_TABLE_EMPTY_CELLS_SHOW_BACKGROUND : NS_STYLE_TABLE_EMPTY_CELLS_SHOW; mCaptionSide = NS_SIDE_TOP; - mBorderSpacingX.Reset(); - mBorderSpacingY.Reset(); + mBorderSpacingX.SetCoordValue(0); + mBorderSpacingY.SetCoordValue(0); } nsStyleTableBorder::~nsStyleTableBorder(void) diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index a4def1c753b..76e9128d169 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -4026,27 +4026,23 @@ nsTableFrame::GetBorderPadding(const nsSize& aBasis, // XXX: could cache this. But be sure to check style changes if you do! nscoord nsTableFrame::GetCellSpacingX() { - nscoord cellSpacing = 0; - if (!IsBorderCollapse()) { - const nsStyleTableBorder* tableStyle = GetStyleTableBorder(); - if (tableStyle->mBorderSpacingX.GetUnit() == eStyleUnit_Coord) { - cellSpacing = tableStyle->mBorderSpacingX.GetCoordValue(); - } - } - return cellSpacing; + if (IsBorderCollapse()) + return 0; + + NS_ASSERTION(GetStyleTableBorder()->mBorderSpacingX.GetUnit() == eStyleUnit_Coord, + "Not a coord value!"); + return GetStyleTableBorder()->mBorderSpacingX.GetCoordValue(); } // XXX: could cache this. But be sure to check style changes if you do! nscoord nsTableFrame::GetCellSpacingY() { - nscoord cellSpacing = 0; - if (!IsBorderCollapse()) { - const nsStyleTableBorder* tableStyle = GetStyleTableBorder(); - if (tableStyle->mBorderSpacingY.GetUnit() == eStyleUnit_Coord) { - cellSpacing = tableStyle->mBorderSpacingY.GetCoordValue(); - } - } - return cellSpacing; + if (IsBorderCollapse()) + return 0; + + NS_ASSERTION(GetStyleTableBorder()->mBorderSpacingY.GetUnit() == eStyleUnit_Coord, + "Not a coord value!"); + return GetStyleTableBorder()->mBorderSpacingY.GetCoordValue(); } /* ----- global methods ----- */ diff --git a/mozilla/layout/style/nsRuleNode.cpp b/mozilla/layout/style/nsRuleNode.cpp index dfd700f7e37..7d07eb09405 100644 --- a/mozilla/layout/style/nsRuleNode.cpp +++ b/mozilla/layout/style/nsRuleNode.cpp @@ -3841,24 +3841,14 @@ nsRuleNode::ComputeTableBorderData(nsStyleStruct* aStartStruct, table->mBorderCollapse = parentTable->mBorderCollapse; } - nsStyleCoord coord; - // border-spacing-x: length, inherit - if (SetCoord(tableData.mBorderSpacing.mXValue, coord, coord, SETCOORD_LENGTH, aContext, mPresContext, inherited)) { - table->mBorderSpacingX = coord.GetCoordValue(); - } - else if (eCSSUnit_Inherit == tableData.mBorderSpacing.mXValue.GetUnit()) { - inherited = PR_TRUE; - table->mBorderSpacingX = parentTable->mBorderSpacingX; - } + SetCoord(tableData.mBorderSpacing.mXValue, table->mBorderSpacingX, + parentTable->mBorderSpacingX, SETCOORD_LH, + aContext, mPresContext, inherited); // border-spacing-y: length, inherit - if (SetCoord(tableData.mBorderSpacing.mYValue, coord, coord, SETCOORD_LENGTH, aContext, mPresContext, inherited)) { - table->mBorderSpacingY = coord.GetCoordValue(); - } - else if (eCSSUnit_Inherit == tableData.mBorderSpacing.mYValue.GetUnit()) { - inherited = PR_TRUE; - table->mBorderSpacingY = parentTable->mBorderSpacingY; - } + SetCoord(tableData.mBorderSpacing.mYValue, table->mBorderSpacingY, + parentTable->mBorderSpacingY, SETCOORD_LH, + aContext, mPresContext, inherited); // caption-side: enum, inherit if (eCSSUnit_Enumerated == tableData.mCaptionSide.GetUnit()) { diff --git a/mozilla/layout/style/nsStyleStruct.cpp b/mozilla/layout/style/nsStyleStruct.cpp index 50955403066..029d181b458 100644 --- a/mozilla/layout/style/nsStyleStruct.cpp +++ b/mozilla/layout/style/nsStyleStruct.cpp @@ -1101,8 +1101,8 @@ nsStyleTableBorder::nsStyleTableBorder(nsPresContext* aPresContext) ? NS_STYLE_TABLE_EMPTY_CELLS_SHOW_BACKGROUND : NS_STYLE_TABLE_EMPTY_CELLS_SHOW; mCaptionSide = NS_SIDE_TOP; - mBorderSpacingX.Reset(); - mBorderSpacingY.Reset(); + mBorderSpacingX.SetCoordValue(0); + mBorderSpacingY.SetCoordValue(0); } nsStyleTableBorder::~nsStyleTableBorder(void) diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index a4def1c753b..76e9128d169 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -4026,27 +4026,23 @@ nsTableFrame::GetBorderPadding(const nsSize& aBasis, // XXX: could cache this. But be sure to check style changes if you do! nscoord nsTableFrame::GetCellSpacingX() { - nscoord cellSpacing = 0; - if (!IsBorderCollapse()) { - const nsStyleTableBorder* tableStyle = GetStyleTableBorder(); - if (tableStyle->mBorderSpacingX.GetUnit() == eStyleUnit_Coord) { - cellSpacing = tableStyle->mBorderSpacingX.GetCoordValue(); - } - } - return cellSpacing; + if (IsBorderCollapse()) + return 0; + + NS_ASSERTION(GetStyleTableBorder()->mBorderSpacingX.GetUnit() == eStyleUnit_Coord, + "Not a coord value!"); + return GetStyleTableBorder()->mBorderSpacingX.GetCoordValue(); } // XXX: could cache this. But be sure to check style changes if you do! nscoord nsTableFrame::GetCellSpacingY() { - nscoord cellSpacing = 0; - if (!IsBorderCollapse()) { - const nsStyleTableBorder* tableStyle = GetStyleTableBorder(); - if (tableStyle->mBorderSpacingY.GetUnit() == eStyleUnit_Coord) { - cellSpacing = tableStyle->mBorderSpacingY.GetCoordValue(); - } - } - return cellSpacing; + if (IsBorderCollapse()) + return 0; + + NS_ASSERTION(GetStyleTableBorder()->mBorderSpacingY.GetUnit() == eStyleUnit_Coord, + "Not a coord value!"); + return GetStyleTableBorder()->mBorderSpacingY.GetCoordValue(); } /* ----- global methods ----- */