| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
| 8 import 'dart:sky' as sky; | 8 import 'dart:sky' as sky; |
| 9 | 9 |
| 10 import '../app/view.dart'; | 10 import '../app/view.dart'; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 if (node == null) { | 119 if (node == null) { |
| 120 // the child in this slot has gone away | 120 // the child in this slot has gone away |
| 121 assert(oldNode.mounted); | 121 assert(oldNode.mounted); |
| 122 removeChild(oldNode); | 122 removeChild(oldNode); |
| 123 assert(!oldNode.mounted); | 123 assert(!oldNode.mounted); |
| 124 return null; | 124 return null; |
| 125 } | 125 } |
| 126 | 126 |
| 127 if (oldNode != null && oldNode.runtimeType == node.runtimeType && node.key =
= oldNode.key && node._retainStatefulNodeIfPossible(oldNode)) { | 127 if (oldNode != null && |
| 128 oldNode.runtimeType == node.runtimeType && |
| 129 oldNode.key == node.key && |
| 130 node._retainStatefulNodeIfPossible(oldNode)) { |
| 128 assert(oldNode.mounted); | 131 assert(oldNode.mounted); |
| 129 assert(!node.mounted); | 132 assert(!node.mounted); |
| 130 oldNode._sync(node, slot); | 133 oldNode._sync(node, slot); |
| 131 assert(oldNode.root is RenderObject); | 134 assert(oldNode.root is RenderObject); |
| 132 return oldNode; | 135 return oldNode; |
| 133 } | 136 } |
| 134 | 137 |
| 135 if (oldNode != null && (oldNode.runtimeType != node.runtimeType || node.key
!= oldNode.key)) { | 138 if (oldNode != null && |
| 139 (oldNode.runtimeType != node.runtimeType || oldNode.key != node.key)) { |
| 136 assert(oldNode.mounted); | 140 assert(oldNode.mounted); |
| 137 removeChild(oldNode); | 141 removeChild(oldNode); |
| 138 oldNode = null; | 142 oldNode = null; |
| 139 } | 143 } |
| 140 | 144 |
| 141 assert(!node.mounted); | 145 assert(!node.mounted); |
| 142 node.setParent(this); | 146 node.setParent(this); |
| 143 node._sync(oldNode, slot); | 147 node._sync(oldNode, slot); |
| 144 assert(node.root is RenderObject); | 148 assert(node.root is RenderObject); |
| 145 return node; | 149 return node; |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 if (root.parent == null) { | 839 if (root.parent == null) { |
| 836 // we haven't attached it yet | 840 // we haven't attached it yet |
| 837 assert(_container.child == null); | 841 assert(_container.child == null); |
| 838 _container.child = root; | 842 _container.child = root; |
| 839 } | 843 } |
| 840 assert(root.parent == _container); | 844 assert(root.parent == _container); |
| 841 } | 845 } |
| 842 | 846 |
| 843 Widget build() => builder(); | 847 Widget build() => builder(); |
| 844 } | 848 } |
| OLD | NEW |