Make changing your layout manager work.

If your layout manager changes, then you need to setNeedsLayout,
otherwise the next frame doesn't even get scheduled. We already
correctly handle going from not having layout to having one or
vice versa by doing the more drastic reattaching since that
requires changing your actual render class.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1060013005
This commit is contained in:
Ojan Vafai 2015-04-15 11:08:32 -07:00
parent a0ef1d472a
commit 41a9d53fd4

View File

@ -84,30 +84,39 @@ void main() {
expect(secondChild.offsetWidth, equals(150));
assertNonChangingValues();
parent.setLayoutManager(null);
parent.setLayoutManager(() {
parent.width = 250.0;
});
window.requestAnimationFrame((_) {
expect(parent.offsetWidth, equals(300));
expect(parent.offsetHeight, equals(50));
expect(parent.offsetTop, equals(0));
expect(parent.offsetLeft, equals(0));
expect(parent.offsetWidth, equals(250));
assertNonChangingValues();
expect(firstChild.offsetWidth, equals(300));
expect(firstChild.offsetHeight, equals(25));
expect(firstChild.offsetTop, equals(0));
expect(firstChild.offsetLeft, equals(0));
parent.setLayoutManager(null);
expect(secondChild.offsetWidth, equals(300));
expect(secondChild.offsetHeight, equals(25));
expect(secondChild.offsetTop, equals(25));
expect(secondChild.offsetLeft, equals(0));
window.requestAnimationFrame((_) {
expect(parent.offsetWidth, equals(300));
expect(parent.offsetHeight, equals(50));
expect(parent.offsetTop, equals(0));
expect(parent.offsetLeft, equals(0));
expect(grandChild.offsetWidth, equals(25));
expect(grandChild.offsetHeight, equals(25));
expect(grandChild.offsetTop, equals(0));
expect(grandChild.offsetLeft, equals(0));
expect(firstChild.offsetWidth, equals(300));
expect(firstChild.offsetHeight, equals(25));
expect(firstChild.offsetTop, equals(0));
expect(firstChild.offsetLeft, equals(0));
completer.complete();
expect(secondChild.offsetWidth, equals(300));
expect(secondChild.offsetHeight, equals(25));
expect(secondChild.offsetTop, equals(25));
expect(secondChild.offsetLeft, equals(0));
expect(grandChild.offsetWidth, equals(25));
expect(grandChild.offsetHeight, equals(25));
expect(grandChild.offsetTop, equals(0));
expect(grandChild.offsetLeft, equals(0));
completer.complete();
});
});
});
});