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

Side by Side Diff: sky/sdk/lib/rendering/stack.dart

Issue 1209233002: Let's hide double.INFINITY a bit more, by providing cleaner APIs for the cases where we're currentl… (Closed) Base URL: https://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/rendering/box.dart ('k') | sky/sdk/lib/widgets/basic.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 'dart:math' as math; 5 import 'dart:math' as math;
6 6
7 import 'box.dart'; 7 import 'box.dart';
8 import 'object.dart'; 8 import 'object.dart';
9 9
10 class StackParentData extends BoxParentData with ContainerParentDataMixin<Render Box> { 10 class StackParentData extends BoxParentData with ContainerParentDataMixin<Render Box> {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 RenderBox child = firstChild; 63 RenderBox child = firstChild;
64 while (child != null) { 64 while (child != null) {
65 assert(child.parentData is StackParentData); 65 assert(child.parentData is StackParentData);
66 if (!child.parentData.isPositioned) { 66 if (!child.parentData.isPositioned) {
67 hasNonPositionedChildren = true; 67 hasNonPositionedChildren = true;
68 width = math.max(width, child.getMaxIntrinsicWidth(constraints)); 68 width = math.max(width, child.getMaxIntrinsicWidth(constraints));
69 } 69 }
70 child = child.parentData.nextSibling; 70 child = child.parentData.nextSibling;
71 } 71 }
72 if (!hasNonPositionedChildren) 72 if (!hasNonPositionedChildren)
73 return constraints.constrainWidth(double.INFINITY); 73 return constraints.constrainWidth();
74 assert(width == constraints.constrainWidth(width)); 74 assert(width == constraints.constrainWidth(width));
75 return width; 75 return width;
76 } 76 }
77 77
78 double getMinIntrinsicHeight(BoxConstraints constraints) { 78 double getMinIntrinsicHeight(BoxConstraints constraints) {
79 double height = constraints.minHeight; 79 double height = constraints.minHeight;
80 RenderBox child = firstChild; 80 RenderBox child = firstChild;
81 while (child != null) { 81 while (child != null) {
82 assert(child.parentData is StackParentData); 82 assert(child.parentData is StackParentData);
83 if (!child.parentData.isPositioned) 83 if (!child.parentData.isPositioned)
(...skipping 10 matching lines...) Expand all
94 RenderBox child = firstChild; 94 RenderBox child = firstChild;
95 while (child != null) { 95 while (child != null) {
96 assert(child.parentData is StackParentData); 96 assert(child.parentData is StackParentData);
97 if (!child.parentData.isPositioned) { 97 if (!child.parentData.isPositioned) {
98 hasNonPositionedChildren = true; 98 hasNonPositionedChildren = true;
99 height = math.max(height, child.getMaxIntrinsicHeight(constraints)); 99 height = math.max(height, child.getMaxIntrinsicHeight(constraints));
100 } 100 }
101 child = child.parentData.nextSibling; 101 child = child.parentData.nextSibling;
102 } 102 }
103 if (!hasNonPositionedChildren) 103 if (!hasNonPositionedChildren)
104 return constraints.constrainHeight(double.INFINITY); 104 return constraints.constrainHeight();
105 assert(height == constraints.constrainHeight(height)); 105 assert(height == constraints.constrainHeight(height));
106 return height; 106 return height;
107 } 107 }
108 108
109 double getDistanceToActualBaseline(TextBaseline baseline) { 109 double getDistanceToActualBaseline(TextBaseline baseline) {
110 return defaultGetDistanceToHighestActualBaseline(baseline); 110 return defaultGetDistanceToHighestActualBaseline(baseline);
111 } 111 }
112 112
113 void performLayout() { 113 void performLayout() {
114 bool hasNonPositionedChildren = false; 114 bool hasNonPositionedChildren = false;
(...skipping 18 matching lines...) Expand all
133 } 133 }
134 134
135 child = parentData.nextSibling; 135 child = parentData.nextSibling;
136 } 136 }
137 137
138 if (hasNonPositionedChildren) 138 if (hasNonPositionedChildren)
139 size = new Size(width, height); 139 size = new Size(width, height);
140 else 140 else
141 size = constraints.constrain(Size.infinite); 141 size = constraints.constrain(Size.infinite);
142 142
143 assert(size.width < double.INFINITY); 143 assert(!size.isInfinite);
144 assert(size.height < double.INFINITY);
145 assert(size.width == constraints.constrainWidth(width)); 144 assert(size.width == constraints.constrainWidth(width));
146 assert(size.height == constraints.constrainHeight(height)); 145 assert(size.height == constraints.constrainHeight(height));
147 146
148 BoxConstraints innerConstraints = new BoxConstraints.loose(size); 147 BoxConstraints innerConstraints = new BoxConstraints.loose(size);
149 148
150 child = firstChild; 149 child = firstChild;
151 while (child != null) { 150 while (child != null) {
152 assert(child.parentData is StackParentData); 151 assert(child.parentData is StackParentData);
153 final StackParentData parentData = child.parentData; 152 final StackParentData parentData = child.parentData;
154 153
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 192 }
194 193
195 void hitTestChildren(HitTestResult result, { Point position }) { 194 void hitTestChildren(HitTestResult result, { Point position }) {
196 defaultHitTestChildren(result, position: position); 195 defaultHitTestChildren(result, position: position);
197 } 196 }
198 197
199 void paint(RenderCanvas canvas) { 198 void paint(RenderCanvas canvas) {
200 defaultPaint(canvas); 199 defaultPaint(canvas);
201 } 200 }
202 } 201 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/rendering/box.dart ('k') | sky/sdk/lib/widgets/basic.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698