bug 176423 - Consider overflowing children when calculating max element width. sr=kin, r=alexsavulov.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
20
layout/html/tests/block/bugs/176423.html
Normal file
20
layout/html/tests/block/bugs/176423.html
Normal 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%"> </td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user