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

Side by Side Diff: sky/sdk/lib/framework/rendering/stack.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/paragraph.dart ('k') | sky/tests/raw/render_flex.dart » ('j') | 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 'box.dart'; 5 import 'box.dart';
6 import 'object.dart'; 6 import 'object.dart';
7 7
8 class StackParentData extends BoxParentData with ContainerParentDataMixin<Render Box> { } 8 class StackParentData extends BoxParentData with ContainerParentDataMixin<Render Box> { }
9 9
10 class RenderStack extends RenderBox with ContainerRenderObjectMixin<RenderBox, S tackParentData>, 10 class RenderStack extends RenderBox with ContainerRenderObjectMixin<RenderBox, S tackParentData>,
11 RenderBoxContainerDefaultsMixin<RenderB ox, StackParentData> { 11 RenderBoxContainerDefaultsMixin<RenderB ox, StackParentData> {
12 RenderStack({ 12 RenderStack({
13 List<RenderBox> children 13 List<RenderBox> children
14 }) { 14 }) {
15 if (children != null) 15 if (children != null)
16 children.forEach((child) { add(child); }); 16 children.forEach((child) { add(child); });
17 } 17 }
18 18
19 void setParentData(RenderBox child) { 19 void setParentData(RenderBox child) {
20 if (child.parentData is! StackParentData) 20 if (child.parentData is! StackParentData)
21 child.parentData = new StackParentData(); 21 child.parentData = new StackParentData();
22 } 22 }
23 23
24 Size getIntrinsicDimensions(BoxConstraints constraints) { 24 double getMinIntrinsicWidth(BoxConstraints constraints) {
25 return constraints.constrain(Size.infinite); 25 return constraints.constrainWidth(double.INFINITY);
26 }
27
28 double getMaxIntrinsicWidth(BoxConstraints constraints) {
29 return constraints.constrainWidth(double.INFINITY);
30 }
31
32 double getMinIntrinsicHeight(BoxConstraints constraints) {
33 return constraints.constrainHeight(double.INFINITY);
34 }
35
36 double getMaxIntrinsicHeight(BoxConstraints constraints) {
37 return constraints.constrainHeight(double.INFINITY);
26 } 38 }
27 39
28 void performLayout() { 40 void performLayout() {
29 size = constraints.constrain(Size.infinite); 41 size = constraints.constrain(Size.infinite);
30 assert(size.width < double.INFINITY); 42 assert(size.width < double.INFINITY);
31 assert(size.height < double.INFINITY); 43 assert(size.height < double.INFINITY);
32 BoxConstraints innerConstraints = new BoxConstraints.loose(size); 44 BoxConstraints innerConstraints = new BoxConstraints.loose(size);
33 45
34 RenderBox child = firstChild; 46 RenderBox child = firstChild;
35 while (child != null) { 47 while (child != null) {
36 child.layout(innerConstraints); 48 child.layout(innerConstraints);
37 assert(child.parentData is StackParentData); 49 assert(child.parentData is StackParentData);
38 child.parentData.position = Point.origin; 50 child.parentData.position = Point.origin;
39 child = child.parentData.nextSibling; 51 child = child.parentData.nextSibling;
40 } 52 }
41 } 53 }
42 54
43 void hitTestChildren(HitTestResult result, { Point position }) { 55 void hitTestChildren(HitTestResult result, { Point position }) {
44 defaultHitTestChildren(result, position: position); 56 defaultHitTestChildren(result, position: position);
45 } 57 }
46 58
47 void paint(RenderObjectDisplayList canvas) { 59 void paint(RenderObjectDisplayList canvas) {
48 defaultPaint(canvas); 60 defaultPaint(canvas);
49 } 61 }
50 } 62 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/rendering/paragraph.dart ('k') | sky/tests/raw/render_flex.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698