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

Side by Side Diff: tools/dom/src/Dimension.dart

Issue 2827793002: Format all files under tools and utils directory. (Closed)
Patch Set: Format all files under tools and utils directory. Created 3 years, 8 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
« no previous file with comments | « tools/dom/src/CssRectangle.dart ('k') | tools/dom/src/EventStreamProvider.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 part of html; 1 part of html;
2 2
3 /** 3 /**
4 * Class representing a 4 * Class representing a
5 * [length measurement](https://developer.mozilla.org/en-US/docs/Web/CSS/length) 5 * [length measurement](https://developer.mozilla.org/en-US/docs/Web/CSS/length)
6 * in CSS. 6 * in CSS.
7 */ 7 */
8 @Experimental() 8 @Experimental()
9 class Dimension { 9 class Dimension {
10 num _value; 10 num _value;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 * FormatError. 59 * FormatError.
60 */ 60 */
61 Dimension.css(String cssValue) { 61 Dimension.css(String cssValue) {
62 if (cssValue == '') cssValue = '0px'; 62 if (cssValue == '') cssValue = '0px';
63 if (cssValue.endsWith('%')) { 63 if (cssValue.endsWith('%')) {
64 _unit = '%'; 64 _unit = '%';
65 } else { 65 } else {
66 _unit = cssValue.substring(cssValue.length - 2); 66 _unit = cssValue.substring(cssValue.length - 2);
67 } 67 }
68 if (cssValue.contains('.')) { 68 if (cssValue.contains('.')) {
69 _value = double.parse(cssValue.substring(0, 69 _value =
70 cssValue.length - _unit.length)); 70 double.parse(cssValue.substring(0, cssValue.length - _unit.length));
71 } else { 71 } else {
72 _value = int.parse(cssValue.substring(0, cssValue.length - _unit.length)); 72 _value = int.parse(cssValue.substring(0, cssValue.length - _unit.length));
73 } 73 }
74 } 74 }
75 75
76 /** Print out the CSS String representation of this value. */ 76 /** Print out the CSS String representation of this value. */
77 String toString() { 77 String toString() {
78 return '${_value}${_unit}'; 78 return '${_value}${_unit}';
79 } 79 }
80 80
81 /** Return a unitless, numerical value of this CSS value. */ 81 /** Return a unitless, numerical value of this CSS value. */
82 num get value => this._value; 82 num get value => this._value;
83 } 83 }
OLDNEW
« no previous file with comments | « tools/dom/src/CssRectangle.dart ('k') | tools/dom/src/EventStreamProvider.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698