Bug 1155880 part 2: Rename nsTableColFrame Get/Set/ResetFinalWidth methods to use "ISize" instead of "Width". r=jfkthame

This commit is contained in:
Daniel Holbert 2015-04-18 16:01:26 -07:00
parent 01eb8a1f3b
commit 978c294b7b
5 changed files with 29 additions and 29 deletions

View File

@ -1045,8 +1045,8 @@ BasicTableLayoutStrategy::DistributeWidthToColumns(nscoord aWidth,
break; break;
case BTLS_FINAL_WIDTH: case BTLS_FINAL_WIDTH:
{ {
nscoord old_final = colFrame->GetFinalWidth(); nscoord old_final = colFrame->GetFinalISize();
colFrame->SetFinalWidth(col_width); colFrame->SetFinalISize(col_width);
if (old_final != col_width) if (old_final != col_width)
mTableFrame->DidResizeColumns(); mTableFrame->DidResizeColumns();

View File

@ -170,12 +170,12 @@ FixedTableLayoutStrategy::ComputeColumnISizes(const nsHTMLReflowState& aReflowSt
// border-spacing isn't part of the basis for percentages. // border-spacing isn't part of the basis for percentages.
tableWidth -= mTableFrame->GetColSpacing(-1, colCount); tableWidth -= mTableFrame->GetColSpacing(-1, colCount);
// store the old column widths. We might call multiple times SetFinalWidth // store the old column widths. We might call multiple times SetFinalISize
// on the columns, due to this we can't compare at the last call that the // 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 // width has changed with the respect to the last call to
// ComputeColumnISizes. In order to overcome this we store the old values // ComputeColumnISizes. In order to overcome this we store the old values
// in this array. A single call to SetFinalWidth would make it possible to // in this array. A single call to SetFinalISize would make it possible to
// call GetFinalWidth before and to compare when setting the final width. // call GetFinalISize before and to compare when setting the final width.
nsTArray<nscoord> oldColWidths; nsTArray<nscoord> oldColWidths;
// XXX This ignores the 'min-width' and 'max-width' properties // XXX This ignores the 'min-width' and 'max-width' properties
@ -203,7 +203,7 @@ FixedTableLayoutStrategy::ComputeColumnISizes(const nsHTMLReflowState& aReflowSt
NS_ERROR("column frames out of sync with cell map"); NS_ERROR("column frames out of sync with cell map");
continue; continue;
} }
oldColWidths.AppendElement(colFrame->GetFinalWidth()); oldColWidths.AppendElement(colFrame->GetFinalISize());
colFrame->ResetPrefPercent(); colFrame->ResetPrefPercent();
const nsStyleCoord *styleWidth = const nsStyleCoord *styleWidth =
&colFrame->StylePosition()->mWidth; &colFrame->StylePosition()->mWidth;
@ -294,7 +294,7 @@ FixedTableLayoutStrategy::ComputeColumnISizes(const nsHTMLReflowState& aReflowSt
} }
} }
colFrame->SetFinalWidth(colWidth); colFrame->SetFinalISize(colWidth);
if (colWidth == unassignedMarker) { if (colWidth == unassignedMarker) {
++unassignedCount; ++unassignedCount;
@ -317,12 +317,12 @@ FixedTableLayoutStrategy::ComputeColumnISizes(const nsHTMLReflowState& aReflowSt
NS_ERROR("column frames out of sync with cell map"); NS_ERROR("column frames out of sync with cell map");
continue; continue;
} }
nscoord colWidth = colFrame->GetFinalWidth(); nscoord colWidth = colFrame->GetFinalISize();
colWidth -= NSToCoordFloor(colFrame->GetPrefPercent() * colWidth -= NSToCoordFloor(colFrame->GetPrefPercent() *
reduceRatio); reduceRatio);
if (colWidth < 0) if (colWidth < 0)
colWidth = 0; colWidth = 0;
colFrame->SetFinalWidth(colWidth); colFrame->SetFinalISize(colWidth);
} }
} }
unassignedSpace = 0; unassignedSpace = 0;
@ -338,8 +338,8 @@ FixedTableLayoutStrategy::ComputeColumnISizes(const nsHTMLReflowState& aReflowSt
NS_ERROR("column frames out of sync with cell map"); NS_ERROR("column frames out of sync with cell map");
continue; continue;
} }
if (colFrame->GetFinalWidth() == unassignedMarker) if (colFrame->GetFinalISize() == unassignedMarker)
colFrame->SetFinalWidth(toAssign); colFrame->SetFinalISize(toAssign);
} }
} else if (unassignedSpace > 0) { } else if (unassignedSpace > 0) {
// The spec doesn't say how to distribute the unassigned space. // The spec doesn't say how to distribute the unassigned space.
@ -353,12 +353,12 @@ FixedTableLayoutStrategy::ComputeColumnISizes(const nsHTMLReflowState& aReflowSt
continue; continue;
} }
if (colFrame->GetPrefPercent() == 0.0f) { if (colFrame->GetPrefPercent() == 0.0f) {
NS_ASSERTION(colFrame->GetFinalWidth() <= specUndist, NS_ASSERTION(colFrame->GetFinalISize() <= specUndist,
"widths don't add up"); "widths don't add up");
nscoord toAdd = AllocateUnassigned(unassignedSpace, nscoord toAdd = AllocateUnassigned(unassignedSpace,
float(colFrame->GetFinalWidth()) / float(specUndist)); float(colFrame->GetFinalISize()) / float(specUndist));
specUndist -= colFrame->GetFinalWidth(); specUndist -= colFrame->GetFinalISize();
colFrame->SetFinalWidth(colFrame->GetFinalWidth() + toAdd); colFrame->SetFinalISize(colFrame->GetFinalISize() + toAdd);
unassignedSpace -= toAdd; unassignedSpace -= toAdd;
if (specUndist <= 0) { if (specUndist <= 0) {
NS_ASSERTION(specUndist == 0, NS_ASSERTION(specUndist == 0,
@ -386,7 +386,7 @@ FixedTableLayoutStrategy::ComputeColumnISizes(const nsHTMLReflowState& aReflowSt
} }
nscoord toAdd = AllocateUnassigned(unassignedSpace, nscoord toAdd = AllocateUnassigned(unassignedSpace,
colFrame->GetPrefPercent() / pctUndist); colFrame->GetPrefPercent() / pctUndist);
colFrame->SetFinalWidth(colFrame->GetFinalWidth() + toAdd); colFrame->SetFinalISize(colFrame->GetFinalISize() + toAdd);
unassignedSpace -= toAdd; unassignedSpace -= toAdd;
pctUndist -= colFrame->GetPrefPercent(); pctUndist -= colFrame->GetPrefPercent();
if (pctUndist <= 0.0f) { if (pctUndist <= 0.0f) {
@ -403,10 +403,10 @@ FixedTableLayoutStrategy::ComputeColumnISizes(const nsHTMLReflowState& aReflowSt
NS_ERROR("column frames out of sync with cell map"); NS_ERROR("column frames out of sync with cell map");
continue; continue;
} }
NS_ASSERTION(colFrame->GetFinalWidth() == 0, "yikes"); NS_ASSERTION(colFrame->GetFinalISize() == 0, "yikes");
nscoord toAdd = AllocateUnassigned(unassignedSpace, nscoord toAdd = AllocateUnassigned(unassignedSpace,
1.0f / float(colsLeft)); 1.0f / float(colsLeft));
colFrame->SetFinalWidth(toAdd); colFrame->SetFinalISize(toAdd);
unassignedSpace -= toAdd; unassignedSpace -= toAdd;
--colsLeft; --colsLeft;
} }
@ -419,7 +419,7 @@ FixedTableLayoutStrategy::ComputeColumnISizes(const nsHTMLReflowState& aReflowSt
NS_ERROR("column frames out of sync with cell map"); NS_ERROR("column frames out of sync with cell map");
continue; continue;
} }
if (oldColWidths.ElementAt(col) != colFrame->GetFinalWidth()) { if (oldColWidths.ElementAt(col) != colFrame->GetFinalISize()) {
mTableFrame->DidResizeColumns(); mTableFrame->DidResizeColumns();
break; break;
} }

View File

@ -25,7 +25,7 @@ nsTableColFrame::nsTableColFrame(nsStyleContext* aContext) :
SetColType(eColContent); SetColType(eColContent);
ResetIntrinsics(); ResetIntrinsics();
ResetSpanIntrinsics(); ResetSpanIntrinsics();
ResetFinalWidth(); ResetFinalISize();
} }
nsTableColFrame::~nsTableColFrame() nsTableColFrame::~nsTableColFrame()
@ -142,7 +142,7 @@ void nsTableColFrame::Dump(int32_t aIndent)
mHasSpecifiedCoord ? 's' : 'u', mPrefPercent, mHasSpecifiedCoord ? 's' : 'u', mPrefPercent,
int32_t(mSpanMinCoord), int32_t(mSpanPrefCoord), int32_t(mSpanMinCoord), int32_t(mSpanPrefCoord),
mSpanPrefPercent, mSpanPrefPercent,
int32_t(GetFinalWidth())); int32_t(GetFinalISize()));
printf("\n%s**END COL DUMP** ", indent); printf("\n%s**END COL DUMP** ", indent);
delete [] indent; delete [] indent;
} }

View File

@ -254,14 +254,14 @@ public:
} }
// The final width of the column. // The final width of the column.
void ResetFinalWidth() { void ResetFinalISize() {
mFinalWidth = nscoord_MIN; // so we detect that it changed mFinalISize = nscoord_MIN; // so we detect that it changed
} }
void SetFinalWidth(nscoord aFinalWidth) { void SetFinalISize(nscoord aFinalISize) {
mFinalWidth = aFinalWidth; mFinalISize = aFinalISize;
} }
nscoord GetFinalWidth() { nscoord GetFinalISize() {
return mFinalWidth; return mFinalISize;
} }
virtual bool IsFrameOfType(uint32_t aFlags) const override virtual bool IsFrameOfType(uint32_t aFlags) const override
@ -288,7 +288,7 @@ protected:
// a separate array allocated only during // a separate array allocated only during
// BasicTableLayoutStrategy::ComputeColumnIntrinsicISizes (and only // BasicTableLayoutStrategy::ComputeColumnIntrinsicISizes (and only
// when colspans were present). // when colspans were present).
nscoord mFinalWidth; nscoord mFinalISize;
// the index of the column with respect to the whole table (starting at 0) // the index of the column with respect to the whole table (starting at 0)
// it should never be smaller then the start column index of the parent // it should never be smaller then the start column index of the parent

View File

@ -3545,7 +3545,7 @@ int32_t nsTableFrame::GetColumnWidth(int32_t aColIndex)
nsTableFrame* firstInFlow = static_cast<nsTableFrame*>(FirstInFlow()); nsTableFrame* firstInFlow = static_cast<nsTableFrame*>(FirstInFlow());
if (this == firstInFlow) { if (this == firstInFlow) {
nsTableColFrame* colFrame = GetColFrame(aColIndex); nsTableColFrame* colFrame = GetColFrame(aColIndex);
return colFrame ? colFrame->GetFinalWidth() : 0; return colFrame ? colFrame->GetFinalISize() : 0;
} }
return firstInFlow->GetColumnWidth(aColIndex); return firstInFlow->GetColumnWidth(aColIndex);
} }