| 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 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:mirrors'; | 9 import 'dart:mirrors'; |
| 10 import 'dart:sky' as sky; | 10 import 'dart:sky' as sky; |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 class BlockContainer extends OneChildListRenderNodeWrapper { | 570 class BlockContainer extends OneChildListRenderNodeWrapper { |
| 571 RenderBlock root; | 571 RenderBlock root; |
| 572 RenderBlock createNode() => new RenderBlock(); | 572 RenderBlock createNode() => new RenderBlock(); |
| 573 | 573 |
| 574 BlockContainer({ Object key, List<UINode> children }) | 574 BlockContainer({ Object key, List<UINode> children }) |
| 575 : super(key: key, children: children); | 575 : super(key: key, children: children); |
| 576 } | 576 } |
| 577 | 577 |
| 578 class Paragraph extends RenderNodeWrapper { | 578 class Paragraph extends RenderNodeWrapper { |
| 579 RenderParagraph root; | 579 RenderParagraph root; |
| 580 RenderParagraph createNode() => new RenderParagraph(text); | 580 RenderParagraph createNode() => new RenderParagraph(text: text); |
| 581 | 581 |
| 582 final String text; | 582 final String text; |
| 583 | 583 |
| 584 Paragraph({ Object key, this.text }) : super(key: key); | 584 Paragraph({ Object key, this.text }) : super(key: key); |
| 585 | 585 |
| 586 void syncRenderNode(UINode old) { | 586 void syncRenderNode(UINode old) { |
| 587 super.syncRenderNode(old); | 587 super.syncRenderNode(old); |
| 588 root.text = text; | 588 root.text = text; |
| 589 } | 589 } |
| 590 } | 590 } |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 assert(root.parent is RenderView); | 919 assert(root.parent is RenderView); |
| 920 } | 920 } |
| 921 } | 921 } |
| 922 | 922 |
| 923 class Text extends Component { | 923 class Text extends Component { |
| 924 Text(this.data) : super(key: '*text*'); | 924 Text(this.data) : super(key: '*text*'); |
| 925 final String data; | 925 final String data; |
| 926 bool get interchangeable => true; | 926 bool get interchangeable => true; |
| 927 UINode build() => new Paragraph(text: data); | 927 UINode build() => new Paragraph(text: data); |
| 928 } | 928 } |
| 929 | |
| 930 | |
| 931 // for now, but only for now: | |
| 932 | |
| 933 class RenderSolidColor extends RenderDecoratedBox { | |
| 934 final sky.Size desiredSize; | |
| 935 final int backgroundColor; | |
| 936 | |
| 937 RenderSolidColor(int backgroundColor, { this.desiredSize }) | |
| 938 : backgroundColor = backgroundColor, | |
| 939 super(decoration: new BoxDecoration(backgroundColor: backgroundColor)); | |
| 940 | |
| 941 sky.Size getIntrinsicDimensions(BoxConstraints constraints) { | |
| 942 return constraints.constrain(desiredSize); | |
| 943 } | |
| 944 | |
| 945 void performLayout() { | |
| 946 size = constraints.constrain(desiredSize); | |
| 947 } | |
| 948 | |
| 949 void handlePointer(sky.PointerEvent event) { | |
| 950 if (event.type == 'pointerdown') | |
| 951 decoration = new BoxDecoration(backgroundColor: 0xFFFF0000); | |
| 952 else if (event.type == 'pointerup') | |
| 953 decoration = new BoxDecoration(backgroundColor: backgroundColor); | |
| 954 } | |
| 955 } | |
| 956 | |
| 957 class Rectangle extends RenderNodeWrapper { | |
| 958 RenderSolidColor root; | |
| 959 RenderSolidColor createNode() => | |
| 960 new RenderSolidColor(color, desiredSize: new sky.Size(40.0, 130.0)); | |
| 961 | |
| 962 final int color; | |
| 963 | |
| 964 Rectangle(this.color, { Object key }) : super(key: key); | |
| 965 } | |
| OLD | NEW |