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

Unified Diff: utils/css/tokenkind.dart

Issue 10010009: Calculator App for ChromeOS with fixes for templates/CSS to support this application. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Mininimal templates and more text node tests. Created 8 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 side-by-side diff with in-line comments
Download patch
Index: utils/css/tokenkind.dart
diff --git a/utils/css/tokenkind.dart b/utils/css/tokenkind.dart
index 7f2f2346ab5419f0ef287f83ebbdc7956e4d4741..192e94cab334f5ecdd5c0cbd61bd70bbffd71b3d 100644
--- a/utils/css/tokenkind.dart
+++ b/utils/css/tokenkind.dart
@@ -470,7 +470,7 @@ class TokenKind {
throw new NoColorMatchException(text);
}
- static String decimalToHex(int num) {
+ static String decimalToHex(int num, [int minDigits = 1]) {
final String _HEX_DIGITS = '0123456789abcdef';
List<String> result = new List<String>();
@@ -485,9 +485,14 @@ class TokenKind {
}
StringBuffer invertResult = new StringBuffer();
+ int paddings = minDigits - result.length;
+ while (paddings-- > 0) {
+ invertResult.add('0');
+ }
for (int idx = result.length - 1; idx >= 0; idx--) {
invertResult.add(result[idx]);
}
+
return invertResult.toString();
}

Powered by Google App Engine
This is Rietveld 408576698