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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 List<UINode> children | 557 List<UINode> children |
558 }) : super( | 558 }) : super( |
559 key: key, | 559 key: key, |
560 children: children | 560 children: children |
561 ); | 561 ); |
562 } | 562 } |
563 | 563 |
564 class FlexContainer extends OneChildListRenderNodeWrapper { | 564 class FlexContainer extends OneChildListRenderNodeWrapper { |
565 | 565 |
566 RenderFlex root; | 566 RenderFlex root; |
567 RenderFlex createNode() => new RenderFlex(this, this.direction); | 567 RenderFlex createNode() => new RenderFlex(direction: this.direction); |
568 | 568 |
569 static final FlexContainer _emptyContainer = new FlexContainer(); | 569 static final FlexContainer _emptyContainer = new FlexContainer(); |
570 // direction doesn't matter if it's empty | 570 // direction doesn't matter if it's empty |
571 | 571 |
572 RenderNodeWrapper get emptyNode => _emptyContainer; | 572 RenderNodeWrapper get emptyNode => _emptyContainer; |
573 | 573 |
574 final FlexDirection direction; | 574 final FlexDirection direction; |
575 | 575 |
576 FlexContainer({ | 576 FlexContainer({ |
577 Object key, | 577 Object key, |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 this.desiredWidth: double.INFINITY }) | 951 this.desiredWidth: double.INFINITY }) |
952 : backgroundColor = backgroundColor, | 952 : backgroundColor = backgroundColor, |
953 super(new BoxDecoration(backgroundColor: backgroundColor)); | 953 super(new BoxDecoration(backgroundColor: backgroundColor)); |
954 | 954 |
955 BoxDimensions getIntrinsicDimensions(BoxConstraints constraints) { | 955 BoxDimensions getIntrinsicDimensions(BoxConstraints constraints) { |
956 return new BoxDimensions.withConstraints(constraints, | 956 return new BoxDimensions.withConstraints(constraints, |
957 height: desiredHeight, | 957 height: desiredHeight, |
958 width: desiredWidth); | 958 width: desiredWidth); |
959 } | 959 } |
960 | 960 |
961 void layout(BoxConstraints constraints, { RenderNode relayoutSubtreeRoot }) { | 961 void performLayout() { |
962 width = constraints.constrainWidth(desiredWidth); | 962 width = constraints.constrainWidth(desiredWidth); |
963 height = constraints.constrainHeight(desiredHeight); | 963 height = constraints.constrainHeight(desiredHeight); |
964 layoutDone(); | |
965 } | 964 } |
966 | 965 |
967 void handlePointer(sky.PointerEvent event) { | 966 void handlePointer(sky.PointerEvent event) { |
968 if (event.type == 'pointerdown') | 967 if (event.type == 'pointerdown') |
969 decoration = new BoxDecoration(backgroundColor: 0xFFFF0000); | 968 decoration = new BoxDecoration(backgroundColor: 0xFFFF0000); |
970 else if (event.type == 'pointerup') | 969 else if (event.type == 'pointerup') |
971 decoration = new BoxDecoration(backgroundColor: backgroundColor); | 970 decoration = new BoxDecoration(backgroundColor: backgroundColor); |
972 } | 971 } |
973 } | 972 } |
974 | 973 |
975 class Rectangle extends RenderNodeWrapper { | 974 class Rectangle extends RenderNodeWrapper { |
976 | 975 |
977 Rectangle(this.color, { | 976 Rectangle(this.color, { |
978 Object key | 977 Object key |
979 }) : super( | 978 }) : super( |
980 key: key | 979 key: key |
981 ); | 980 ); |
982 | 981 |
983 final int color; | 982 final int color; |
984 | 983 |
985 RenderSolidColor root; | 984 RenderSolidColor root; |
986 RenderSolidColor createNode() => new RenderSolidColor(color, desiredWidth: 40.
0, desiredHeight: 130.0); | 985 RenderSolidColor createNode() => new RenderSolidColor(color, desiredWidth: 40.
0, desiredHeight: 130.0); |
987 | 986 |
988 static final Rectangle _emptyRectangle = new Rectangle(0); | 987 static final Rectangle _emptyRectangle = new Rectangle(0); |
989 RenderNodeWrapper get emptyNode => _emptyRectangle; | 988 RenderNodeWrapper get emptyNode => _emptyRectangle; |
990 | 989 |
991 } | 990 } |
OLD | NEW |