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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 bool _sync(Node old, sky.ParentNode host, sky.Node insertBefore) { | 241 bool _sync(Node old, sky.ParentNode host, sky.Node insertBefore) { |
242 // print("---Syncing children of $_key"); | 242 // print("---Syncing children of $_key"); |
243 | 243 |
244 Element oldElement = old as Element; | 244 Element oldElement = old as Element; |
245 | 245 |
246 if (oldElement == null) { | 246 if (oldElement == null) { |
247 // print("...no oldElement, initial render"); | 247 // print("...no oldElement, initial render"); |
248 | 248 |
249 _root = sky.document.createElement(_tagName); | 249 _root = sky.document.createElement(_tagName); |
| 250 _parentInsertBefore(host, _root, insertBefore); |
250 _syncNode(); | 251 _syncNode(); |
251 | 252 |
252 for (var child in _children) { | 253 for (var child in _children) { |
253 child._sync(null, _root, null); | 254 child._sync(null, _root, null); |
254 assert(child._root is sky.Node); | 255 assert(child._root is sky.Node); |
255 } | 256 } |
256 | 257 |
257 _parentInsertBefore(host, _root, insertBefore); | |
258 return false; | 258 return false; |
259 } | 259 } |
260 | 260 |
261 _root = oldElement._root; | 261 _root = oldElement._root; |
262 oldElement._root = null; | 262 oldElement._root = null; |
263 sky.Element root = (_root as sky.Element); | 263 sky.Element root = (_root as sky.Element); |
264 | 264 |
265 _syncNode(oldElement); | 265 _syncNode(oldElement); |
266 | 266 |
267 var startIndex = 0; | 267 var startIndex = 0; |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 | 676 |
677 _sync(null, _host, null); | 677 _sync(null, _host, null); |
678 assert(_root is sky.Node); | 678 assert(_root is sky.Node); |
679 | 679 |
680 sw.stop(); | 680 sw.stop(); |
681 if (_shouldLogRenderDuration) | 681 if (_shouldLogRenderDuration) |
682 print("Initial render: ${sw.elapsedMicroseconds} microseconds"); | 682 print("Initial render: ${sw.elapsedMicroseconds} microseconds"); |
683 }); | 683 }); |
684 } | 684 } |
685 } | 685 } |
OLD | NEW |