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

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

Issue 1167293003: Split getIntrinsicDimensions into four pieces (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: more worky 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/rendering/stack.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 '../resources/display_list.dart'; 7 import '../resources/display_list.dart';
8 import 'dart:sky' as sky; 8 import 'dart:sky' as sky;
9 import 'package:sky/framework/app.dart'; 9 import 'package:sky/framework/app.dart';
10 import 'package:sky/framework/rendering/block.dart'; 10 import 'package:sky/framework/rendering/block.dart';
11 import 'package:sky/framework/rendering/box.dart'; 11 import 'package:sky/framework/rendering/box.dart';
12 import 'package:sky/framework/rendering/flex.dart'; 12 import 'package:sky/framework/rendering/flex.dart';
13 13
14 class RenderSolidColor extends RenderDecoratedBox { 14 class RenderSolidColor extends RenderDecoratedBox {
15 final sky.Size desiredSize; 15 final sky.Size desiredSize;
16 final sky.Color backgroundColor; 16 final sky.Color backgroundColor;
17 17
18 RenderSolidColor(sky.Color backgroundColor, { this.desiredSize: sky.Size.infin ite }) 18 RenderSolidColor(sky.Color backgroundColor, { this.desiredSize: sky.Size.infin ite })
19 : backgroundColor = backgroundColor, 19 : backgroundColor = backgroundColor,
20 super(decoration: new BoxDecoration(backgroundColor: backgroundColor)) { 20 super(decoration: new BoxDecoration(backgroundColor: backgroundColor)) {
21 } 21 }
22 22
23 sky.Size getIntrinsicDimensions(BoxConstraints constraints) { 23 double getMinIntrinsicWidth(BoxConstraints constraints) {
24 return constraints.constrain(desiredSize); 24 return constraints.constrainWidth(desiredSize.width);
25 }
26
27 double getMaxIntrinsicWidth(BoxConstraints constraints) {
28 return constraints.constrainWidth(desiredSize.width);
29 }
30
31 double getMinIntrinsicHeight(BoxConstraints constraints) {
32 return constraints.constrainHeight(desiredSize.height);
33 }
34
35 double getMaxIntrinsicHeight(BoxConstraints constraints) {
36 return constraints.constrainHeight(desiredSize.height);
25 } 37 }
26 38
27 void performLayout() { 39 void performLayout() {
28 size = constraints.constrain(desiredSize); 40 size = constraints.constrain(desiredSize);
29 } 41 }
30 42
31 void handleEvent(sky.Event event) { 43 void handleEvent(sky.Event event) {
32 if (event.type == 'pointerdown') 44 if (event.type == 'pointerdown')
33 decoration = new BoxDecoration(backgroundColor: const sky.Color(0xFFFF0000 )); 45 decoration = new BoxDecoration(backgroundColor: const sky.Color(0xFFFF0000 ));
34 else if (event.type == 'pointerup') 46 else if (event.type == 'pointerup')
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 flexRoot.add(decoratedRow); 100 flexRoot.add(decoratedRow);
89 decoratedRow.parentData.flex = 3; 101 decoratedRow.parentData.flex = 3;
90 app = new TestApp(root); 102 app = new TestApp(root);
91 103
92 expect(root.size.width, equals(sky.view.width)); 104 expect(root.size.width, equals(sky.view.width));
93 expect(root.size.height, equals(sky.view.height)); 105 expect(root.size.height, equals(sky.view.height));
94 expect(renderBlock.size.width, equals(sky.view.width - 20.0)); 106 expect(renderBlock.size.width, equals(sky.view.width - 20.0));
95 107
96 }); 108 });
97 } 109 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/rendering/stack.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698