diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp
index 69d2994bec3..a2c1e4c74ec 100644
--- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp
+++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp
@@ -16,7 +16,6 @@
* Reserved.
*/
-#include
#include "BasicTableLayoutStrategy.h"
#include "nsTableFrame.h"
#include "nsTableColFrame.h"
@@ -946,8 +945,12 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(nsIPresContext* aPresCo
{
PRInt32 colIndex = autoColumns[i];
nscoord oldColWidth = mTableFrame->GetColumnWidth(colIndex);
- float percent = (float)oldColWidth/(float)totalWidthOfAutoColumns;
- nscoord excessForThisColumn = excess*percent;
+ float percent;
+ if (0!=totalWidthOfAutoColumns)
+ percent = (float)oldColWidth/(float)totalWidthOfAutoColumns;
+ else
+ percent = (float)1/(float)numAutoColumns;
+ nscoord excessForThisColumn = (nscoord)(excess*percent);
nscoord colWidth = excessForThisColumn+oldColWidth;
if (gsDebug==PR_TRUE)
printf(" column %d was %d, now set to %d\n", colIndex, mTableFrame->GetColumnWidth(colIndex), colWidth);
diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp
index 5c4715ebac7..32d65141b02 100644
--- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp
@@ -367,6 +367,25 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
cellWidth = kidSize.width; // at this point, we've factored in the cell's style attributes
if (NS_UNCONSTRAINEDSIZE!=cellWidth)
cellWidth += leftInset + rightInset;
+ // Nav4 hack for 0 width cells. If the cell has any content, it must have a desired width of at least 1
+ if (0==cellWidth)
+ {
+ PRInt32 childCount;
+ mFirstChild->ChildCount(childCount);
+ if (0!=childCount)
+ {
+ nsIFrame *grandChild;
+ mFirstChild->FirstChild(grandChild);
+ grandChild->ChildCount(childCount);
+ if (0!=childCount)
+ {
+ cellWidth=1;
+ if (nsnull!=aDesiredSize.maxElementSize && 0==pMaxElementSize->width)
+ pMaxElementSize->width=1;
+ }
+ }
+ }
+ // end Nav4 hack for 0 width cells
// set the cell's desired size and max element size
aDesiredSize.width = cellWidth;
diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp
index 676acd42d0b..5ee03026a6e 100644
--- a/mozilla/layout/html/table/src/nsTableFrame.cpp
+++ b/mozilla/layout/html/table/src/nsTableFrame.cpp
@@ -2160,13 +2160,18 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
case eStyleUnit_Coord:
maxWidth = position->mWidth.GetCoordValue();
break;
+
+ case eStyleUnit_Auto:
+ maxWidth = aMaxSize.width;
+ break;
+
case eStyleUnit_Percent:
case eStyleUnit_Proportional:
+ case eStyleUnit_Inherit:
// XXX for now these fall through
default:
- case eStyleUnit_Auto:
- case eStyleUnit_Inherit:
+
maxWidth = aMaxSize.width;
break;
}
diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
index 69d2994bec3..a2c1e4c74ec 100644
--- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
+++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp
@@ -16,7 +16,6 @@
* Reserved.
*/
-#include
#include "BasicTableLayoutStrategy.h"
#include "nsTableFrame.h"
#include "nsTableColFrame.h"
@@ -946,8 +945,12 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(nsIPresContext* aPresCo
{
PRInt32 colIndex = autoColumns[i];
nscoord oldColWidth = mTableFrame->GetColumnWidth(colIndex);
- float percent = (float)oldColWidth/(float)totalWidthOfAutoColumns;
- nscoord excessForThisColumn = excess*percent;
+ float percent;
+ if (0!=totalWidthOfAutoColumns)
+ percent = (float)oldColWidth/(float)totalWidthOfAutoColumns;
+ else
+ percent = (float)1/(float)numAutoColumns;
+ nscoord excessForThisColumn = (nscoord)(excess*percent);
nscoord colWidth = excessForThisColumn+oldColWidth;
if (gsDebug==PR_TRUE)
printf(" column %d was %d, now set to %d\n", colIndex, mTableFrame->GetColumnWidth(colIndex), colWidth);
diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp
index 5c4715ebac7..32d65141b02 100644
--- a/mozilla/layout/tables/nsTableCellFrame.cpp
+++ b/mozilla/layout/tables/nsTableCellFrame.cpp
@@ -367,6 +367,25 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
cellWidth = kidSize.width; // at this point, we've factored in the cell's style attributes
if (NS_UNCONSTRAINEDSIZE!=cellWidth)
cellWidth += leftInset + rightInset;
+ // Nav4 hack for 0 width cells. If the cell has any content, it must have a desired width of at least 1
+ if (0==cellWidth)
+ {
+ PRInt32 childCount;
+ mFirstChild->ChildCount(childCount);
+ if (0!=childCount)
+ {
+ nsIFrame *grandChild;
+ mFirstChild->FirstChild(grandChild);
+ grandChild->ChildCount(childCount);
+ if (0!=childCount)
+ {
+ cellWidth=1;
+ if (nsnull!=aDesiredSize.maxElementSize && 0==pMaxElementSize->width)
+ pMaxElementSize->width=1;
+ }
+ }
+ }
+ // end Nav4 hack for 0 width cells
// set the cell's desired size and max element size
aDesiredSize.width = cellWidth;
diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp
index 676acd42d0b..5ee03026a6e 100644
--- a/mozilla/layout/tables/nsTableFrame.cpp
+++ b/mozilla/layout/tables/nsTableFrame.cpp
@@ -2160,13 +2160,18 @@ void nsTableFrame::BalanceColumnWidths(nsIPresContext* aPresContext,
case eStyleUnit_Coord:
maxWidth = position->mWidth.GetCoordValue();
break;
+
+ case eStyleUnit_Auto:
+ maxWidth = aMaxSize.width;
+ break;
+
case eStyleUnit_Percent:
case eStyleUnit_Proportional:
+ case eStyleUnit_Inherit:
// XXX for now these fall through
default:
- case eStyleUnit_Auto:
- case eStyleUnit_Inherit:
+
maxWidth = aMaxSize.width;
break;
}