From 96aadc99b4cf5cc3ee59b3277f8252ee87ab1d42 Mon Sep 17 00:00:00 2001 From: Hixie Date: Thu, 4 Jun 2015 16:17:20 -0700 Subject: [PATCH] Rename "BorderSide.None" to "BorderSide.none", since it's a constant, and change the sky.Size.infinite() constructor to a constant. R=abarth@chromium.org Review URL: https://codereview.chromium.org/1158263005 --- engine/core/painting/Size.dart | 4 ++-- examples/game/lib/sprite_box.dart | 4 ++-- examples/raw/ink_well.dart | 2 +- examples/raw/touch_demo.dart | 2 +- sdk/lib/framework/components2/drawer.dart | 2 +- sdk/lib/framework/components2/scaffold.dart | 2 +- sdk/lib/framework/rendering/box.dart | 12 ++++++------ sdk/lib/framework/rendering/stack.dart | 4 ++-- tests/raw/render_flex.dart | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/engine/core/painting/Size.dart b/engine/core/painting/Size.dart index 0339cf20a..6747a6552 100644 --- a/engine/core/painting/Size.dart +++ b/engine/core/painting/Size.dart @@ -12,11 +12,11 @@ class Size { const Size(this.width, this.height); - const Size.infinite() : width = double.INFINITY, height = double.INFINITY; - const Size.fromWidth(this.width) : height = double.INFINITY; const Size.fromHeight(this.height) : width = double.INFINITY; + static const Size infinite = const Size(double.INFINITY, double.INFINITY); + bool operator ==(other) => other is Size && width == other.width && height == other.height; // does the equivalent of "return new Point(0,0) + this" diff --git a/examples/game/lib/sprite_box.dart b/examples/game/lib/sprite_box.dart index 8c8f66b57..01c34f9f2 100644 --- a/examples/game/lib/sprite_box.dart +++ b/examples/game/lib/sprite_box.dart @@ -38,7 +38,7 @@ class SpriteBox extends RenderBox { double get systemHeight => _systemHeight; void performLayout() { - size = constraints.constrain(new Size.infinite()); + size = constraints.constrain(Size.infinite); } void handleEvent(Event event) { @@ -136,4 +136,4 @@ class SpriteBox extends RenderBox { _rootNode.update(delta); _scheduleTick(); } -} \ No newline at end of file +} diff --git a/examples/raw/ink_well.dart b/examples/raw/ink_well.dart index afd28dbfd..b2a104cd4 100644 --- a/examples/raw/ink_well.dart +++ b/examples/raw/ink_well.dart @@ -52,7 +52,7 @@ class InkWell extends RenderBox { } void performLayout() { - size = constraints.constrain(new sky.Size.infinite()); + size = constraints.constrain(sky.Size.infinite); } void paint(RenderObjectDisplayList canvas) { diff --git a/examples/raw/touch_demo.dart b/examples/raw/touch_demo.dart index 180c327fd..c6ece943f 100644 --- a/examples/raw/touch_demo.dart +++ b/examples/raw/touch_demo.dart @@ -62,7 +62,7 @@ class RenderTouchDemo extends RenderBox { } void performLayout() { - size = constraints.constrain(new Size.infinite()); + size = constraints.constrain(Size.infinite); } void paint(RenderObjectDisplayList canvas) { diff --git a/sdk/lib/framework/components2/drawer.dart b/sdk/lib/framework/components2/drawer.dart index c3e0155a5..c23ec7d09 100644 --- a/sdk/lib/framework/components2/drawer.dart +++ b/sdk/lib/framework/components2/drawer.dart @@ -115,7 +115,7 @@ class Drawer extends AnimatedComponent { var mask = new EventListenerNode( new Container( - desiredSize: new sky.Size.infinite(), + desiredSize: sky.Size.infinite, decoration: new BoxDecoration(backgroundColor: maskColor) ), onGestureTap: controller.handleMaskTap, diff --git a/sdk/lib/framework/components2/scaffold.dart b/sdk/lib/framework/components2/scaffold.dart index fc58d2d5f..173c3f1f2 100644 --- a/sdk/lib/framework/components2/scaffold.dart +++ b/sdk/lib/framework/components2/scaffold.dart @@ -75,7 +75,7 @@ class RenderScaffold extends RenderBox { bool get sizedByParent => true; void performResize() { - size = constraints.constrain(new sky.Size.infinite()); + size = constraints.constrain(sky.Size.infinite); assert(size.width < double.INFINITY); assert(size.height < double.INFINITY); } diff --git a/sdk/lib/framework/rendering/box.dart b/sdk/lib/framework/rendering/box.dart index cd02fdb41..c6c878354 100644 --- a/sdk/lib/framework/rendering/box.dart +++ b/sdk/lib/framework/rendering/box.dart @@ -191,7 +191,7 @@ class RenderSizedBox extends RenderProxyBox { RenderSizedBox({ RenderBox child, - sky.Size desiredSize: const sky.Size.infinite() + sky.Size desiredSize: sky.Size.infinite }) : super(child) { assert(desiredSize != null); this.desiredSize = desiredSize; @@ -377,7 +377,7 @@ class BorderSide { final sky.Color color; final double width; - static const None = const BorderSide(width: 0.0); + static const none = const BorderSide(width: 0.0); int get hashCode { int value = 373; @@ -390,10 +390,10 @@ class BorderSide { class Border { const Border({ - this.top: BorderSide.None, - this.right: BorderSide.None, - this.bottom: BorderSide.None, - this.left: BorderSide.None + this.top: BorderSide.none, + this.right: BorderSide.none, + this.bottom: BorderSide.none, + this.left: BorderSide.none }); const Border.all(BorderSide side) : top = side, diff --git a/sdk/lib/framework/rendering/stack.dart b/sdk/lib/framework/rendering/stack.dart index 44e1a7f59..80f7bec7b 100644 --- a/sdk/lib/framework/rendering/stack.dart +++ b/sdk/lib/framework/rendering/stack.dart @@ -23,11 +23,11 @@ class RenderStack extends RenderBox with ContainerRenderObjectMixin