diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp
index ef13243f400..09e05353da4 100644
--- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp
+++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp
@@ -69,8 +69,6 @@ BasicTableLayoutStrategy::BasicTableLayoutStrategy(nsTableFrame *aFrame, PRBool
NS_ASSERTION(nsnull != aFrame, "bad frame arg");
mTableFrame = aFrame;
- mMinTableContentWidth = 0;
- mMaxTableContentWidth = 0;
mCellSpacingTotal = 0;
mIsNavQuirksMode = aIsNavQuirks;
}
@@ -90,8 +88,6 @@ PRBool BasicTableLayoutStrategy::Initialize(nsIPresContext* aPresContex
PRBool result = PR_TRUE;
// re-init instance variables
- mMinTableContentWidth = 0;
- mMaxTableContentWidth = 0;
mCellSpacingTotal = 0;
mCols = mTableFrame->GetEffectiveCOLSAttribute();
// assign the width of all fixed-width columns
@@ -117,14 +113,15 @@ BasicTableLayoutStrategy::SetMaxElementSize(nsSize* aMaxElementSize,
mTableFrame->GetTableBorder(borderPadding);
borderPadding += aPadding;
nscoord horBorderPadding = borderPadding.left + borderPadding.right;
+ nscoord minTableWidth = GetTableMinWidth();
if (tablePosition->mWidth.GetUnit() == eStyleUnit_Coord) {
aMaxElementSize->width = tablePosition->mWidth.GetCoordValue();
- if (mMinTableContentWidth + horBorderPadding > aMaxElementSize->width) {
- aMaxElementSize->width = mMinTableContentWidth + horBorderPadding;
+ if (minTableWidth + horBorderPadding > aMaxElementSize->width) {
+ aMaxElementSize->width = minTableWidth + horBorderPadding;
}
}
else {
- aMaxElementSize->width = mMinTableContentWidth + horBorderPadding;
+ aMaxElementSize->width = minTableWidth + horBorderPadding;
}
}
}
@@ -216,13 +213,14 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresCont
}
// if the max width available is less than the min content width for fixed table, we're done
- if (!tableIsAutoWidth && (maxWidth < mMinTableContentWidth)) {
+ nscoord minTableWidth = GetTableMinWidth();
+ if (!tableIsAutoWidth && (maxWidth < minTableWidth)) {
return BCW_Wrapup(aPresContext, this, mTableFrame, nsnull);
}
// if the max width available is less than the min content width for auto table
// that had no % cells/cols, we're done
- if (tableIsAutoWidth && (maxWidth < mMinTableContentWidth) && (0 == perAdjTableWidth)) {
+ if (tableIsAutoWidth && (maxWidth < minTableWidth) && (0 == perAdjTableWidth)) {
return BCW_Wrapup(aPresContext, this, mTableFrame, nsnull);
}
@@ -885,7 +883,6 @@ BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nsIPresContext*
nscoord minWidth = colFrame->GetMinWidth();
mTableFrame->SetColumnWidth(colX, minWidth);
}
- SetMinAndMaxTableContentWidths();
if (gsDebugAssign) {printf("AssignPrelimColWidths ex\n"); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);}
return rv;
@@ -1181,27 +1178,42 @@ BasicTableLayoutStrategy::AssignPercentageColumnWidths(nscoord aBasisIn,
return basis;
}
-void BasicTableLayoutStrategy::SetMinAndMaxTableContentWidths()
+nscoord BasicTableLayoutStrategy::GetTableMinWidth() const
{
- mMinTableContentWidth = 0;
- mMaxTableContentWidth = 0;
-
+ nscoord minWidth = 0;
nscoord spacingX = mTableFrame->GetCellSpacingX();
PRInt32 numCols = mTableFrame->GetColCount();
for (PRInt32 colX = 0; colX < numCols; colX++) {
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX);
- mMinTableContentWidth += colFrame->GetMinWidth();
- mMaxTableContentWidth += PR_MAX(colFrame->GetDesWidth(), colFrame->GetFixWidth());
+ minWidth += PR_MAX(colFrame->GetMinWidth(), colFrame->GetWidth(MIN_ADJ));
+ }
+ // if it is not a degenerate table, add the last spacing on the right
+ if (minWidth > 0) {
+ minWidth += spacingX;
+ }
+ return minWidth;
+}
+
+nscoord BasicTableLayoutStrategy::GetTableMaxWidth() const
+{
+ nscoord spacingX = mTableFrame->GetCellSpacingX();
+ PRInt32 numCols = mTableFrame->GetColCount();
+ nscoord maxWidth = 0;
+ for (PRInt32 colX = 0; colX < numCols; colX++) {
+ nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX);
+ nscoord max = PR_MAX(colFrame->GetDesWidth(), colFrame->GetFixWidth());
+ max = PR_MAX(max, colFrame->GetPctWidth());
+ max = PR_MAX(max, colFrame->GetWidth(MIN_PRO));
+ maxWidth += max;
if (mTableFrame->GetNumCellsOriginatingInCol(colX) > 0) {
- mMaxTableContentWidth += spacingX;
- mMinTableContentWidth += spacingX;
+ maxWidth += spacingX;
}
}
// if it is not a degenerate table, add the last spacing on the right
- if (mMinTableContentWidth > 0) {
- mMinTableContentWidth += spacingX;
- mMaxTableContentWidth += spacingX;
+ if (maxWidth > 0) {
+ maxWidth += spacingX;
}
+ return maxWidth;
}
// calculate totals by width type.
@@ -1783,8 +1795,8 @@ void BasicTableLayoutStrategy::Dump(PRInt32 aIndent)
printf("%s**START BASIC STRATEGY DUMP** table=%p cols=%X",
indent, mTableFrame, mCols);
- printf("\n%s minConWidth=%d maxConWidth=%d cellSpacing=%d propRatio=%.2f navQuirks=%d",
- indent, mMinTableContentWidth, mMaxTableContentWidth, mCellSpacingTotal, mMinToDesProportionRatio, mIsNavQuirksMode);
+ printf("\n%s cellSpacing=%d propRatio=%.2f navQuirks=%d",
+ indent, mCellSpacingTotal, mMinToDesProportionRatio, mIsNavQuirksMode);
printf(" **END BASIC STRATEGY DUMP** \n");
delete [] indent;
}
diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h
index c8afc5174e4..dfe006d8d5d 100644
--- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h
+++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.h
@@ -82,8 +82,8 @@ public:
nscoord aMaxWidth);
// these accessors are mostly for debugging purposes
- nscoord GetTableMinContentWidth() const;
- nscoord GetTableMaxContentWidth() const;
+ nscoord GetTableMinWidth() const;
+ nscoord GetTableMaxWidth() const;
nscoord GetCOLSAttribute() const;
void Dump(PRInt32 aIndent);
@@ -210,20 +210,11 @@ protected:
nsTableFrame * mTableFrame;
PRInt32 mCols;
// cached data
- nscoord mMinTableContentWidth; // the smallest size for the table (excluding border and padding)
- nscoord mMaxTableContentWidth; // the "natural" size for the table, if unconstrained (excluding border and padding)
nscoord mCellSpacingTotal; // all of the cellspacing for all of the cols
float mMinToDesProportionRatio;
PRPackedBool mIsNavQuirksMode;
};
-// these accessors are mostly for debugging purposes
-inline nscoord BasicTableLayoutStrategy::GetTableMinContentWidth() const
-{ return mMinTableContentWidth; };
-
-inline nscoord BasicTableLayoutStrategy::GetTableMaxContentWidth() const
-{ return mMaxTableContentWidth; };
-
inline nscoord BasicTableLayoutStrategy::GetCOLSAttribute() const
{ return mCols; };
diff --git a/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp
index 3ed6ebd863d..1fdce56dfa9 100644
--- a/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp
+++ b/mozilla/layout/html/table/src/FixedTableLayoutStrategy.cpp
@@ -197,9 +197,6 @@ FixedTableLayoutStrategy::AssignPreliminaryColumnWidths(nsIPresContext*
mTableFrame->SetColumnWidth(colX, colWidths[colX]);
}
- // min/max TW is min/max of (specified table width, sum of specified column(cell) widths)
- mMinTableContentWidth = mMaxTableContentWidth = totalColWidth;
-
// clean up
if (nsnull != colWidths) {
delete [] colWidths;
diff --git a/mozilla/layout/html/table/src/nsITableLayoutStrategy.h b/mozilla/layout/html/table/src/nsITableLayoutStrategy.h
index 05f999b9596..0b56eafbc88 100644
--- a/mozilla/layout/html/table/src/nsITableLayoutStrategy.h
+++ b/mozilla/layout/html/table/src/nsITableLayoutStrategy.h
@@ -72,7 +72,7 @@ public:
* the actual table width in a given situation will depend on the available size
* provided by the parent (especially for percent-width tables.)
*/
- virtual nscoord GetTableMaxContentWidth() const = 0;
+ virtual nscoord GetTableMaxWidth() const = 0;
/** return the computed minimum possible size of the table.
* this is the sum of the minimum sizes of the content taking into account table
@@ -80,7 +80,7 @@ public:
* the actual table width in a given situation will depend on the available size
* provided by the parent (especially for percent-width tables.)
*/
- virtual nscoord GetTableMinContentWidth() const = 0;
+ virtual nscoord GetTableMinWidth() const = 0;
/** return the value of the COLS attribute, used for balancing column widths */
virtual nscoord GetCOLSAttribute() const = 0;
diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp
index ad2d1fc1a21..c14220e3597 100644
--- a/mozilla/layout/html/table/src/nsTableFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableFrame.cpp
@@ -1666,7 +1666,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
if (isAutoOrPctWidth) {
// Ask the strategy for the natural width of the content area
- aDesiredSize.mMaximumWidth = mTableLayoutStrategy->GetTableMaxContentWidth();
+ aDesiredSize.mMaximumWidth = mTableLayoutStrategy->GetTableMaxWidth();
// Add in space for border
nsMargin border;
@@ -2796,18 +2796,14 @@ NS_METHOD nsTableFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
nscoord nsTableFrame::ComputeDesiredWidth(const nsHTMLReflowState& aReflowState) const
{
nscoord desiredWidth = aReflowState.availableWidth;
- // this is the biggest hack in the world. But there's no other rational way to handle nested percent tables
- const nsStylePosition* position;
- PRBool isNested = IsNested(aReflowState, position);
- if ((eReflowReason_Initial==aReflowState.reason) &&
- (isNested) && (eStyleUnit_Percent == position->mWidth.GetUnit())) {
+ if (NS_UNCONSTRAINEDSIZE == desiredWidth) {
nsITableLayoutStrategy* tableLayoutStrategy = mTableLayoutStrategy;
if (mPrevInFlow) {
// Get the table layout strategy from the first-in-flow
nsTableFrame* table = (nsTableFrame*)GetFirstInFlow();
tableLayoutStrategy = table->mTableLayoutStrategy;
}
- desiredWidth = tableLayoutStrategy->GetTableMaxContentWidth();
+ desiredWidth = tableLayoutStrategy->GetTableMaxWidth();
}
return desiredWidth;
}
@@ -4146,20 +4142,20 @@ nscoord nsTableFrame::GetMinCaptionWidth()
}
/** return the minimum width of the table. Return 0 if the min width is unknown. */
-nscoord nsTableFrame::GetMinTableContentWidth()
+nscoord nsTableFrame::GetMinTableWidth()
{
nscoord result = 0;
if (nsnull!=mTableLayoutStrategy)
- result = mTableLayoutStrategy->GetTableMinContentWidth();
+ result = mTableLayoutStrategy->GetTableMinWidth();
return result;
}
/** return the maximum width of the table. Return 0 if the max width is unknown. */
-nscoord nsTableFrame::GetMaxTableContentWidth()
+nscoord nsTableFrame::GetMaxTableWidth()
{
nscoord result = 0;
if (nsnull!=mTableLayoutStrategy)
- result = mTableLayoutStrategy->GetTableMaxContentWidth();
+ result = mTableLayoutStrategy->GetTableMaxWidth();
return result;
}
diff --git a/mozilla/layout/html/table/src/nsTableFrame.h b/mozilla/layout/html/table/src/nsTableFrame.h
index 3fa0e0a2ecf..89c48a176cc 100644
--- a/mozilla/layout/html/table/src/nsTableFrame.h
+++ b/mozilla/layout/html/table/src/nsTableFrame.h
@@ -793,13 +793,13 @@ public: /* ----- Cell Map public methods ----- */
/** return the minimum width of the table caption. Return 0 if there is no caption. */
nscoord GetMinCaptionWidth();
- /** return the minimum contend width of the table (excludes borders and padding).
+ /** return the minimum content width of the table (excludes borders and padding).
Return 0 if the min width is unknown. */
- nscoord GetMinTableContentWidth();
+ nscoord GetMinTableWidth();
/** return the maximum content width of the table (excludes borders and padding).
Return 0 if the max width is unknown. */
- nscoord GetMaxTableContentWidth();
+ nscoord GetMaxTableWidth();
/** compute the max-element-size for the table
* @param aMaxElementSize [OUT] width field set to the min legal width of the table
diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp
index 73ca343ab2e..4b08d56e5a4 100644
--- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp
@@ -1404,6 +1404,10 @@ nsTableRowGroupFrame::RecoverState(RowGroupReflowState& aReflowState,
nsIFrame* aKidFrame,
nsSize* aMaxElementSize)
{
+ nsTableFrame* tableFrame = nsnull;
+ nsTableFrame::GetTableFrame(this, tableFrame);
+ nscoord cellSpacingY = tableFrame->GetCellSpacingY();
+
// Walk the list of children looking for aKidFrame
for (nsIFrame* frame = mFrames.FirstChild(); frame; frame->GetNextSibling(&frame)) {
if (frame == aKidFrame) {
@@ -1413,7 +1417,7 @@ nsTableRowGroupFrame::RecoverState(RowGroupReflowState& aReflowState,
// Update the running y-offset
nsSize kidSize;
frame->GetSize(kidSize);
- aReflowState.y += kidSize.height;
+ aReflowState.y += cellSpacingY + kidSize.height;
// If our height is constrained then update the available height
if (PR_FALSE == aReflowState.unconstrainedHeight) {
diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
index ef13243f400..09e05353da4 100644
--- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
+++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
@@ -69,8 +69,6 @@ BasicTableLayoutStrategy::BasicTableLayoutStrategy(nsTableFrame *aFrame, PRBool
NS_ASSERTION(nsnull != aFrame, "bad frame arg");
mTableFrame = aFrame;
- mMinTableContentWidth = 0;
- mMaxTableContentWidth = 0;
mCellSpacingTotal = 0;
mIsNavQuirksMode = aIsNavQuirks;
}
@@ -90,8 +88,6 @@ PRBool BasicTableLayoutStrategy::Initialize(nsIPresContext* aPresContex
PRBool result = PR_TRUE;
// re-init instance variables
- mMinTableContentWidth = 0;
- mMaxTableContentWidth = 0;
mCellSpacingTotal = 0;
mCols = mTableFrame->GetEffectiveCOLSAttribute();
// assign the width of all fixed-width columns
@@ -117,14 +113,15 @@ BasicTableLayoutStrategy::SetMaxElementSize(nsSize* aMaxElementSize,
mTableFrame->GetTableBorder(borderPadding);
borderPadding += aPadding;
nscoord horBorderPadding = borderPadding.left + borderPadding.right;
+ nscoord minTableWidth = GetTableMinWidth();
if (tablePosition->mWidth.GetUnit() == eStyleUnit_Coord) {
aMaxElementSize->width = tablePosition->mWidth.GetCoordValue();
- if (mMinTableContentWidth + horBorderPadding > aMaxElementSize->width) {
- aMaxElementSize->width = mMinTableContentWidth + horBorderPadding;
+ if (minTableWidth + horBorderPadding > aMaxElementSize->width) {
+ aMaxElementSize->width = minTableWidth + horBorderPadding;
}
}
else {
- aMaxElementSize->width = mMinTableContentWidth + horBorderPadding;
+ aMaxElementSize->width = minTableWidth + horBorderPadding;
}
}
}
@@ -216,13 +213,14 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresCont
}
// if the max width available is less than the min content width for fixed table, we're done
- if (!tableIsAutoWidth && (maxWidth < mMinTableContentWidth)) {
+ nscoord minTableWidth = GetTableMinWidth();
+ if (!tableIsAutoWidth && (maxWidth < minTableWidth)) {
return BCW_Wrapup(aPresContext, this, mTableFrame, nsnull);
}
// if the max width available is less than the min content width for auto table
// that had no % cells/cols, we're done
- if (tableIsAutoWidth && (maxWidth < mMinTableContentWidth) && (0 == perAdjTableWidth)) {
+ if (tableIsAutoWidth && (maxWidth < minTableWidth) && (0 == perAdjTableWidth)) {
return BCW_Wrapup(aPresContext, this, mTableFrame, nsnull);
}
@@ -885,7 +883,6 @@ BasicTableLayoutStrategy::AssignPreliminaryColumnWidths(nsIPresContext*
nscoord minWidth = colFrame->GetMinWidth();
mTableFrame->SetColumnWidth(colX, minWidth);
}
- SetMinAndMaxTableContentWidths();
if (gsDebugAssign) {printf("AssignPrelimColWidths ex\n"); mTableFrame->Dump(aPresContext, PR_FALSE, PR_TRUE, PR_FALSE);}
return rv;
@@ -1181,27 +1178,42 @@ BasicTableLayoutStrategy::AssignPercentageColumnWidths(nscoord aBasisIn,
return basis;
}
-void BasicTableLayoutStrategy::SetMinAndMaxTableContentWidths()
+nscoord BasicTableLayoutStrategy::GetTableMinWidth() const
{
- mMinTableContentWidth = 0;
- mMaxTableContentWidth = 0;
-
+ nscoord minWidth = 0;
nscoord spacingX = mTableFrame->GetCellSpacingX();
PRInt32 numCols = mTableFrame->GetColCount();
for (PRInt32 colX = 0; colX < numCols; colX++) {
nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX);
- mMinTableContentWidth += colFrame->GetMinWidth();
- mMaxTableContentWidth += PR_MAX(colFrame->GetDesWidth(), colFrame->GetFixWidth());
+ minWidth += PR_MAX(colFrame->GetMinWidth(), colFrame->GetWidth(MIN_ADJ));
+ }
+ // if it is not a degenerate table, add the last spacing on the right
+ if (minWidth > 0) {
+ minWidth += spacingX;
+ }
+ return minWidth;
+}
+
+nscoord BasicTableLayoutStrategy::GetTableMaxWidth() const
+{
+ nscoord spacingX = mTableFrame->GetCellSpacingX();
+ PRInt32 numCols = mTableFrame->GetColCount();
+ nscoord maxWidth = 0;
+ for (PRInt32 colX = 0; colX < numCols; colX++) {
+ nsTableColFrame* colFrame = mTableFrame->GetColFrame(colX);
+ nscoord max = PR_MAX(colFrame->GetDesWidth(), colFrame->GetFixWidth());
+ max = PR_MAX(max, colFrame->GetPctWidth());
+ max = PR_MAX(max, colFrame->GetWidth(MIN_PRO));
+ maxWidth += max;
if (mTableFrame->GetNumCellsOriginatingInCol(colX) > 0) {
- mMaxTableContentWidth += spacingX;
- mMinTableContentWidth += spacingX;
+ maxWidth += spacingX;
}
}
// if it is not a degenerate table, add the last spacing on the right
- if (mMinTableContentWidth > 0) {
- mMinTableContentWidth += spacingX;
- mMaxTableContentWidth += spacingX;
+ if (maxWidth > 0) {
+ maxWidth += spacingX;
}
+ return maxWidth;
}
// calculate totals by width type.
@@ -1783,8 +1795,8 @@ void BasicTableLayoutStrategy::Dump(PRInt32 aIndent)
printf("%s**START BASIC STRATEGY DUMP** table=%p cols=%X",
indent, mTableFrame, mCols);
- printf("\n%s minConWidth=%d maxConWidth=%d cellSpacing=%d propRatio=%.2f navQuirks=%d",
- indent, mMinTableContentWidth, mMaxTableContentWidth, mCellSpacingTotal, mMinToDesProportionRatio, mIsNavQuirksMode);
+ printf("\n%s cellSpacing=%d propRatio=%.2f navQuirks=%d",
+ indent, mCellSpacingTotal, mMinToDesProportionRatio, mIsNavQuirksMode);
printf(" **END BASIC STRATEGY DUMP** \n");
delete [] indent;
}
diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.h b/mozilla/layout/tables/BasicTableLayoutStrategy.h
index c8afc5174e4..dfe006d8d5d 100644
--- a/mozilla/layout/tables/BasicTableLayoutStrategy.h
+++ b/mozilla/layout/tables/BasicTableLayoutStrategy.h
@@ -82,8 +82,8 @@ public:
nscoord aMaxWidth);
// these accessors are mostly for debugging purposes
- nscoord GetTableMinContentWidth() const;
- nscoord GetTableMaxContentWidth() const;
+ nscoord GetTableMinWidth() const;
+ nscoord GetTableMaxWidth() const;
nscoord GetCOLSAttribute() const;
void Dump(PRInt32 aIndent);
@@ -210,20 +210,11 @@ protected:
nsTableFrame * mTableFrame;
PRInt32 mCols;
// cached data
- nscoord mMinTableContentWidth; // the smallest size for the table (excluding border and padding)
- nscoord mMaxTableContentWidth; // the "natural" size for the table, if unconstrained (excluding border and padding)
nscoord mCellSpacingTotal; // all of the cellspacing for all of the cols
float mMinToDesProportionRatio;
PRPackedBool mIsNavQuirksMode;
};
-// these accessors are mostly for debugging purposes
-inline nscoord BasicTableLayoutStrategy::GetTableMinContentWidth() const
-{ return mMinTableContentWidth; };
-
-inline nscoord BasicTableLayoutStrategy::GetTableMaxContentWidth() const
-{ return mMaxTableContentWidth; };
-
inline nscoord BasicTableLayoutStrategy::GetCOLSAttribute() const
{ return mCols; };
diff --git a/mozilla/layout/tables/FixedTableLayoutStrategy.cpp b/mozilla/layout/tables/FixedTableLayoutStrategy.cpp
index 3ed6ebd863d..1fdce56dfa9 100644
--- a/mozilla/layout/tables/FixedTableLayoutStrategy.cpp
+++ b/mozilla/layout/tables/FixedTableLayoutStrategy.cpp
@@ -197,9 +197,6 @@ FixedTableLayoutStrategy::AssignPreliminaryColumnWidths(nsIPresContext*
mTableFrame->SetColumnWidth(colX, colWidths[colX]);
}
- // min/max TW is min/max of (specified table width, sum of specified column(cell) widths)
- mMinTableContentWidth = mMaxTableContentWidth = totalColWidth;
-
// clean up
if (nsnull != colWidths) {
delete [] colWidths;
diff --git a/mozilla/layout/tables/nsITableLayoutStrategy.h b/mozilla/layout/tables/nsITableLayoutStrategy.h
index 05f999b9596..0b56eafbc88 100644
--- a/mozilla/layout/tables/nsITableLayoutStrategy.h
+++ b/mozilla/layout/tables/nsITableLayoutStrategy.h
@@ -72,7 +72,7 @@ public:
* the actual table width in a given situation will depend on the available size
* provided by the parent (especially for percent-width tables.)
*/
- virtual nscoord GetTableMaxContentWidth() const = 0;
+ virtual nscoord GetTableMaxWidth() const = 0;
/** return the computed minimum possible size of the table.
* this is the sum of the minimum sizes of the content taking into account table
@@ -80,7 +80,7 @@ public:
* the actual table width in a given situation will depend on the available size
* provided by the parent (especially for percent-width tables.)
*/
- virtual nscoord GetTableMinContentWidth() const = 0;
+ virtual nscoord GetTableMinWidth() const = 0;
/** return the value of the COLS attribute, used for balancing column widths */
virtual nscoord GetCOLSAttribute() const = 0;
diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp
index ad2d1fc1a21..c14220e3597 100644
--- a/mozilla/layout/tables/nsTableFrame.cpp
+++ b/mozilla/layout/tables/nsTableFrame.cpp
@@ -1666,7 +1666,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
if (isAutoOrPctWidth) {
// Ask the strategy for the natural width of the content area
- aDesiredSize.mMaximumWidth = mTableLayoutStrategy->GetTableMaxContentWidth();
+ aDesiredSize.mMaximumWidth = mTableLayoutStrategy->GetTableMaxWidth();
// Add in space for border
nsMargin border;
@@ -2796,18 +2796,14 @@ NS_METHOD nsTableFrame::IR_TargetIsChild(nsIPresContext* aPresContext,
nscoord nsTableFrame::ComputeDesiredWidth(const nsHTMLReflowState& aReflowState) const
{
nscoord desiredWidth = aReflowState.availableWidth;
- // this is the biggest hack in the world. But there's no other rational way to handle nested percent tables
- const nsStylePosition* position;
- PRBool isNested = IsNested(aReflowState, position);
- if ((eReflowReason_Initial==aReflowState.reason) &&
- (isNested) && (eStyleUnit_Percent == position->mWidth.GetUnit())) {
+ if (NS_UNCONSTRAINEDSIZE == desiredWidth) {
nsITableLayoutStrategy* tableLayoutStrategy = mTableLayoutStrategy;
if (mPrevInFlow) {
// Get the table layout strategy from the first-in-flow
nsTableFrame* table = (nsTableFrame*)GetFirstInFlow();
tableLayoutStrategy = table->mTableLayoutStrategy;
}
- desiredWidth = tableLayoutStrategy->GetTableMaxContentWidth();
+ desiredWidth = tableLayoutStrategy->GetTableMaxWidth();
}
return desiredWidth;
}
@@ -4146,20 +4142,20 @@ nscoord nsTableFrame::GetMinCaptionWidth()
}
/** return the minimum width of the table. Return 0 if the min width is unknown. */
-nscoord nsTableFrame::GetMinTableContentWidth()
+nscoord nsTableFrame::GetMinTableWidth()
{
nscoord result = 0;
if (nsnull!=mTableLayoutStrategy)
- result = mTableLayoutStrategy->GetTableMinContentWidth();
+ result = mTableLayoutStrategy->GetTableMinWidth();
return result;
}
/** return the maximum width of the table. Return 0 if the max width is unknown. */
-nscoord nsTableFrame::GetMaxTableContentWidth()
+nscoord nsTableFrame::GetMaxTableWidth()
{
nscoord result = 0;
if (nsnull!=mTableLayoutStrategy)
- result = mTableLayoutStrategy->GetTableMaxContentWidth();
+ result = mTableLayoutStrategy->GetTableMaxWidth();
return result;
}
diff --git a/mozilla/layout/tables/nsTableFrame.h b/mozilla/layout/tables/nsTableFrame.h
index 3fa0e0a2ecf..89c48a176cc 100644
--- a/mozilla/layout/tables/nsTableFrame.h
+++ b/mozilla/layout/tables/nsTableFrame.h
@@ -793,13 +793,13 @@ public: /* ----- Cell Map public methods ----- */
/** return the minimum width of the table caption. Return 0 if there is no caption. */
nscoord GetMinCaptionWidth();
- /** return the minimum contend width of the table (excludes borders and padding).
+ /** return the minimum content width of the table (excludes borders and padding).
Return 0 if the min width is unknown. */
- nscoord GetMinTableContentWidth();
+ nscoord GetMinTableWidth();
/** return the maximum content width of the table (excludes borders and padding).
Return 0 if the max width is unknown. */
- nscoord GetMaxTableContentWidth();
+ nscoord GetMaxTableWidth();
/** compute the max-element-size for the table
* @param aMaxElementSize [OUT] width field set to the min legal width of the table
diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp
index 73ca343ab2e..4b08d56e5a4 100644
--- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp
+++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp
@@ -1404,6 +1404,10 @@ nsTableRowGroupFrame::RecoverState(RowGroupReflowState& aReflowState,
nsIFrame* aKidFrame,
nsSize* aMaxElementSize)
{
+ nsTableFrame* tableFrame = nsnull;
+ nsTableFrame::GetTableFrame(this, tableFrame);
+ nscoord cellSpacingY = tableFrame->GetCellSpacingY();
+
// Walk the list of children looking for aKidFrame
for (nsIFrame* frame = mFrames.FirstChild(); frame; frame->GetNextSibling(&frame)) {
if (frame == aKidFrame) {
@@ -1413,7 +1417,7 @@ nsTableRowGroupFrame::RecoverState(RowGroupReflowState& aReflowState,
// Update the running y-offset
nsSize kidSize;
frame->GetSize(kidSize);
- aReflowState.y += kidSize.height;
+ aReflowState.y += cellSpacingY + kidSize.height;
// If our height is constrained then update the available height
if (PR_FALSE == aReflowState.unconstrainedHeight) {