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

Unified Diff: sky/sdk/lib/framework/fn2.dart

Issue 1156303004: Use Point, Size, and Rect in layout2.dart (Closed) Base URL: git@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
Index: sky/sdk/lib/framework/fn2.dart
diff --git a/sky/sdk/lib/framework/fn2.dart b/sky/sdk/lib/framework/fn2.dart
index a83535857bbe69f40d63e7c73b6169cb15a69855..7d9d5afe4708c6b686ba4f8c284df5ec3dee32a6 100644
--- a/sky/sdk/lib/framework/fn2.dart
+++ b/sky/sdk/lib/framework/fn2.dart
@@ -943,24 +943,21 @@ class Text extends Component {
// for now, but only for now:
class RenderSolidColor extends RenderDecoratedBox {
- final double desiredHeight;
- final double desiredWidth;
+ final sky.Size desiredSize;
final int backgroundColor;
- RenderSolidColor(int backgroundColor, { this.desiredHeight: double.INFINITY,
- this.desiredWidth: double.INFINITY })
+ RenderSolidColor(int backgroundColor, { this.desiredSize })
Hixie 2015/05/28 18:45:22 If it's a required argument (which it appears it n
: backgroundColor = backgroundColor,
super(new BoxDecoration(backgroundColor: backgroundColor));
BoxDimensions getIntrinsicDimensions(BoxConstraints constraints) {
return new BoxDimensions.withConstraints(constraints,
Hixie 2015/05/28 18:45:22 What if desiredSize is null?
- height: desiredHeight,
- width: desiredWidth);
+ width: desiredSize.width,
+ height: desiredSize.height);
}
void layout(BoxConstraints constraints, { RenderNode relayoutSubtreeRoot }) {
- width = constraints.constrainWidth(desiredWidth);
- height = constraints.constrainHeight(desiredHeight);
+ size = constraints.constrain(desiredSize);
layoutDone();
}
@@ -983,7 +980,7 @@ class Rectangle extends RenderNodeWrapper {
final int color;
RenderSolidColor root;
- RenderSolidColor createNode() => new RenderSolidColor(color, desiredWidth: 40.0, desiredHeight: 130.0);
+ RenderSolidColor createNode() => new RenderSolidColor(color, desiredSize: new sky.Size(40.0, 130.0));
static final Rectangle _emptyRectangle = new Rectangle(0);
RenderNodeWrapper get emptyNode => _emptyRectangle;

Powered by Google App Engine
This is Rietveld 408576698