From bdfaaa60a4eb0d8030386adbf17a350cbcd0f492 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Sat, 13 Jan 2007 01:08:18 +0000 Subject: [PATCH] Fix incorrectly placed PR_MAX(), since the span* values are additions to the base values. b=365173 r=bernd sr=bzbarsky git-svn-id: svn://10.0.0.236/trunk@218260 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/reftests/bugs/365173-1-ref.html | 7 ++++++ mozilla/layout/reftests/bugs/365173-1.html | 7 ++++++ mozilla/layout/reftests/reftest.list | 1 + .../tables/BasicTableLayoutStrategy.cpp | 25 ++++++++++++++----- mozilla/layout/tables/nsTableColFrame.cpp | 4 +++ 5 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 mozilla/layout/reftests/bugs/365173-1-ref.html create mode 100644 mozilla/layout/reftests/bugs/365173-1.html diff --git a/mozilla/layout/reftests/bugs/365173-1-ref.html b/mozilla/layout/reftests/bugs/365173-1-ref.html new file mode 100644 index 00000000000..ac8a56190eb --- /dev/null +++ b/mozilla/layout/reftests/bugs/365173-1-ref.html @@ -0,0 +1,7 @@ +Testcase, bug 365173 + + + + +
300 (2)
x
+ diff --git a/mozilla/layout/reftests/bugs/365173-1.html b/mozilla/layout/reftests/bugs/365173-1.html new file mode 100644 index 00000000000..f79f27f14f9 --- /dev/null +++ b/mozilla/layout/reftests/bugs/365173-1.html @@ -0,0 +1,7 @@ +Testcase, bug 365173 + + + + +
300 (2)
x
+ diff --git a/mozilla/layout/reftests/reftest.list b/mozilla/layout/reftests/reftest.list index e0b75a26536..4864a083baa 100644 --- a/mozilla/layout/reftests/reftest.list +++ b/mozilla/layout/reftests/reftest.list @@ -34,6 +34,7 @@ f== bugs/360065-1.html bugs/360065-1-ref.html # bug 18217 == bugs/364079-1.html bugs/364079-1-ref.html == bugs/364861-1.html bugs/364861-1-ref.html == bugs/364862-1.html bugs/364862-1-ref.html +== bugs/365173-1.html bugs/365173-1-ref.html # table-dom/ == table-dom/appendCells1.html table-dom/appendCells1-ref.html diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp index 52a617bbbb9..fe406e65692 100644 --- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp @@ -292,6 +292,12 @@ BasicTableLayoutStrategy::ComputeColumnIntrinsicWidths(nsIRenderingContext* aRen colFrame->AddPrefCoord(info.prefCoord, info.hasSpecifiedWidth); colFrame->AddPrefPercent(info.prefPercent); } +#ifdef DEBUG_dbaron_off + printf("table %p col %d nonspan: min=%d pref=%d spec=%d pct=%f\n", + mTableFrame, col, colFrame->GetMinCoord(), + colFrame->GetPrefCoord(), colFrame->GetHasSpecifiedCoord(), + colFrame->GetPrefPercent()); +#endif } #ifdef DEBUG_TABLE_STRATEGY printf("ComputeColumnIntrinsicWidths single\n"); @@ -431,12 +437,12 @@ BasicTableLayoutStrategy::ComputeColumnIntrinsicWidths(nsIRenderingContext* aRen // influence the result of GetPrefCoord, save the value as it // was during the loop over spanning cells before messing with // anything. - nscoord prefCoord = colFrame->GetPrefCoord(); - colFrame->AddMinCoord(colFrame->GetMinCoord() + - colFrame->GetSpanMinCoord()); - colFrame->AddPrefCoord(prefCoord + - PR_MAX(colFrame->GetSpanMinCoord(), - colFrame->GetSpanPrefCoord()), + nscoord newPref = + colFrame->GetPrefCoord() + colFrame->GetSpanPrefCoord(); + nscoord newMin = + colFrame->GetMinCoord() + colFrame->GetSpanMinCoord(); + colFrame->AddMinCoord(newMin); + colFrame->AddPrefCoord(PR_MAX(newPref, newMin), colFrame->GetHasSpecifiedCoord()); NS_ASSERTION(colFrame->GetMinCoord() <= colFrame->GetPrefCoord(), "min larger than pref"); @@ -445,6 +451,13 @@ BasicTableLayoutStrategy::ComputeColumnIntrinsicWidths(nsIRenderingContext* aRen colFrame->ResetSpanMinCoord(); colFrame->ResetSpanPrefCoord(); colFrame->ResetSpanPrefPercent(); + +#ifdef DEBUG_dbaron_off + printf("table %p col %d span %d: min=%d pref=%d spec=%d pct=%f\n", + mTableFrame, col, colSpan, colFrame->GetMinCoord(), + colFrame->GetPrefCoord(), colFrame->GetHasSpecifiedCoord(), + colFrame->GetPrefPercent()); +#endif } } diff --git a/mozilla/layout/tables/nsTableColFrame.cpp b/mozilla/layout/tables/nsTableColFrame.cpp index 814aa073a2b..9d17a0fc9ce 100644 --- a/mozilla/layout/tables/nsTableColFrame.cpp +++ b/mozilla/layout/tables/nsTableColFrame.cpp @@ -153,6 +153,10 @@ void nsTableColFrame::Dump(PRInt32 aIndent) printf(" anonymous-cell "); break; } + printf("\nm:%d c:%d p:%d sm:%d sc:%d sp:%d f:%d", + GetMinCoord(), GetPrefCoord(), GetPrefPercent(), + GetSpanMinCoord(), GetSpanPrefCoord(), GetSpanPrefPercent(), + GetFinalWidth()); printf("\n%s**END COL DUMP** ", indent); delete [] indent; }