Fix tests to match what they should have been testing, and fix nsFloatManager behavior to match what the old code actually did as far as considering floats at the side that did not protrude into the containing block. (Bug 472252) r+sr=roc

This commit is contained in:
L. David Baron 2009-01-06 15:21:00 -08:00
parent bc3a0d9070
commit 03885eb173
10 changed files with 61 additions and 12 deletions

View File

@ -200,7 +200,6 @@ nsFloatManager::GetBand(nscoord aYOffset,
}
} else if (floatBottom > top) {
// This float is in our band.
haveFloats = PR_TRUE;
// Shrink our band's height if needed.
if (floatBottom < bottom) {
@ -213,12 +212,19 @@ nsFloatManager::GetBand(nscoord aYOffset,
nscoord rightEdge = fi.mRect.XMost();
if (rightEdge > left) {
left = rightEdge;
// Only set haveFloats to true if the float is inside our
// containing block. This matches the spec for what some
// callers want and disagrees for other callers, so we should
// probably provide better information at some point.
haveFloats = PR_TRUE;
}
} else {
// A right float.
nscoord leftEdge = fi.mRect.x;
if (leftEdge < right) {
right = leftEdge;
// See above.
haveFloats = PR_TRUE;
}
}
}

View File

@ -0,0 +1,21 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Testcase, bug 472252</title>
<style type="text/css">
#wrap {width:600px; border:1px solid;position:relative}
.a {background:lime; color:#fff; width:80%;}
.b {position:absolute; right:0; width:18%; background: cyan; color: #000; height:10em;}
textarea {width: 100%; height:10em;}
</style>
<title>test</title>
</head>
<body>
<div id="wrap">
<div class="b"></div>
<div class="a"><textarea></textarea></div>
</div>
</body>
</html>

View File

@ -0,0 +1,21 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Testcase, bug 472252</title>
<style type="text/css">
#wrap {width:600px; border:1px solid;}
.a {background:lime; color:#fff; width:80%;}
.b {float:right; width:18%; background: cyan; color: #000; height:10em;}
textarea {width: 100%; height:10em;}
</style>
<title>test</title>
</head>
<body>
<div id="wrap">
<div class="b"></div>
<div class="a"><textarea></textarea></div>
</div>
</body>
</html>

View File

@ -2,5 +2,5 @@
<title>Test for float placement around other float in BFC but outside containing block</title>
<div style="float: left; width: 500px; height: 500px">
<div style="height: 10px; background: blue"></div>
<div style="width: 425px; height: 10px; background: blue"></div>
</div>

View File

@ -13,7 +13,7 @@
<!-- the block formatting context inside which we're testing -->
<div style="float: left; width: 500px; height: 500px">
<div style="float: right: width: 50px; height: 300px"></div>
<div style="float: right; width: 50px; height: 300px"></div>
<div style="margin-right: 100px"> <!-- 400px wide -->

View File

@ -1,5 +1,5 @@
<!DOCTYPE HTML>
<title>Test for float placement around other float in BFC but outside containing block</title>
<div style="float: left; width: 500px; height: 500px">
<div style="margin-left: 75px; width: 425px; height: 10px; background: blue"></div>
<div style="margin-left: 75px; width: 425px; height: 10px; background: blue"></div>
</div>

View File

@ -13,7 +13,7 @@
<!-- the block formatting context inside which we're testing -->
<div style="float: left; width: 500px; height: 500px">
<div style="float: left: width: 50px; height: 300px"></div>
<div style="float: left; width: 50px; height: 300px"></div>
<div style="margin-left: 100px"> <!-- 400px wide -->

View File

@ -15,7 +15,7 @@
<!-- the block formatting context inside which we're testing -->
<div style="float: left; width: 500px; height: 500px">
<div style="float: left: width: 50px; height: 300px"></div>
<div style="float: left; width: 50px; height: 300px"></div>
<div style="margin-left: 100px"> <!-- 400px wide -->

View File

@ -15,7 +15,7 @@
<!-- the block formatting context inside which we're testing -->
<div style="float: left; width: 500px; height: 500px">
<div style="float: right: width: 50px; height: 300px"></div>
<div style="float: right; width: 50px; height: 300px"></div>
<div style="margin-right: 100px"> <!-- 400px wide -->

View File

@ -1,7 +1,8 @@
# It's possible the spec should change here...
fails == other-float-outside-rule-3-left.html other-float-outside-rule-3-left-ref.html
fails == other-float-outside-rule-3-right.html other-float-outside-rule-3-right-ref.html
== other-float-outside-rule-7-left.html other-float-outside-rule-7-left-ref.html
== other-float-outside-rule-7-right.html other-float-outside-rule-7-right-ref.html
== other-float-outside-rule-3-left.html other-float-outside-rule-3-left-ref.html
== other-float-outside-rule-3-right.html other-float-outside-rule-3-right-ref.html
# It's possible the spec should change here to match rule 3...
fails == other-float-outside-rule-7-left.html other-float-outside-rule-7-left-ref.html
fails == other-float-outside-rule-7-right.html other-float-outside-rule-7-right-ref.html
== float-outside-block-push.html float-outside-block-push-ref.html
fails == zero-height-float-base.html zero-height-float-ref.html
fails == zero-height-float.html zero-height-float-ref.html