| 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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 style: style, | 600 style: style, |
| 601 inlineStyle: inlineStyle | 601 inlineStyle: inlineStyle |
| 602 ); | 602 ); |
| 603 | 603 |
| 604 sky.Node _createNode() { | 604 sky.Node _createNode() { |
| 605 var result = super._createNode(); | 605 var result = super._createNode(); |
| 606 result.setLayoutManager(() => layout(_root)); | 606 result.setLayoutManager(() => layout(_root)); |
| 607 return result; | 607 return result; |
| 608 } | 608 } |
| 609 | 609 |
| 610 // If we ever reuse sky nodes for different classes, then we should |
| 611 // call _root.setLayoutManager(null) during _remove() here. |
| 612 |
| 610 void _syncNode(SkyNodeWrapper old) { | 613 void _syncNode(SkyNodeWrapper old) { |
| 611 super._syncNode(old); | 614 super._syncNode(old); |
| 615 _root.setLayoutManager(() => layout(_root)); |
| 612 _root.setNeedsLayout(); | 616 _root.setNeedsLayout(); |
| 613 } | 617 } |
| 614 | 618 |
| 615 void layout(sky.Element skyNode); | 619 void layout(sky.Element skyNode); |
| 616 // set skyNode.width (e.g., set it to skyNode.parentNode.width) | 620 // set skyNode.width (e.g., set it to skyNode.parentNode.width) |
| 617 // for each skyNode.getChildNodes()[i]: | 621 // for each skyNode.getChildNodes()[i]: |
| 618 // call .layout() | 622 // call .layout() |
| 619 // set .x, .y | 623 // set .x, .y |
| 620 // set .width if you want to force a width | 624 // set .width if you want to force a width |
| 621 // set .height if you want to force a height | 625 // set .height if you want to force a height |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 | 925 |
| 922 abstract class App extends Component { | 926 abstract class App extends Component { |
| 923 sky.Node _host; | 927 sky.Node _host; |
| 924 | 928 |
| 925 App() : super(stateful: true) { | 929 App() : super(stateful: true) { |
| 926 _host = sky.document.createElement('div'); | 930 _host = sky.document.createElement('div'); |
| 927 sky.document.appendChild(_host); | 931 sky.document.appendChild(_host); |
| 928 _scheduleComponentForRender(this); | 932 _scheduleComponentForRender(this); |
| 929 } | 933 } |
| 930 } | 934 } |
| OLD | NEW |