Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(835)

Unified Diff: sky/sdk/lib/rendering/object.dart

Issue 1186123009: Clean the relayout subtree root deeply when removing a child, otherwise the tree ends up in an inco… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/rendering/object.dart
diff --git a/sky/sdk/lib/rendering/object.dart b/sky/sdk/lib/rendering/object.dart
index 0a56f1e974d2cb111e8f0dda85c89221e91bdd1e..2e5080eb0204f97f739536fb8716a6cc0c3066c7 100644
--- a/sky/sdk/lib/rendering/object.dart
+++ b/sky/sdk/lib/rendering/object.dart
@@ -65,10 +65,7 @@ abstract class RenderObject extends AbstractNode {
assert(child != null);
assert(child.parentData != null);
child.parentData.detach();
- if (child._relayoutSubtreeRoot != child) {
- child._relayoutSubtreeRoot = null;
- child._needsLayout = true;
- }
+ child._cleanRelayoutSubtreeRoot();
super.dropChild(child);
markNeedsLayout();
}
@@ -114,6 +111,14 @@ abstract class RenderObject extends AbstractNode {
scheduler.ensureVisualUpdate();
}
}
+ void _cleanRelayoutSubtreeRoot() {
+ if (_relayoutSubtreeRoot != this) {
+ _relayoutSubtreeRoot = null;
+ _needsLayout = true;
+ _cleanRelayoutSubtreeRootChildren();
+ }
+ }
+ void _cleanRelayoutSubtreeRootChildren() { } // workaround for lack of inter-class mixins in Dart
void scheduleInitialLayout() {
assert(attached);
assert(parent == null);
@@ -297,6 +302,10 @@ abstract class RenderObjectWithChildMixin<ChildType extends RenderObject> implem
if (_child != null)
_child.detach();
}
+ void _cleanRelayoutSubtreeRootChildren() {
+ if (_child != null)
+ _child._cleanRelayoutSubtreeRoot();
+ }
String debugDescribeChildren(String prefix) {
if (child != null)
return '${prefix}child: ${child.toString(prefix)}';
@@ -444,6 +453,14 @@ abstract class ContainerRenderObjectMixin<ChildType extends RenderObject, Parent
child = child.parentData.nextSibling;
}
}
+ void _cleanRelayoutSubtreeRootChildren() {
+ ChildType child = _firstChild;
+ while (child != null) {
+ child._cleanRelayoutSubtreeRoot();
+ assert(child.parentData is ParentDataType);
+ child = child.parentData.nextSibling;
+ }
+ }
ChildType get firstChild => _firstChild;
ChildType get lastChild => _lastChild;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698