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

Unified Diff: sky/sdk/lib/framework/rendering/box.dart

Issue 1155303005: Fix logic in RenderPadding. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/sdk/lib/framework/rendering/block.dart ('k') | sky/tests/raw/box_layout.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/framework/rendering/box.dart
diff --git a/sky/sdk/lib/framework/rendering/box.dart b/sky/sdk/lib/framework/rendering/box.dart
index b3ee6cddf6301afcd9e11f8c81bb8c84460ba568..a749a33379b567baa1cac0e04f874733946ef80c 100644
--- a/sky/sdk/lib/framework/rendering/box.dart
+++ b/sky/sdk/lib/framework/rendering/box.dart
@@ -4,6 +4,7 @@
import 'node.dart';
import 'dart:sky' as sky;
+import 'dart:math' as math;
// GENERIC BOX RENDERING
// Anything that has a concept of x, y, width, height is going to derive from this
@@ -40,11 +41,13 @@ class BoxConstraints {
BoxConstraints deflate(EdgeDims edges) {
assert(edges != null);
+ var horizontal = edges.left + edges.right;
+ var vertical = edges.top + edges.bottom;
abarth-chromium 2015/06/03 17:22:33 s/var/double/
return new BoxConstraints(
- minWidth: minWidth,
- maxWidth: maxWidth - (edges.left + edges.right),
- minHeight: minHeight,
- maxHeight: maxHeight - (edges.top + edges.bottom)
+ minWidth: math.min(0.0, minWidth - horizontal),
+ maxWidth: maxWidth - horizontal,
+ minHeight: math.min(0.0, minHeight - vertical),
+ maxHeight: maxHeight - vertical
);
}
@@ -171,7 +174,8 @@ class RenderSizedBox extends RenderProxyBox {
void performLayout() {
size = constraints.constrain(_desiredSize);
- child.layout(new BoxConstraints.tight(size));
+ if (child != null)
+ child.layout(new BoxConstraints.tight(size));
}
}
« no previous file with comments | « sky/sdk/lib/framework/rendering/block.dart ('k') | sky/tests/raw/box_layout.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698