| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 // Text nodes are special cases of having non-unique keys (which don't need | 344 // Text nodes are special cases of having non-unique keys (which don't need |
| 345 // to be assigned as part of the API). Since they are unique in not having | 345 // to be assigned as part of the API). Since they are unique in not having |
| 346 // children, there's little point to reordering, so we always just re-assign | 346 // children, there's little point to reordering, so we always just re-assign |
| 347 // the data. | 347 // the data. |
| 348 Text(this.data) : super(key:'*text*'); | 348 Text(this.data) : super(key:'*text*'); |
| 349 | 349 |
| 350 static final Text _emptyText = new Text(null); | 350 static final Text _emptyText = new Text(null); |
| 351 | 351 |
| 352 SkyNodeWrapper get _emptyNode => _emptyText; | 352 SkyNodeWrapper get _emptyNode => _emptyText; |
| 353 | 353 |
| 354 static final Style _displayParagraph = new Style('display:paragraph'); |
| 355 |
| 354 sky.Node _createNode() { | 356 sky.Node _createNode() { |
| 355 return sky.document.createElement('div') | 357 return sky.document.createElement('div') |
| 356 ..setChild(new sky.Text(this.data)) | 358 ..setChild(new sky.Text(this.data)) |
| 357 ..setAttribute('style', 'display:paragraph'); | 359 ..setAttribute('class', _displayParagraph._className)
; |
| 358 } | 360 } |
| 359 | 361 |
| 360 void _syncNode(SkyNodeWrapper old) { | 362 void _syncNode(SkyNodeWrapper old) { |
| 361 if (old == _emptyText) | 363 if (old == _emptyText) |
| 362 return; // we set inside _createNode(); | 364 return; // we set inside _createNode(); |
| 363 | 365 |
| 364 (_root.firstChild as sky.Text).data = data; | 366 (_root.firstChild as sky.Text).data = data; |
| 365 } | 367 } |
| 366 } | 368 } |
| 367 | 369 |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 | 885 |
| 884 abstract class App extends Component { | 886 abstract class App extends Component { |
| 885 sky.Node _host; | 887 sky.Node _host; |
| 886 | 888 |
| 887 App() : super(stateful: true) { | 889 App() : super(stateful: true) { |
| 888 _host = sky.document.createElement('div'); | 890 _host = sky.document.createElement('div'); |
| 889 sky.document.appendChild(_host); | 891 sky.document.appendChild(_host); |
| 890 _scheduleComponentForRender(this); | 892 _scheduleComponentForRender(this); |
| 891 } | 893 } |
| 892 } | 894 } |
| OLD | NEW |