| 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'; |
| 11 import 'dart:sky' as sky; | 11 import 'dart:sky' as sky; |
| 12 import 'package:vector_math/vector_math.dart'; | 12 import 'package:vector_math/vector_math.dart'; |
| 13 import 'reflect.dart' as reflect; | 13 import 'reflect.dart' as reflect; |
| 14 import 'rendering/block.dart'; | 14 import 'rendering/block.dart'; |
| 15 import 'rendering/box.dart'; | 15 import 'rendering/box.dart'; |
| 16 import 'rendering/flex.dart'; | 16 import 'rendering/flex.dart'; |
| 17 import 'rendering/object.dart'; | 17 import 'rendering/object.dart'; |
| 18 import 'rendering/paragraph.dart'; | 18 import 'rendering/paragraph.dart'; |
| 19 import 'rendering/stack.dart'; | 19 import 'rendering/stack.dart'; |
| 20 export 'rendering/object.dart' show Point, Size, Rect, Color, Paint, Path; | 20 export 'rendering/object.dart' show Point, Size, Rect, Color, Paint, Path; |
| 21 export 'rendering/box.dart' show BoxDecoration, Border, BorderSide, EdgeDims; | 21 export 'rendering/box.dart' show BoxConstraints, BoxDecoration, Border, BorderSi
de, EdgeDims; |
| 22 export 'rendering/flex.dart' show FlexDirection; | 22 export 'rendering/flex.dart' show FlexDirection; |
| 23 | 23 |
| 24 // final sky.Tracing _tracing = sky.window.tracing; | 24 // final sky.Tracing _tracing = sky.window.tracing; |
| 25 | 25 |
| 26 final bool _shouldLogRenderDuration = false; | 26 final bool _shouldLogRenderDuration = false; |
| 27 | 27 |
| 28 /* | 28 /* |
| 29 * All Effen nodes derive from UINode. All nodes have a _parent, a _key and | 29 * All Effen nodes derive from UINode. All nodes have a _parent, a _key and |
| 30 * can be sync'd. | 30 * can be sync'd. |
| 31 */ | 31 */ |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 : super(child: child, key: key); | 411 : super(child: child, key: key); |
| 412 | 412 |
| 413 RenderSizedBox createNode() => new RenderSizedBox(desiredSize: desiredSize); | 413 RenderSizedBox createNode() => new RenderSizedBox(desiredSize: desiredSize); |
| 414 | 414 |
| 415 void syncRenderObject(SizedBox old) { | 415 void syncRenderObject(SizedBox old) { |
| 416 super.syncRenderObject(old); | 416 super.syncRenderObject(old); |
| 417 root.desiredSize = desiredSize; | 417 root.desiredSize = desiredSize; |
| 418 } | 418 } |
| 419 } | 419 } |
| 420 | 420 |
| 421 class ConstrainedBox extends OneChildRenderObjectWrapper { |
| 422 RenderConstrainedBox root; |
| 423 final BoxConstraints constraints; |
| 424 |
| 425 ConstrainedBox({ this.constraints, UINode child, Object key }) |
| 426 : super(child: child, key: key); |
| 427 |
| 428 RenderConstrainedBox createNode() => new RenderConstrainedBox(additionalConstr
aints: constraints); |
| 429 |
| 430 void syncRenderObject(ConstrainedBox old) { |
| 431 super.syncRenderObject(old); |
| 432 root.additionalConstraints = constraints; |
| 433 } |
| 434 } |
| 435 |
| 421 class Transform extends OneChildRenderObjectWrapper { | 436 class Transform extends OneChildRenderObjectWrapper { |
| 422 RenderTransform root; | 437 RenderTransform root; |
| 423 final Matrix4 transform; | 438 final Matrix4 transform; |
| 424 | 439 |
| 425 Transform({ this.transform, UINode child, Object key }) | 440 Transform({ this.transform, UINode child, Object key }) |
| 426 : super(child: child, key: key); | 441 : super(child: child, key: key); |
| 427 | 442 |
| 428 RenderTransform createNode() => new RenderTransform(transform: transform); | 443 RenderTransform createNode() => new RenderTransform(transform: transform); |
| 429 | 444 |
| 430 void syncRenderObject(Transform old) { | 445 void syncRenderObject(Transform old) { |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 | 940 |
| 926 _dirty = true; | 941 _dirty = true; |
| 927 _scheduleComponentForRender(this); | 942 _scheduleComponentForRender(this); |
| 928 } | 943 } |
| 929 | 944 |
| 930 UINode build(); | 945 UINode build(); |
| 931 } | 946 } |
| 932 | 947 |
| 933 class Container extends Component { | 948 class Container extends Component { |
| 934 final UINode child; | 949 final UINode child; |
| 950 final BoxConstraints constraints; |
| 951 final BoxDecoration decoration; |
| 952 final EdgeDims margin; |
| 953 final EdgeDims padding; |
| 935 final Matrix4 transform; | 954 final Matrix4 transform; |
| 936 final EdgeDims margin; | |
| 937 final BoxDecoration decoration; | |
| 938 final Size desiredSize; | 955 final Size desiredSize; |
| 939 final EdgeDims padding; | |
| 940 | 956 |
| 941 Container({ | 957 Container({ |
| 942 Object key, | 958 Object key, |
| 943 this.child, | 959 this.child, |
| 944 this.transform, | 960 this.constraints, |
| 945 this.margin, | |
| 946 this.decoration, | 961 this.decoration, |
| 947 this.desiredSize, | 962 this.desiredSize, |
| 948 this.padding | 963 this.margin, |
| 964 this.padding, |
| 965 this.transform |
| 949 }) : super(key: key); | 966 }) : super(key: key); |
| 950 | 967 |
| 951 UINode build() { | 968 UINode build() { |
| 952 UINode current = child; | 969 UINode current = child; |
| 953 | 970 |
| 954 if (padding != null) | 971 if (padding != null) |
| 955 current = new Padding(padding: padding, child: current); | 972 current = new Padding(padding: padding, child: current); |
| 956 | 973 |
| 957 if (decoration != null) | 974 if (decoration != null) |
| 958 current = new DecoratedBox(decoration: decoration, child: current); | 975 current = new DecoratedBox(decoration: decoration, child: current); |
| 959 | 976 |
| 960 if (desiredSize != null) | 977 if (desiredSize != null) |
| 961 current = new SizedBox(desiredSize: desiredSize, child: current); | 978 current = new SizedBox(desiredSize: desiredSize, child: current); |
| 962 | 979 |
| 980 if (constraints != null) |
| 981 current = new ConstrainedBox(constraints: constraints); |
| 982 |
| 963 if (margin != null) | 983 if (margin != null) |
| 964 current = new Padding(padding: margin, child: current); | 984 current = new Padding(padding: margin, child: current); |
| 965 | 985 |
| 966 if (transform != null) | 986 if (transform != null) |
| 967 current = new Transform(transform: transform, child: current); | 987 current = new Transform(transform: transform, child: current); |
| 968 | 988 |
| 969 return current; | 989 return current; |
| 970 } | 990 } |
| 971 } | 991 } |
| 972 | 992 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 assert(root.parent is RenderView); | 1027 assert(root.parent is RenderView); |
| 1008 } | 1028 } |
| 1009 } | 1029 } |
| 1010 | 1030 |
| 1011 class Text extends Component { | 1031 class Text extends Component { |
| 1012 Text(this.data) : super(key: '*text*'); | 1032 Text(this.data) : super(key: '*text*'); |
| 1013 final String data; | 1033 final String data; |
| 1014 bool get interchangeable => true; | 1034 bool get interchangeable => true; |
| 1015 UINode build() => new Paragraph(text: data); | 1035 UINode build() => new Paragraph(text: data); |
| 1016 } | 1036 } |
| OLD | NEW |