Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: sky/framework/fn.dart

Issue 1064983002: [Effen] basic layout container class for custom layout (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: it works! Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 Style style, 580 Style style,
581 String inlineStyle 581 String inlineStyle
582 }) : super( 582 }) : super(
583 key: key, 583 key: key,
584 children: children, 584 children: children,
585 style: style, 585 style: style,
586 inlineStyle: inlineStyle 586 inlineStyle: inlineStyle
587 ); 587 );
588 } 588 }
589 589
590 abstract class LayoutContainer extends Container {
591
ojan 2015/04/13 21:49:27 Nit: The style of the other classes doesn't have t
Hixie 2015/04/13 23:16:01 As far as I can tell, the style, such as it is, is
592 LayoutContainer({
593 Object key,
594 List<UINode> children,
595 Style style,
596 String inlineStyle
597 }) : super(
598 key: key,
599 children: children,
600 style: style,
601 inlineStyle: inlineStyle
602 );
603
604 sky.Node _createNode() {
605 var result = super._createNode();
606 result.setLayoutManager(() => layout(_root));
607 return result;
608 }
609
610 void _syncNode(SkyNodeWrapper old) {
611 super._syncNode(old);
612 _root.setNeedsLayout();
613 }
614
615 void layout(sky.Element skyNode);
ojan 2015/04/13 21:49:27 How about we bake this into Container itself and p
Hixie 2015/04/13 23:16:01 I could go either way. Will discuss this offline.
616 // set skyNode.width (e.g., set it to skyNode.parentNode.width)
617 // for each skyNode.getChildNodes()[i]:
618 // call .layout()
619 // set .x, .y
620 // set .width if you want to force a width
ojan 2015/04/13 21:49:27 Setting width here wouldn't work for the BlockLayo
Hixie 2015/04/13 23:16:01 That was basically how I'd designed my custom layo
621 // set .height if you want to force a height
622 // set skyNode.height
623
ojan 2015/04/13 21:49:27 ditto
624 }
625
590 class Image extends SkyElementWrapper { 626 class Image extends SkyElementWrapper {
591 627
592 String get _tagName => 'img'; 628 String get _tagName => 'img';
593 629
594 static final Image _emptyImage = new Image(); 630 static final Image _emptyImage = new Image();
595 631
596 SkyNodeWrapper get _emptyNode => _emptyImage; 632 SkyNodeWrapper get _emptyNode => _emptyImage;
597 633
598 final String src; 634 final String src;
599 final int width; 635 final int width;
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 921
886 abstract class App extends Component { 922 abstract class App extends Component {
887 sky.Node _host; 923 sky.Node _host;
888 924
889 App() : super(stateful: true) { 925 App() : super(stateful: true) {
890 _host = sky.document.createElement('div'); 926 _host = sky.document.createElement('div');
891 sky.document.appendChild(_host); 927 sky.document.appendChild(_host);
892 _scheduleComponentForRender(this); 928 _scheduleComponentForRender(this);
893 } 929 }
894 } 930 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698