| 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; |
| 21 export 'rendering/box.dart' show BoxDecoration, Border, BorderSide, EdgeDims; |
| 22 export 'rendering/flex.dart' show FlexDirection; |
| 20 | 23 |
| 21 // final sky.Tracing _tracing = sky.window.tracing; | 24 // final sky.Tracing _tracing = sky.window.tracing; |
| 22 | 25 |
| 23 final bool _shouldLogRenderDuration = false; | 26 final bool _shouldLogRenderDuration = false; |
| 24 final bool _shouldTrace = false; | 27 final bool _shouldTrace = false; |
| 25 | 28 |
| 26 enum _SyncOperation { identical, insertion, stateful, stateless, removal } | 29 enum _SyncOperation { identical, insertion, stateful, stateless, removal } |
| 27 | 30 |
| 28 /* | 31 /* |
| 29 * All Effen nodes derive from UINode. All nodes have a _parent, a _key and | 32 * All Effen nodes derive from UINode. All nodes have a _parent, a _key and |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 RenderDecoratedBox createNode() => new RenderDecoratedBox(decoration: decorati
on); | 395 RenderDecoratedBox createNode() => new RenderDecoratedBox(decoration: decorati
on); |
| 393 | 396 |
| 394 void syncRenderObject(DecoratedBox old) { | 397 void syncRenderObject(DecoratedBox old) { |
| 395 super.syncRenderObject(old); | 398 super.syncRenderObject(old); |
| 396 root.decoration = decoration; | 399 root.decoration = decoration; |
| 397 } | 400 } |
| 398 } | 401 } |
| 399 | 402 |
| 400 class SizedBox extends OneChildRenderObjectWrapper { | 403 class SizedBox extends OneChildRenderObjectWrapper { |
| 401 RenderSizedBox root; | 404 RenderSizedBox root; |
| 402 final sky.Size desiredSize; | 405 final Size desiredSize; |
| 403 | 406 |
| 404 SizedBox({ this.desiredSize, UINode child, Object key }) | 407 SizedBox({ this.desiredSize, UINode child, Object key }) |
| 405 : super(child: child, key: key); | 408 : super(child: child, key: key); |
| 406 | 409 |
| 407 RenderSizedBox createNode() => new RenderSizedBox(desiredSize: desiredSize); | 410 RenderSizedBox createNode() => new RenderSizedBox(desiredSize: desiredSize); |
| 408 | 411 |
| 409 void syncRenderObject(SizedBox old) { | 412 void syncRenderObject(SizedBox old) { |
| 410 super.syncRenderObject(old); | 413 super.syncRenderObject(old); |
| 411 root.desiredSize = desiredSize; | 414 root.desiredSize = desiredSize; |
| 412 } | 415 } |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 class FlexExpandingChild extends ParentDataNode { | 714 class FlexExpandingChild extends ParentDataNode { |
| 712 FlexExpandingChild(UINode content, [int flex = 1]) | 715 FlexExpandingChild(UINode content, [int flex = 1]) |
| 713 : super(content, new FlexBoxParentData()..flex = flex); | 716 : super(content, new FlexBoxParentData()..flex = flex); |
| 714 } | 717 } |
| 715 | 718 |
| 716 class Image extends RenderObjectWrapper { | 719 class Image extends RenderObjectWrapper { |
| 717 RenderImage root; | 720 RenderImage root; |
| 718 RenderImage createNode() => new RenderImage(this.src, this.size); | 721 RenderImage createNode() => new RenderImage(this.src, this.size); |
| 719 | 722 |
| 720 final String src; | 723 final String src; |
| 721 final sky.Size size; | 724 final Size size; |
| 722 | 725 |
| 723 Image({ | 726 Image({ |
| 724 Object key, | 727 Object key, |
| 725 this.src, | 728 this.src, |
| 726 this.size | 729 this.size |
| 727 }) : super(key: key); | 730 }) : super(key: key); |
| 728 | 731 |
| 729 void syncRenderObject(UINode old) { | 732 void syncRenderObject(UINode old) { |
| 730 super.syncRenderObject(old); | 733 super.syncRenderObject(old); |
| 731 root.src = src; | 734 root.src = src; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 } | 954 } |
| 952 | 955 |
| 953 UINode build(); | 956 UINode build(); |
| 954 } | 957 } |
| 955 | 958 |
| 956 class Container extends Component { | 959 class Container extends Component { |
| 957 final UINode child; | 960 final UINode child; |
| 958 final Matrix4 transform; | 961 final Matrix4 transform; |
| 959 final EdgeDims margin; | 962 final EdgeDims margin; |
| 960 final BoxDecoration decoration; | 963 final BoxDecoration decoration; |
| 961 final sky.Size desiredSize; | 964 final Size desiredSize; |
| 962 final EdgeDims padding; | 965 final EdgeDims padding; |
| 963 | 966 |
| 964 Container({ | 967 Container({ |
| 965 Object key, | 968 Object key, |
| 966 this.child, | 969 this.child, |
| 967 this.transform, | 970 this.transform, |
| 968 this.margin, | 971 this.margin, |
| 969 this.decoration, | 972 this.decoration, |
| 970 this.desiredSize, | 973 this.desiredSize, |
| 971 this.padding | 974 this.padding |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 assert(root.parent is RenderView); | 1033 assert(root.parent is RenderView); |
| 1031 } | 1034 } |
| 1032 } | 1035 } |
| 1033 | 1036 |
| 1034 class Text extends Component { | 1037 class Text extends Component { |
| 1035 Text(this.data) : super(key: '*text*'); | 1038 Text(this.data) : super(key: '*text*'); |
| 1036 final String data; | 1039 final String data; |
| 1037 bool get interchangeable => true; | 1040 bool get interchangeable => true; |
| 1038 UINode build() => new Paragraph(text: data); | 1041 UINode build() => new Paragraph(text: data); |
| 1039 } | 1042 } |
| OLD | NEW |