| 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/node.dart'; | 17 import 'rendering/node.dart'; |
| 18 import 'rendering/paragraph.dart'; | 18 import 'rendering/paragraph.dart'; |
| 19 import 'rendering/stack.dart'; |
| 19 | 20 |
| 20 // final sky.Tracing _tracing = sky.window.tracing; | 21 // final sky.Tracing _tracing = sky.window.tracing; |
| 21 | 22 |
| 22 final bool _shouldLogRenderDuration = false; | 23 final bool _shouldLogRenderDuration = false; |
| 23 final bool _shouldTrace = false; | 24 final bool _shouldTrace = false; |
| 24 | 25 |
| 25 enum _SyncOperation { IDENTICAL, INSERTION, STATEFUL, STATELESS, REMOVAL } | 26 enum _SyncOperation { IDENTICAL, INSERTION, STATEFUL, STATELESS, REMOVAL } |
| 26 | 27 |
| 27 /* | 28 /* |
| 28 * 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 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 384 |
| 384 class SizedBox extends OneChildRenderNodeWrapper { | 385 class SizedBox extends OneChildRenderNodeWrapper { |
| 385 RenderSizedBox root; | 386 RenderSizedBox root; |
| 386 final sky.Size desiredSize; | 387 final sky.Size desiredSize; |
| 387 | 388 |
| 388 SizedBox({ this.desiredSize, UINode child, Object key }) | 389 SizedBox({ this.desiredSize, UINode child, Object key }) |
| 389 : super(child: child, key: key); | 390 : super(child: child, key: key); |
| 390 | 391 |
| 391 RenderSizedBox createNode() => new RenderSizedBox(desiredSize: desiredSize); | 392 RenderSizedBox createNode() => new RenderSizedBox(desiredSize: desiredSize); |
| 392 | 393 |
| 393 void syncRenderNode(DecoratedBox old) { | 394 void syncRenderNode(SizedBox old) { |
| 394 super.syncRenderNode(old); | 395 super.syncRenderNode(old); |
| 395 root.desiredSize = desiredSize; | 396 root.desiredSize = desiredSize; |
| 396 } | 397 } |
| 397 } | 398 } |
| 398 | 399 |
| 399 class Transform extends OneChildRenderNodeWrapper { | 400 class Transform extends OneChildRenderNodeWrapper { |
| 400 RenderTransform root; | 401 RenderTransform root; |
| 401 final Matrix4 transform; | 402 final Matrix4 transform; |
| 402 | 403 |
| 403 Transform({ this.transform, UINode child, Object key }) | 404 Transform({ this.transform, UINode child, Object key }) |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 } | 585 } |
| 585 | 586 |
| 586 class BlockContainer extends OneChildListRenderNodeWrapper { | 587 class BlockContainer extends OneChildListRenderNodeWrapper { |
| 587 RenderBlock root; | 588 RenderBlock root; |
| 588 RenderBlock createNode() => new RenderBlock(); | 589 RenderBlock createNode() => new RenderBlock(); |
| 589 | 590 |
| 590 BlockContainer({ Object key, List<UINode> children }) | 591 BlockContainer({ Object key, List<UINode> children }) |
| 591 : super(key: key, children: children); | 592 : super(key: key, children: children); |
| 592 } | 593 } |
| 593 | 594 |
| 595 class StackContainer extends OneChildListRenderNodeWrapper { |
| 596 RenderStack root; |
| 597 RenderStack createNode() => new RenderStack(); |
| 598 |
| 599 StackContainer({ Object key, List<UINode> children }) |
| 600 : super(key: key, children: children); |
| 601 } |
| 602 |
| 594 class Paragraph extends RenderNodeWrapper { | 603 class Paragraph extends RenderNodeWrapper { |
| 595 RenderParagraph root; | 604 RenderParagraph root; |
| 596 RenderParagraph createNode() => new RenderParagraph(text: text); | 605 RenderParagraph createNode() => new RenderParagraph(text: text); |
| 597 | 606 |
| 598 final String text; | 607 final String text; |
| 599 | 608 |
| 600 Paragraph({ Object key, this.text }) : super(key: key); | 609 Paragraph({ Object key, this.text }) : super(key: key); |
| 601 | 610 |
| 602 void syncRenderNode(UINode old) { | 611 void syncRenderNode(UINode old) { |
| 603 super.syncRenderNode(old); | 612 super.syncRenderNode(old); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 this.transform, | 887 this.transform, |
| 879 this.margin, | 888 this.margin, |
| 880 this.decoration, | 889 this.decoration, |
| 881 this.desiredSize, | 890 this.desiredSize, |
| 882 this.padding | 891 this.padding |
| 883 }) : super(key: key); | 892 }) : super(key: key); |
| 884 | 893 |
| 885 UINode build() { | 894 UINode build() { |
| 886 UINode current = child; | 895 UINode current = child; |
| 887 | 896 |
| 888 if (transform != null) | |
| 889 current = new Transform(transform: transform, child: current); | |
| 890 | |
| 891 if (padding != null) | 897 if (padding != null) |
| 892 current = new Padding(padding: padding, child: current); | 898 current = new Padding(padding: padding, child: current); |
| 893 | 899 |
| 894 if (decoration != null) | 900 if (decoration != null) |
| 895 current = new DecoratedBox(decoration: decoration, child: current); | 901 current = new DecoratedBox(decoration: decoration, child: current); |
| 896 | 902 |
| 897 if (desiredSize != null) | 903 if (desiredSize != null) |
| 898 current = new SizedBox(desiredSize: desiredSize, child: current); | 904 current = new SizedBox(desiredSize: desiredSize, child: current); |
| 899 | 905 |
| 900 if (margin != null) | 906 if (margin != null) |
| 901 current = new Padding(padding: margin, child: current); | 907 current = new Padding(padding: margin, child: current); |
| 902 | 908 |
| 909 if (transform != null) |
| 910 current = new Transform(transform: transform, child: current); |
| 911 |
| 903 return current; | 912 return current; |
| 904 } | 913 } |
| 905 } | 914 } |
| 906 | 915 |
| 907 class _AppView extends AppView { | 916 class _AppView extends AppView { |
| 908 _AppView() : super(null); | 917 _AppView() : super(null); |
| 909 | 918 |
| 910 void dispatchPointerEvent(sky.PointerEvent event, HitTestResult result) { | 919 void dispatchPointerEvent(sky.PointerEvent event, HitTestResult result) { |
| 911 super.dispatchPointerEvent(event, result); | 920 super.dispatchPointerEvent(event, result); |
| 912 | 921 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 940 assert(root.parent is RenderView); | 949 assert(root.parent is RenderView); |
| 941 } | 950 } |
| 942 } | 951 } |
| 943 | 952 |
| 944 class Text extends Component { | 953 class Text extends Component { |
| 945 Text(this.data) : super(key: '*text*'); | 954 Text(this.data) : super(key: '*text*'); |
| 946 final String data; | 955 final String data; |
| 947 bool get interchangeable => true; | 956 bool get interchangeable => true; |
| 948 UINode build() => new Paragraph(text: data); | 957 UINode build() => new Paragraph(text: data); |
| 949 } | 958 } |
| OLD | NEW |