From c85a6cdd73101ca6f0ab55f1f8ec30583f6490c0 Mon Sep 17 00:00:00 2001 From: "buster%netscape.com" Date: Tue, 8 Dec 1998 01:00:14 +0000 Subject: [PATCH] fixed a bug in table-layout:fixed mode fixed bug fixed a few small bugs --- layout/html/table/src/BasicTableLayoutStrategy.cpp | 12 ++++++------ layout/html/table/src/nsTableFrame.cpp | 2 ++ layout/tables/BasicTableLayoutStrategy.cpp | 12 ++++++------ layout/tables/nsTableFrame.cpp | 2 ++ 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/layout/html/table/src/BasicTableLayoutStrategy.cpp b/layout/html/table/src/BasicTableLayoutStrategy.cpp index 9ebcd9e9e3a2..ad35c59367da 100644 --- a/layout/html/table/src/BasicTableLayoutStrategy.cpp +++ b/layout/html/table/src/BasicTableLayoutStrategy.cpp @@ -853,12 +853,12 @@ PRBool BasicTableLayoutStrategy::BalanceProportionalColumns(const nsHTMLReflowSt result = BalanceColumnsTableFits(aReflowState, bigSpace, bigSpace, aTableSpecifiedWidth, aTableIsAutoWidth); } - else if (mMinTableWidth >= actualMaxWidth) + else if (mMinTableWidth > actualMaxWidth) { // the table doesn't fit in the available space if (gsDebug) printf (" * table minTW does not fit, calling BalanceColumnsTableDoesNotFit\n"); result = BalanceColumnsTableDoesNotFit(); } - else if (mMaxTableWidth < actualMaxWidth) + else if (mMaxTableWidth <= actualMaxWidth) { // the max width of the table fits comfortably in the available space if (gsDebug) printf (" * table desired size fits, calling BalanceColumnsTableFits\n"); result = BalanceColumnsTableFits(aReflowState, aAvailWidth, @@ -1831,7 +1831,7 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsHTMLReflowSt nsSize cellMinSize = cellFrame->GetPass1MaxElementSize(); nsSize cellDesiredSize = cellFrame->GetPass1DesiredSize(); - nscoord cellMinWidth=colFrame->GetMinColWidth(); + nscoord cellMinWidth=colFrame->GetAdjustedMinColWidth(); nscoord cellDesiredWidth=colFrame->GetMaxColWidth(); if (1==colSpan) { @@ -2133,7 +2133,7 @@ void BasicTableLayoutStrategy::DistributeRemainingSpace(nscoord aTableSpecified if (kRecursionLimit<=aRecursionControl) // only allow kRecursionLimit iterations, as per Nav4. See laytable.c return; nscoord sumOfMinWidths = 0; // sum of min widths of each auto column - nscoord aStartingComputedTableWidth = aComputedTableWidth; // remember this so we can see if we're making any progress + nscoord startingComputedTableWidth = aComputedTableWidth; // remember this so we can see if we're making any progress if (PR_TRUE==gsDebug) printf ("DistributeRemainingSpace: fixed width %d > computed table width %d\n", aTableSpecifiedWidth, aComputedTableWidth); @@ -2190,7 +2190,7 @@ void BasicTableLayoutStrategy::DistributeRemainingSpace(nscoord aTableSpecified percent = ((float)maxEffectiveColWidth)/((float)totalEffectiveWidthOfAutoColumns); else percent = ((float)1)/((float)numColumnsToBeResized); - nscoord colWidth = startingColWidth + (nscoord)(availWidth*percent); + nscoord colWidth = startingColWidth + NSToCoordRound(((float)(availWidth))*percent); if (PR_TRUE==gsDebug) printf(" colWidth = %d from startingColWidth %d plus %d percent of availWidth %d\n", colWidth, startingColWidth, (nscoord)((float)100*percent), availWidth); @@ -2208,7 +2208,7 @@ void BasicTableLayoutStrategy::DistributeRemainingSpace(nscoord aTableSpecified } } - if (aComputedTableWidth!=aStartingComputedTableWidth) + if (aComputedTableWidth!=startingComputedTableWidth) { // othewise we made no progress and shouldn't continue if (aComputedTableWidth= actualMaxWidth) + else if (mMinTableWidth > actualMaxWidth) { // the table doesn't fit in the available space if (gsDebug) printf (" * table minTW does not fit, calling BalanceColumnsTableDoesNotFit\n"); result = BalanceColumnsTableDoesNotFit(); } - else if (mMaxTableWidth < actualMaxWidth) + else if (mMaxTableWidth <= actualMaxWidth) { // the max width of the table fits comfortably in the available space if (gsDebug) printf (" * table desired size fits, calling BalanceColumnsTableFits\n"); result = BalanceColumnsTableFits(aReflowState, aAvailWidth, @@ -1831,7 +1831,7 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsHTMLReflowSt nsSize cellMinSize = cellFrame->GetPass1MaxElementSize(); nsSize cellDesiredSize = cellFrame->GetPass1DesiredSize(); - nscoord cellMinWidth=colFrame->GetMinColWidth(); + nscoord cellMinWidth=colFrame->GetAdjustedMinColWidth(); nscoord cellDesiredWidth=colFrame->GetMaxColWidth(); if (1==colSpan) { @@ -2133,7 +2133,7 @@ void BasicTableLayoutStrategy::DistributeRemainingSpace(nscoord aTableSpecified if (kRecursionLimit<=aRecursionControl) // only allow kRecursionLimit iterations, as per Nav4. See laytable.c return; nscoord sumOfMinWidths = 0; // sum of min widths of each auto column - nscoord aStartingComputedTableWidth = aComputedTableWidth; // remember this so we can see if we're making any progress + nscoord startingComputedTableWidth = aComputedTableWidth; // remember this so we can see if we're making any progress if (PR_TRUE==gsDebug) printf ("DistributeRemainingSpace: fixed width %d > computed table width %d\n", aTableSpecifiedWidth, aComputedTableWidth); @@ -2190,7 +2190,7 @@ void BasicTableLayoutStrategy::DistributeRemainingSpace(nscoord aTableSpecified percent = ((float)maxEffectiveColWidth)/((float)totalEffectiveWidthOfAutoColumns); else percent = ((float)1)/((float)numColumnsToBeResized); - nscoord colWidth = startingColWidth + (nscoord)(availWidth*percent); + nscoord colWidth = startingColWidth + NSToCoordRound(((float)(availWidth))*percent); if (PR_TRUE==gsDebug) printf(" colWidth = %d from startingColWidth %d plus %d percent of availWidth %d\n", colWidth, startingColWidth, (nscoord)((float)100*percent), availWidth); @@ -2208,7 +2208,7 @@ void BasicTableLayoutStrategy::DistributeRemainingSpace(nscoord aTableSpecified } } - if (aComputedTableWidth!=aStartingComputedTableWidth) + if (aComputedTableWidth!=startingComputedTableWidth) { // othewise we made no progress and shouldn't continue if (aComputedTableWidth