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

Unified Diff: sky/sdk/lib/rendering/stack.dart

Issue 1213473003: Add asserts to catch potential misuses of the rendering framework. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/sdk/lib/rendering/object.dart ('k') | sky/sdk/lib/widgets/scaffold.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/rendering/stack.dart
diff --git a/sky/sdk/lib/rendering/stack.dart b/sky/sdk/lib/rendering/stack.dart
index be73d6f1aa4e4dd071f53d1f2c63b2601fcd18c7..33563e61bf9ea72aef3808f9aacbb4254250b0f5 100644
--- a/sky/sdk/lib/rendering/stack.dart
+++ b/sky/sdk/lib/rendering/stack.dart
@@ -150,45 +150,45 @@ class RenderStack extends RenderBox with ContainerRenderObjectMixin<RenderBox, S
child = firstChild;
while (child != null) {
assert(child.parentData is StackParentData);
- final StackParentData parentData = child.parentData;
+ final StackParentData childData = child.parentData;
- if (parentData.isPositioned) {
+ if (childData.isPositioned) {
BoxConstraints childConstraints = innerConstraints;
- if (parentData.left != null && parentData.right != null)
- childConstraints = childConstraints.applyWidth(parentData.right - parentData.left);
- else if (parentData.left != null)
- childConstraints = childConstraints.applyMaxWidth(size.width - parentData.left);
- else if (parentData.right != null)
- childConstraints = childConstraints.applyMaxWidth(size.width - parentData.right);
+ if (childData.left != null && childData.right != null)
+ childConstraints = childConstraints.applyWidth(childData.right - childData.left);
+ else if (childData.left != null)
+ childConstraints = childConstraints.applyMaxWidth(size.width - childData.left);
+ else if (childData.right != null)
+ childConstraints = childConstraints.applyMaxWidth(size.width - childData.right);
- if (parentData.top != null && parentData.bottom != null)
- childConstraints = childConstraints.applyHeight(parentData.bottom - parentData.top);
- else if (parentData.top != null)
- childConstraints = childConstraints.applyMaxHeight(size.height - parentData.top);
- else if (parentData.bottom != null)
- childConstraints = childConstraints.applyMaxHeight(size.width - parentData.bottom);
+ if (childData.top != null && childData.bottom != null)
+ childConstraints = childConstraints.applyHeight(childData.bottom - childData.top);
+ else if (childData.top != null)
+ childConstraints = childConstraints.applyMaxHeight(size.height - childData.top);
+ else if (childData.bottom != null)
+ childConstraints = childConstraints.applyMaxHeight(size.width - childData.bottom);
- child.layout(childConstraints);
+ child.layout(childConstraints, parentUsesSize: true);
double x = 0.0;
- if (parentData.left != null)
- x = parentData.left;
- else if (parentData.right != null)
- x = size.width - parentData.right - child.size.width;
+ if (childData.left != null)
+ x = childData.left;
+ else if (childData.right != null)
+ x = size.width - childData.right - child.size.width;
assert(x >= 0.0 && x + child.size.width <= size.width);
double y = 0.0;
- if (parentData.top != null)
- y = parentData.top;
- else if (parentData.bottom != null)
- y = size.height - parentData.bottom - child.size.height;
+ if (childData.top != null)
+ y = childData.top;
+ else if (childData.bottom != null)
+ y = size.height - childData.bottom - child.size.height;
assert(y >= 0.0 && y + child.size.height <= size.height);
- parentData.position = new Point(x, y);
+ childData.position = new Point(x, y);
}
- child = parentData.nextSibling;
+ child = childData.nextSibling;
}
}
« no previous file with comments | « sky/sdk/lib/rendering/object.dart ('k') | sky/sdk/lib/widgets/scaffold.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698