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

Unified Diff: sky/sdk/lib/widgets/basic.dart

Issue 1189603003: Remove RenderSizedBox. (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/tests/framework/stocks-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/basic.dart
diff --git a/sky/sdk/lib/widgets/basic.dart b/sky/sdk/lib/widgets/basic.dart
index e4ebf449df4c328463e66934086a7b3b1eb736f6..755f838f37ce9f68b9ab93ee062ed596429cd47f 100644
--- a/sky/sdk/lib/widgets/basic.dart
+++ b/sky/sdk/lib/widgets/basic.dart
@@ -143,20 +143,31 @@ class Center extends OneChildRenderObjectWrapper {
class SizedBox extends OneChildRenderObjectWrapper {
SizedBox({
- double width: double.INFINITY,
- double height: double.INFINITY,
+ this.width,
+ this.height,
UINode child,
Object key
- }) : desiredSize = new Size(width, height), super(child: child, key: key);
+ }) : super(child: child, key: key);
+
+ RenderConstrainedBox get root { RenderConstrainedBox result = super.root; return result; }
+
+ final double width;
+ final double height;
- RenderSizedBox get root { RenderSizedBox result = super.root; return result; }
- final Size desiredSize;
+ RenderConstrainedBox createNode() => new RenderConstrainedBox(additionalConstraints: _getConstraints());
- RenderSizedBox createNode() => new RenderSizedBox(desiredSize: desiredSize);
+ BoxConstraints _getConstraints() {
abarth-chromium 2015/06/15 22:50:55 BoxConstraints get _additionalConstraints { ... }
+ var result = const BoxConstraints();
+ if (width != null)
+ result = result.applyWidth(width);
+ if (height != null)
+ result = result.applyHeight(height);
+ return result;
+ }
void syncRenderObject(SizedBox old) {
super.syncRenderObject(old);
- root.desiredSize = desiredSize;
+ root.additionalConstraints = _getConstraints();
}
}
@@ -240,7 +251,10 @@ class Container extends Component {
UINode current = child;
if (child == null && width == null && height == null)
- current = new SizedBox();
+ current = new SizedBox(
+ width: double.INFINITY,
+ height: double.INFINITY
+ );
if (padding != null)
current = new Padding(padding: padding, child: current);
@@ -250,8 +264,8 @@ class Container extends Component {
if (width != null || height != null)
current = new SizedBox(
- width: width == null ? double.INFINITY : width,
- height: height == null ? double.INFINITY : height,
+ width: width,
+ height: height,
child: current
);
« no previous file with comments | « sky/sdk/lib/rendering/object.dart ('k') | sky/tests/framework/stocks-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698