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

Side by Side Diff: sky/sdk/lib/framework/rendering/flex.dart

Issue 1181523002: Fix analyzer warnings (and probably also bugs) in flex.dart (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 | « no previous file | 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 'dart:math' as math; 5 import 'dart:math' as math;
6 import 'box.dart'; 6 import 'box.dart';
7 import 'object.dart'; 7 import 'object.dart';
8 8
9 class FlexBoxParentData extends BoxParentData with ContainerParentDataMixin<Rend erBox> { 9 class FlexBoxParentData extends BoxParentData with ContainerParentDataMixin<Rend erBox> {
10 int flex; 10 int flex;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // main direction and use those constraints to determine their max 111 // main direction and use those constraints to determine their max
112 // intrinsic size in the cross direction. We don't care if the caller 112 // intrinsic size in the cross direction. We don't care if the caller
113 // asked for max or min -- the answer is always computed using the 113 // asked for max or min -- the answer is always computed using the
114 // max size in the main direction. 114 // max size in the main direction.
115 115
116 double availableMainSpace; 116 double availableMainSpace;
117 BoxConstraints childConstraints; 117 BoxConstraints childConstraints;
118 switch(_direction) { 118 switch(_direction) {
119 case FlexDirection.horizontal: 119 case FlexDirection.horizontal:
120 childConstraints = new BoxConstraints(maxWidth: constraints.maxWidth); 120 childConstraints = new BoxConstraints(maxWidth: constraints.maxWidth);
121 availableMainSpace = innerConstraints.maxWidth; 121 availableMainSpace = constraints.maxWidth;
122 break; 122 break;
123 case FlexDirection.vertical: 123 case FlexDirection.vertical:
124 childConstraints = new BoxConstraints(maxHeight: constraints.maxHeight ); 124 childConstraints = new BoxConstraints(maxHeight: constraints.maxHeight );
125 availableMainSpace = innerConstraints.maxHeight; 125 availableMainSpace = constraints.maxHeight;
126 break; 126 break;
127 } 127 }
128 128
129 // Get inflexible space using the max in the main direction 129 // Get inflexible space using the max in the main direction
130 int totalFlex = 0; 130 int totalFlex = 0;
131 double inflexibleSpace = 0.0; 131 double inflexibleSpace = 0.0;
132 double maxCrossSize = 0.0; 132 double maxCrossSize = 0.0;
133 RenderBox child = firstChild; 133 RenderBox child = firstChild;
134 while (child != null) { 134 while (child != null) {
135 int flex = _getFlex(child); 135 int flex = _getFlex(child);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 break; 180 break;
181 } 181 }
182 maxCrossSize = math.max(maxCrossSize, crossSize); 182 maxCrossSize = math.max(maxCrossSize, crossSize);
183 } 183 }
184 child = child.parentData.nextSibling; 184 child = child.parentData.nextSibling;
185 } 185 }
186 186
187 // Ensure that we don't violate the given constraints with our result 187 // Ensure that we don't violate the given constraints with our result
188 switch(_direction) { 188 switch(_direction) {
189 case FlexDirection.horizontal: 189 case FlexDirection.horizontal:
190 return innerConstraints.constrainHeight(maxCrossSize); 190 return constraints.constrainHeight(maxCrossSize);
191 case FlexDirection.vertical: 191 case FlexDirection.vertical:
192 return innerConstraints.constrainWidth(maxCrossSize); 192 return constraints.constrainWidth(maxCrossSize);
193 } 193 }
194 } 194 }
195 } 195 }
196 196
197 double getMinIntrinsicWidth(BoxConstraints constraints) { 197 double getMinIntrinsicWidth(BoxConstraints constraints) {
198 return _getIntrinsicSize( 198 return _getIntrinsicSize(
199 constraints: constraints, 199 constraints: constraints,
200 sizingDirection: FlexDirection.horizontal, 200 sizingDirection: FlexDirection.horizontal,
201 childSize: (c, innerConstraints) => c.getMinIntrinsicWidth(innerConstraint s) 201 childSize: (c, innerConstraints) => c.getMinIntrinsicWidth(innerConstraint s)
202 ); 202 );
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 } 349 }
350 350
351 void hitTestChildren(HitTestResult result, { Point position }) { 351 void hitTestChildren(HitTestResult result, { Point position }) {
352 defaultHitTestChildren(result, position: position); 352 defaultHitTestChildren(result, position: position);
353 } 353 }
354 354
355 void paint(RenderObjectDisplayList canvas) { 355 void paint(RenderObjectDisplayList canvas) {
356 defaultPaint(canvas); 356 defaultPaint(canvas);
357 } 357 }
358 } 358 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698