| 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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 Style style, | 576 Style style, |
| 577 String inlineStyle | 577 String inlineStyle |
| 578 }) : super( | 578 }) : super( |
| 579 key: key, | 579 key: key, |
| 580 children: children, | 580 children: children, |
| 581 style: style, | 581 style: style, |
| 582 inlineStyle: inlineStyle | 582 inlineStyle: inlineStyle |
| 583 ); | 583 ); |
| 584 } | 584 } |
| 585 | 585 |
| 586 abstract class LayoutContainer extends Container { |
| 587 |
| 588 LayoutContainer({ |
| 589 Object key, |
| 590 List<UINode> children, |
| 591 Style style, |
| 592 String inlineStyle |
| 593 }) : super( |
| 594 key: key, |
| 595 children: children, |
| 596 style: style, |
| 597 inlineStyle: inlineStyle |
| 598 ); |
| 599 |
| 600 sky.Node _createNode() { |
| 601 var result = super._createNode(); |
| 602 result.setLayoutManager(() => layout(_root)); |
| 603 return result; |
| 604 } |
| 605 |
| 606 void _syncNode(SkyNodeWrapper old) { |
| 607 super._syncNode(old); |
| 608 _root.setNeedsLayout(); |
| 609 } |
| 610 |
| 611 void layout(sky.Element skyNode); |
| 612 // set skyNode.width if you have an opinion about your width |
| 613 // for each skyNode.getChildElements()[i]: |
| 614 // set .width |
| 615 // call .layout() |
| 616 // set .x, .y |
| 617 // set .width if you want to force a width |
| 618 // set .height if you want to force a height |
| 619 // set skyNode.height |
| 620 |
| 621 } |
| 622 |
| 586 class Image extends SkyElementWrapper { | 623 class Image extends SkyElementWrapper { |
| 587 | 624 |
| 588 String get _tagName => 'img'; | 625 String get _tagName => 'img'; |
| 589 | 626 |
| 590 static final Image _emptyImage = new Image(); | 627 static final Image _emptyImage = new Image(); |
| 591 | 628 |
| 592 SkyNodeWrapper get _emptyNode => _emptyImage; | 629 SkyNodeWrapper get _emptyNode => _emptyImage; |
| 593 | 630 |
| 594 final String src; | 631 final String src; |
| 595 final int width; | 632 final int width; |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 | 918 |
| 882 abstract class App extends Component { | 919 abstract class App extends Component { |
| 883 sky.Node _host; | 920 sky.Node _host; |
| 884 | 921 |
| 885 App() : super(stateful: true) { | 922 App() : super(stateful: true) { |
| 886 _host = sky.document.createElement('div'); | 923 _host = sky.document.createElement('div'); |
| 887 sky.document.appendChild(_host); | 924 sky.document.appendChild(_host); |
| 888 _scheduleComponentForRender(this); | 925 _scheduleComponentForRender(this); |
| 889 } | 926 } |
| 890 } | 927 } |
| OLD | NEW |