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

Unified Diff: samples/ui_lib/layout/ViewLayout.dart

Issue 10409003: Eliminate switches that are not on const ints or strings (as required in spec 0.09). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« lib/json/json.dart ('K') | « samples/ui_lib/layout/GridLayout.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/ui_lib/layout/ViewLayout.dart
===================================================================
--- samples/ui_lib/layout/ViewLayout.dart (revision 7713)
+++ samples/ui_lib/layout/ViewLayout.dart (working copy)
@@ -179,37 +179,32 @@
int measureContent(ViewLayout parent, Dimension dimension,
[ContentSizeMode mode = null]) {
- switch (dimension) {
- case Dimension.WIDTH:
- return measureWidth(parent, mode);
- case Dimension.HEIGHT:
- return measureHeight(parent, mode);
+ if (dimension == Dimension.WIDTH) {
+ return measureWidth(parent, mode);
+ } else if (dimension == Dimension.HEIGHT) {
+ return measureHeight(parent, mode);
}
}
int measureWidth(ViewLayout parent, ContentSizeMode mode) {
final style = layoutParams.style.value;
- switch (mode) {
- case ContentSizeMode.MIN:
- return _styleToPixels(
- style.minWidth, currentWidth, parent.currentWidth);
-
- case ContentSizeMode.MAX:
- return _styleToPixels(
- style.maxWidth, currentWidth, parent.currentWidth);
+ if (mode == ContentSizeMode.MIN) {
+ return _styleToPixels(
+ style.minWidth, currentWidth, parent.currentWidth);
+ } else if (mode == ContentSizeMode.MAX) {
+ return _styleToPixels(
+ style.maxWidth, currentWidth, parent.currentWidth);
}
}
int measureHeight(ViewLayout parent, ContentSizeMode mode) {
final style = layoutParams.style.value;
- switch (mode) {
- case ContentSizeMode.MIN:
- return _styleToPixels(
- style.minHeight, currentHeight, parent.currentHeight);
-
- case ContentSizeMode.MAX:
- return _styleToPixels(
- style.maxHeight, currentHeight, parent.currentHeight);
+ if (mode == ContentSizeMode.MIN) {
+ return _styleToPixels(
+ style.minHeight, currentHeight, parent.currentHeight);
+ } else if (mode == ContentSizeMode.MAX) {
+ return _styleToPixels(
+ style.maxHeight, currentHeight, parent.currentHeight);
}
}
« lib/json/json.dart ('K') | « samples/ui_lib/layout/GridLayout.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698