Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: sky/tests/raw/render_flex.dart

Issue 1150253005: Replace BoxDimensions with sky.Size (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/sdk/lib/framework/layout2.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import '../resources/third_party/unittest/unittest.dart'; 5 import '../resources/third_party/unittest/unittest.dart';
6 import '../resources/unit.dart'; 6 import '../resources/unit.dart';
7 import 'dart:sky' as sky; 7 import 'dart:sky' as sky;
8 import 'package:sky/framework/app.dart'; 8 import 'package:sky/framework/app.dart';
9 import 'package:sky/framework/layout2.dart'; 9 import 'package:sky/framework/layout2.dart';
10 10
11 class RenderSolidColor extends RenderDecoratedBox { 11 class RenderSolidColor extends RenderDecoratedBox {
12 final sky.Size desiredSize; 12 final sky.Size desiredSize;
13 final int backgroundColor; 13 final int backgroundColor;
14 14
15 RenderSolidColor(int backgroundColor, { this.desiredSize: const sky.Size.infin ite() }) 15 RenderSolidColor(int backgroundColor, { this.desiredSize: const sky.Size.infin ite() })
16 : backgroundColor = backgroundColor, 16 : backgroundColor = backgroundColor,
17 super(new BoxDecoration(backgroundColor: backgroundColor)) { 17 super(new BoxDecoration(backgroundColor: backgroundColor)) {
18 } 18 }
19 19
20 BoxDimensions getIntrinsicDimensions(BoxConstraints constraints) { 20 sky.Size getIntrinsicDimensions(BoxConstraints constraints) {
21 return new BoxDimensions.withConstraints(constraints, 21 return constraints.constrain(desiredSize);
22 width: desiredSize.width,
23 height: desiredSize.height);
24 } 22 }
25 23
26 void performLayout() { 24 void performLayout() {
27 size = constraints.constrain(desiredSize); 25 size = constraints.constrain(desiredSize);
28 } 26 }
29 27
30 void handlePointer(sky.PointerEvent event) { 28 void handlePointer(sky.PointerEvent event) {
31 if (event.type == 'pointerdown') 29 if (event.type == 'pointerdown')
32 decoration = new BoxDecoration(backgroundColor: 0xFFFF0000); 30 decoration = new BoxDecoration(backgroundColor: 0xFFFF0000);
33 else if (event.type == 'pointerup') 31 else if (event.type == 'pointerup')
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 root.add(row); 74 root.add(row);
77 row.parentData.flex = 3; 75 row.parentData.flex = 3;
78 76
79 app = new AppView(root); 77 app = new AppView(root);
80 78
81 expect(root.size.width, equals(sky.view.width)); 79 expect(root.size.width, equals(sky.view.width));
82 expect(root.size.height, equals(sky.view.height)); 80 expect(root.size.height, equals(sky.view.height));
83 expect(renderBlock.size.width, equals(sky.view.width - 20.0)); 81 expect(renderBlock.size.width, equals(sky.view.width - 20.0));
84 }); 82 });
85 } 83 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/layout2.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698