bug 176423 - Consider overflowing children when calculating max element width. sr=kin, r=alexsavulov.

This commit is contained in:
karnaze@netscape.com
2003-01-19 20:25:29 +00:00
parent db7f4d244e
commit 68ecec4aa2
4 changed files with 37 additions and 2 deletions

View File

@@ -1294,6 +1294,13 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// When style defines the width use it for the max-element-width
// because we can't shrink any smaller.
maxWidth = aMetrics.width;
if (NS_STYLE_OVERFLOW_HIDDEN != aReflowState.mStyleDisplay->mOverflow) {
// Allow overflowed children to influence mes width to accomodate tables.
nscoord inset = (NS_STYLE_DIRECTION_LTR == aState.mReflowState.mStyleVisibility->mDirection)
? borderPadding.left
: borderPadding.right;
maxWidth = PR_MAX(inset + aState.mMaxElementWidth, aMetrics.width);
}
}
else {
nscoord computedWidth;
@@ -1527,7 +1534,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
if (aState.GetFlag(BRS_COMPUTEMAXWIDTH)) {
// We need to add in for the right border/padding
// XXXldb Why right and not left?
aMetrics.mMaximumWidth = aState.mMaximumWidth + borderPadding.right;
aMetrics.mMaximumWidth = PR_MAX(maxWidth, aState.mMaximumWidth + borderPadding.right);
#ifdef NOISY_MAXIMUM_WIDTH
printf("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth);
#endif

View File

@@ -1294,6 +1294,13 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// When style defines the width use it for the max-element-width
// because we can't shrink any smaller.
maxWidth = aMetrics.width;
if (NS_STYLE_OVERFLOW_HIDDEN != aReflowState.mStyleDisplay->mOverflow) {
// Allow overflowed children to influence mes width to accomodate tables.
nscoord inset = (NS_STYLE_DIRECTION_LTR == aState.mReflowState.mStyleVisibility->mDirection)
? borderPadding.left
: borderPadding.right;
maxWidth = PR_MAX(inset + aState.mMaxElementWidth, aMetrics.width);
}
}
else {
nscoord computedWidth;
@@ -1527,7 +1534,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
if (aState.GetFlag(BRS_COMPUTEMAXWIDTH)) {
// We need to add in for the right border/padding
// XXXldb Why right and not left?
aMetrics.mMaximumWidth = aState.mMaximumWidth + borderPadding.right;
aMetrics.mMaximumWidth = PR_MAX(maxWidth, aState.mMaximumWidth + borderPadding.right);
#ifdef NOISY_MAXIMUM_WIDTH
printf("nsBlockFrame::ComputeFinalSize block %p setting aMetrics.mMaximumWidth to %d\n", this, aMetrics.mMaximumWidth);
#endif

View File

@@ -0,0 +1,20 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<table border="1" width="785">
<tr>
<td width="4%">
<div style="width:50px; border:1px solid red">
<img src="../images/mozilla-banner.gif">
</div>
</td>
<td width="96%">&nbsp;</td>
</tr>
</table>
</body>
</html>

View File

@@ -200,4 +200,5 @@ file:///s:/mozilla/layout/html/tests/block/bugs/155333-2.html
file:///s:/mozilla/layout/html/tests/block/bugs/154741.html
file:///s:/mozilla/layout/html/tests/block/bugs/161644.html
file:///s:/mozilla/layout/html/tests/block/bugs/169620.html
file:///s:/mozilla/layout/html/tests/block/bugs/176423.html