Layout the child unless the rects are exactly equal; both being empty does not count as equal here.
b=563416 r=roc
--- a/layout/xul/base/src/nsStackLayout.cpp
+++ b/layout/xul/base/src/nsStackLayout.cpp
@@ -274,17 +274,17 @@ nsStackLayout::Layout(nsIBox* aBox, nsBo
if (childRect.width < 0)
childRect.width = 0;
if (childRect.height < 0)
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)) {
// add in the child's margin
nsMargin margin;
child->GetMargin(margin);
// obtain our offset from the top left border of the stack's content box.
--- a/layout/xul/test/Makefile.in
+++ b/layout/xul/test/Makefile.in
@@ -45,12 +45,13 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES =\
test_bug372685.xul \
test_bug386386.html \
test_bug394800.xhtml \
test_bug398982-1.xul \
test_bug398982-2.xul \
+ test_bug563416.html \
$(NULL)
libs:: $(_TEST_FILES)
$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/layout/xul/test/test_bug563416.html
@@ -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>