| 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 library fn; | 5 library fn; |
| 6 | 6 |
| 7 import 'app.dart'; | 7 import 'app.dart'; |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:collection'; | 9 import 'dart:collection'; |
| 10 import 'dart:mirrors'; | 10 import 'dart:mirrors'; |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 if (currentNode.interchangeable) | 566 if (currentNode.interchangeable) |
| 567 return false; // never re-order these nodes | 567 return false; // never re-order these nodes |
| 568 | 568 |
| 569 ensureOldIdMap(); | 569 ensureOldIdMap(); |
| 570 oldNode = oldNodeIdMap[currentNode._key]; | 570 oldNode = oldNodeIdMap[currentNode._key]; |
| 571 if (oldNode == null) | 571 if (oldNode == null) |
| 572 return false; | 572 return false; |
| 573 | 573 |
| 574 oldNodeIdMap[currentNode._key] = null; // mark it reordered | 574 oldNodeIdMap[currentNode._key] = null; // mark it reordered |
| 575 assert(root is ContainerRenderObjectMixin); | 575 assert(root is ContainerRenderObjectMixin); |
| 576 assert(oldNode.root is ContainerRenderObjectMixin); | 576 assert(old.root is ContainerRenderObjectMixin); |
| 577 assert(oldNode.root != null); |
| 577 | 578 |
| 578 old.root.remove(oldNode.root); | 579 old.root.remove(oldNode.root); |
| 579 root.add(oldNode.root, before: nextSibling); | 580 root.add(oldNode.root, before: nextSibling); |
| 580 | 581 |
| 581 return true; | 582 return true; |
| 582 } | 583 } |
| 583 | 584 |
| 584 // Scan forwards, this time we may re-order; | 585 // Scan forwards, this time we may re-order; |
| 585 nextSibling = root.firstChild; | 586 nextSibling = root.firstChild; |
| 586 while (startIndex < endIndex && oldStartIndex < oldEndIndex) { | 587 while (startIndex < endIndex && oldStartIndex < oldEndIndex) { |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 assert(root.parent is RenderView); | 985 assert(root.parent is RenderView); |
| 985 } | 986 } |
| 986 } | 987 } |
| 987 | 988 |
| 988 class Text extends Component { | 989 class Text extends Component { |
| 989 Text(this.data) : super(key: '*text*'); | 990 Text(this.data) : super(key: '*text*'); |
| 990 final String data; | 991 final String data; |
| 991 bool get interchangeable => true; | 992 bool get interchangeable => true; |
| 992 UINode build() => new Paragraph(text: data); | 993 UINode build() => new Paragraph(text: data); |
| 993 } | 994 } |
| OLD | NEW |