gecko-dev/layout/reftests/floats/1236745-1.html
L. David Baron 82aa75776d Bug 1236745 - Fix infinite loop resulting from block formatting context entering resize oscillation due to considering floats over its whole height when sizing it. r=dholbert
What's happening here is that we enter an infinite loop by oscillating
between two states.  The code assumes that (a) the available space will
never grow, only stay the same or shrink, and (b) that we should break
out of the loop if it stays the same.  This also means we hit the
assertion about the available space growing every other time through the
loop.

This is in the inner loop in nsBlockFrame::ReflowBlockFrame that was
introduced in https://hg.mozilla.org/mozilla-central/rev/80ef9bb2c2e9 .

The problem is fundamentally a logic error in that code.  The makes the
assumption that if you reduce the width available to a block formatting
context or replaced block-level element, its height does not shrink.
(The "replaced block" (really block formatting context) in this case, as
in the original testcase, is a scroll frame.  I didn't debug the
original testcase enough to figure out what caused its sizing
characteristics, although a percentage-width image does seem like the
most likely candidate.)

Without the patch, the reftest test (but not reference) hangs, as does
the semi-simplified test in the bug (given a narrow window).

With the patch, neither the semi-simplified test in the bug nor the
reference hangs, and the reftest passes.

--HG--
extra : commitid : APy8PfXlvvz
2016-02-04 09:41:44 +11:00

50 lines
792 B
HTML

<!DOCTYPE HTML>
<title>Reftest, bug 1236745</title>
<style>
div.contain {
border: medium solid blue;
width: 100px;
height: 200px;
}
.float1 {
float: left;
background: yellow;
width: 10px;
height: 60px;
}
.float2 {
float: left; clear: left;
background: aqua;
width: 50px;
height: 50px;
}
.bfc {
overflow: hidden;
background: fuchsia;
/*
* Will be 90px wide (and thus 90px high) if placed based on only its
* top or based on a 50px height, but 50px wide (and thus 50px high)
* if placed based on a 90px height.
*/
}
img {
width: 100%;
display: block;
}
</style>
<div class="contain">
<div class="float1"></div>
<div class="float2"></div>
<div class="bfc">
<img src="../bugs/solidblue.png"> <!-- 16x16 blue image -->
</div>
</div>