Handle unconstrained width during percentage width computations

git-svn-id: svn://10.0.0.236/trunk@5606 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kipp
1998-07-15 17:07:20 +00:00
parent ff251ca05b
commit e79ebcce8a
2 changed files with 24 additions and 8 deletions

View File

@@ -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;
}