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

Side by Side Diff: samples/ui_lib/layout/ViewLayout.dart

Issue 11235054: Removed IllegalAccessException and UnsupportedOperationException. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: ADded test expectations. Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/ui_lib/layout/SizingFunctions.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** The interface that the layout algorithms use to talk to the view. */ 5 /** The interface that the layout algorithms use to talk to the view. */
6 abstract class Positionable { 6 abstract class Positionable {
7 ViewLayout get layout; 7 ViewLayout get layout;
8 8
9 /** Gets our custom CSS properties, as provided by the CSS preprocessor. */ 9 /** Gets our custom CSS properties, as provided by the CSS preprocessor. */
10 Map<String, String> get customStyle; 10 Map<String, String> get customStyle;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 return _styleToPixels( 206 return _styleToPixels(
207 style.maxHeight, currentHeight, parent.currentHeight); 207 style.maxHeight, currentHeight, parent.currentHeight);
208 } 208 }
209 } 209 }
210 210
211 static int _toPixels(String style) { 211 static int _toPixels(String style) {
212 if (style.endsWith('px')) { 212 if (style.endsWith('px')) {
213 return int.parse(style.substring(0, style.length - 2)); 213 return int.parse(style.substring(0, style.length - 2));
214 } else { 214 } else {
215 // TODO(jmesserly): other size units 215 // TODO(jmesserly): other size units
216 throw new UnsupportedOperationException( 216 throw new UnsupportedError(
217 'Unknown min/max content size format: "$style"'); 217 'Unknown min/max content size format: "$style"');
218 } 218 }
219 } 219 }
220 220
221 static int _styleToPixels(String style, num size, num parentSize) { 221 static int _styleToPixels(String style, num size, num parentSize) {
222 if (style == 'none') { 222 if (style == 'none') {
223 // For an unset max-content size, use the actual size 223 // For an unset max-content size, use the actual size
224 return size; 224 return size;
225 } 225 }
226 if (style.endsWith('%')) { 226 if (style.endsWith('%')) {
227 num percent = double.parse(style.substring(0, style.length - 1)); 227 num percent = double.parse(style.substring(0, style.length - 1));
228 return ((percent / 100) * parentSize).toInt(); 228 return ((percent / 100) * parentSize).toInt();
229 } 229 }
230 return _toPixels(style); 230 return _toPixels(style);
231 } 231 }
232 } 232 }
OLDNEW
« no previous file with comments | « samples/ui_lib/layout/SizingFunctions.dart ('k') | tests/co19/co19-dart2dart.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698