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 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:sky' as sky; | 9 import 'dart:sky' as sky; |
10 import 'reflect.dart' as reflect; | 10 import 'reflect.dart' as reflect; |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 bool _debugHasDuplicateIds() { | 351 bool _debugHasDuplicateIds() { |
352 var idSet = new HashSet<String>(); | 352 var idSet = new HashSet<String>(); |
353 for (var child in children) { | 353 for (var child in children) { |
354 assert(child != null); | 354 assert(child != null); |
355 if (child is Text) { | 355 if (child is Text) { |
356 continue; // Text nodes all have the same key and are never reordered. | 356 continue; // Text nodes all have the same key and are never reordered. |
357 } | 357 } |
358 | 358 |
359 if (!idSet.add(child._key)) { | 359 if (!idSet.add(child._key)) { |
360 throw '''If multiple (non-Text) nodes of the same type exist as children | 360 throw '''If multiple (non-Text) nodes of the same type exist as children |
361 of another node, they must have unique keys.'''; | 361 of another node, they must have unique keys. |
| 362 Duplicate: "${child._key}"'''; |
362 } | 363 } |
363 } | 364 } |
364 return false; | 365 return false; |
365 } | 366 } |
366 | 367 |
367 void _syncNode(SkyNodeWrapper old) { | 368 void _syncNode(SkyNodeWrapper old) { |
368 SkyElementWrapper oldSkyElementWrapper = old as SkyElementWrapper; | 369 SkyElementWrapper oldSkyElementWrapper = old as SkyElementWrapper; |
369 | 370 |
370 List<Style> styles = new List<Style>(); | 371 List<Style> styles = new List<Style>(); |
371 if (style != null) | 372 if (style != null) |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 } | 854 } |
854 | 855 |
855 void _buildIfDirty() { | 856 void _buildIfDirty() { |
856 if (!_dirty || _defunct) | 857 if (!_dirty || _defunct) |
857 return; | 858 return; |
858 | 859 |
859 _trace('$_key rebuilding...'); | 860 _trace('$_key rebuilding...'); |
860 _sync(null, _host, _root); | 861 _sync(null, _host, _root); |
861 } | 862 } |
862 } | 863 } |
OLD | NEW |