From e79ebcce8a43890048b35adf88cbbddc6ddbe678 Mon Sep 17 00:00:00 2001 From: kipp Date: Wed, 15 Jul 1998 17:07:20 +0000 Subject: [PATCH] Handle unconstrained width during percentage width computations git-svn-id: svn://10.0.0.236/trunk@5606 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/html/style/src/nsCSSLayout.cpp | 16 ++++++++++++---- mozilla/layout/html/style/src/nsCSSLayout.cpp | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/mozilla/content/html/style/src/nsCSSLayout.cpp b/mozilla/content/html/style/src/nsCSSLayout.cpp index 42755c0a074..abb939dcc85 100644 --- a/mozilla/content/html/style/src/nsCSSLayout.cpp +++ b/mozilla/content/html/style/src/nsCSSLayout.cpp @@ -301,10 +301,18 @@ GetStyleDimension(nsIPresContext* aPresContext, nsIFrame* block = nsnull; rs->frame->QueryInterface(kBlockFrameCID, (void**) &block); if (nsnull != block) { - // We found the nearest containing block which defines what a - // percentage size is relative to. Use the width that it will - // reflow to as the basis for computing our width. - aResult = nscoord(rs->maxSize.width * aCoord.GetPercentValue()); + if (NS_UNCONSTRAINEDSIZE == rs->maxSize.width) { + // When we find an unconstrained block it means that pass1 + // table reflow is occuring. In this case the percentage + // value is unknown so assume it's epsilon for now. + aResult = 1; + } + else { + // We found the nearest containing block which defines what a + // percentage size is relative to. Use the width that it will + // reflow to as the basis for computing our width. + aResult = nscoord(rs->maxSize.width * aCoord.GetPercentValue()); + } rv = PR_TRUE; break; } diff --git a/mozilla/layout/html/style/src/nsCSSLayout.cpp b/mozilla/layout/html/style/src/nsCSSLayout.cpp index 42755c0a074..abb939dcc85 100644 --- a/mozilla/layout/html/style/src/nsCSSLayout.cpp +++ b/mozilla/layout/html/style/src/nsCSSLayout.cpp @@ -301,10 +301,18 @@ GetStyleDimension(nsIPresContext* aPresContext, nsIFrame* block = nsnull; rs->frame->QueryInterface(kBlockFrameCID, (void**) &block); if (nsnull != block) { - // We found the nearest containing block which defines what a - // percentage size is relative to. Use the width that it will - // reflow to as the basis for computing our width. - aResult = nscoord(rs->maxSize.width * aCoord.GetPercentValue()); + if (NS_UNCONSTRAINEDSIZE == rs->maxSize.width) { + // When we find an unconstrained block it means that pass1 + // table reflow is occuring. In this case the percentage + // value is unknown so assume it's epsilon for now. + aResult = 1; + } + else { + // We found the nearest containing block which defines what a + // percentage size is relative to. Use the width that it will + // reflow to as the basis for computing our width. + aResult = nscoord(rs->maxSize.width * aCoord.GetPercentValue()); + } rv = PR_TRUE; break; }