Layout the child unless the rects are exactly equal; both being empty does not count as equal here. b=563416 r=roc

This commit is contained in:
Mats Palmgren 2010-05-04 19:21:43 +02:00
parent 694e1fb7e7
commit f620f844c2
3 changed files with 60 additions and 1 deletions

View File

@ -279,7 +279,7 @@ nsStackLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
childRect.height = 0;
nsRect oldRect(child->GetRect());
PRBool sizeChanged = (oldRect != childRect);
PRBool sizeChanged = !oldRect.IsExactEqual(childRect);
// only lay out dirty children or children whose sizes have changed
if (sizeChanged || NS_SUBTREE_DIRTY(child)) {

View File

@ -50,6 +50,7 @@ _TEST_FILES =\
test_bug394800.xhtml \
test_bug398982-1.xul \
test_bug398982-2.xul \
test_bug563416.html \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -0,0 +1,58 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=563416
-->
<head>
<title>Test for Bug 563416</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=563416">Mozilla Bug 563416</a>
<p id="display"><iframe id="test" src='data:text/html,<textarea style="-moz-box-sizing:content-box; height: 0px;" cols="20" rows="10">hsldkjvmshlkkajskdlfksdjflskdjflskdjflskdjflskdjfddddddddd</textarea>'></iframe></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 563416 **/
var result = -1;
var expected = -2;
var i = 0;
function continueTest() {
var frame = document.getElementById('test');
frame.contentWindow.location.reload();
if (i < 2)
setTimeout(continueTest,20)
else {
is(result, expected, "setting style.width changes clientWidth");
SimpleTest.finish();
}
}
function runTest() {
i = 0;
var frame = document.getElementById('test');
frame.onload = function() {
var t = frame.contentDocument.documentElement.getElementsByTagName("textarea")[0];
expected = t.clientWidth + 10;
t.style.width = expected + 'px';
result = t.clientWidth;
i++;
}
continueTest();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(runTest);
</script>
</pre>
</body>
</html>