Bug 406484. Do RecoverStateFrom for not-dirty inline lines containing floats when willReflowAgain is true, because the floats must be moved by deltaY. r+sr=dbaron

This commit is contained in:
roc+%cs.cmu.edu 2007-12-04 01:30:50 +00:00
Родитель 16482030d2
Коммит e34d0a225e
4 изменённых файлов: 48 добавлений и 11 удалений

Просмотреть файл

@ -1948,17 +1948,19 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
else
repositionViews = PR_TRUE;
if (willReflowAgain) {
NS_ASSERTION(!line->IsDirty() || !line->HasFloats(),
"Possibly stale float cache here!");
// If we're going to reflow everything again, and this line has no
// cached floats, then there is no need to recover float state. The line
// may be a block that contains other lines with floats, but in that
// case RecoverStateFrom would only add floats to the space manager.
// We don't need to do that because everything's going to get reflowed
// again "for real". Calling RecoverStateFrom in this situation could
// be lethal because the block's descendant lines may have float
// caches containing dangling frame pointers. Ugh!
if (willReflowAgain && line->IsBlock()) {
// If we're going to reflow everything again, and this line is a block,
// then there is no need to recover float state. The line may contain
// other lines with floats, but in that case RecoverStateFrom would only
// add floats to the space manager. We don't need to do that because
// everything's going to get reflowed again "for real". Calling
// RecoverStateFrom in this situation could be lethal because the
// block's descendant lines may have float caches containing dangling
// frame pointers. Ugh!
// If this line is inline, then we need to recover its state now
// to make sure that we don't forget to move its floats by deltaY.
} else {
// XXX EVIL O(N^2) EVIL
aState.RecoverStateFrom(line, deltaY);

Просмотреть файл

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<body style="border:3px solid;">
<div style="float:left;">Kitty</div>
<div>
<div><div style="clear:both"></div></div>
Kitty
<div style="clear:both">.</div>
<div style="float:left;"></div>
</div>
<div id="i">xxx</div>
<div style="clear:both"></div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<body style="border:3px solid;">
<div style="float:left;">Kitty</div>
<div>
<div><div style="clear:both"></div></div>
Kitty
<div style="clear:both">.</div>
<div style="float:left;"></div>
</div>
<div id="i">x</div>
<div style="clear:both"></div>
<script>
document.body.offsetTop;
document.getElementById("i").textContent += "x";
document.body.offsetTop;
document.getElementById("i").textContent += "x";
</script>
</body>
</html>

Просмотреть файл

@ -496,3 +496,4 @@ random == 403134-1.html 403134-1-ref.html # bug 405377
== 405186-1.xhtml about:blank
== 405305-1.html 405305-1-ref.html
== 405584-1.html 405584-1-ref.html
== 406484-1.html 406484-1-ref.html