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 'app.dart'; | 7 import 'app.dart'; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:collection'; | 9 import 'dart:collection'; |
10 import 'dart:mirrors'; | 10 import 'dart:mirrors'; |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
400 void syncRenderObject(DecoratedBox old) { | 400 void syncRenderObject(DecoratedBox old) { |
401 super.syncRenderObject(old); | 401 super.syncRenderObject(old); |
402 root.decoration = decoration; | 402 root.decoration = decoration; |
403 } | 403 } |
404 } | 404 } |
405 | 405 |
406 class SizedBox extends OneChildRenderObjectWrapper { | 406 class SizedBox extends OneChildRenderObjectWrapper { |
407 RenderSizedBox root; | 407 RenderSizedBox root; |
408 final Size desiredSize; | 408 final Size desiredSize; |
409 | 409 |
410 SizedBox({ this.desiredSize, UINode child, Object key }) | 410 SizedBox({ |
411 : super(child: child, key: key); | 411 this.desiredSize: sky.Size.infinite, |
eseidel
2015/06/08 17:55:21
sky.
| |
412 UINode child, | |
413 Object key | |
414 }) : super(child: child, key: key); | |
412 | 415 |
413 RenderSizedBox createNode() => new RenderSizedBox(desiredSize: desiredSize); | 416 RenderSizedBox createNode() => new RenderSizedBox(desiredSize: desiredSize); |
414 | 417 |
415 void syncRenderObject(SizedBox old) { | 418 void syncRenderObject(SizedBox old) { |
416 super.syncRenderObject(old); | 419 super.syncRenderObject(old); |
417 root.desiredSize = desiredSize; | 420 root.desiredSize = desiredSize; |
418 } | 421 } |
419 } | 422 } |
420 | 423 |
421 class Transform extends OneChildRenderObjectWrapper { | 424 class Transform extends OneChildRenderObjectWrapper { |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
959 | 962 |
960 if (desiredSize != null) | 963 if (desiredSize != null) |
961 current = new SizedBox(desiredSize: desiredSize, child: current); | 964 current = new SizedBox(desiredSize: desiredSize, child: current); |
962 | 965 |
963 if (margin != null) | 966 if (margin != null) |
964 current = new Padding(padding: margin, child: current); | 967 current = new Padding(padding: margin, child: current); |
965 | 968 |
966 if (transform != null) | 969 if (transform != null) |
967 current = new Transform(transform: transform, child: current); | 970 current = new Transform(transform: transform, child: current); |
968 | 971 |
972 if (current == null) | |
973 current = new SizedBox(); | |
eseidel
2015/06/08 17:55:21
What is a sized box with no size? 0x0?
| |
974 | |
969 return current; | 975 return current; |
970 } | 976 } |
971 } | 977 } |
972 | 978 |
973 class _AppView extends AppView { | 979 class _AppView extends AppView { |
974 _AppView() : super(null); | 980 _AppView() : super(null); |
975 | 981 |
976 void dispatchEvent(sky.Event event, HitTestResult result) { | 982 void dispatchEvent(sky.Event event, HitTestResult result) { |
977 super.dispatchEvent(event, result); | 983 super.dispatchEvent(event, result); |
978 | 984 |
(...skipping 28 matching lines...) Expand all Loading... | |
1007 assert(root.parent is RenderView); | 1013 assert(root.parent is RenderView); |
1008 } | 1014 } |
1009 } | 1015 } |
1010 | 1016 |
1011 class Text extends Component { | 1017 class Text extends Component { |
1012 Text(this.data) : super(key: '*text*'); | 1018 Text(this.data) : super(key: '*text*'); |
1013 final String data; | 1019 final String data; |
1014 bool get interchangeable => true; | 1020 bool get interchangeable => true; |
1015 UINode build() => new Paragraph(text: data); | 1021 UINode build() => new Paragraph(text: data); |
1016 } | 1022 } |
OLD | NEW |