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

Unified Diff: samples-dev/swarm/swarm_ui_lib/view/MeasureText.dart

Issue 2828603002: Format samples and samples-dev directories. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: samples-dev/swarm/swarm_ui_lib/view/MeasureText.dart
diff --git a/samples-dev/swarm/swarm_ui_lib/view/MeasureText.dart b/samples-dev/swarm/swarm_ui_lib/view/MeasureText.dart
index e0efed8a55c390897bbf4ed0e331634a02f6e434..8d582c55f5f6937290c3fc6c83a0592ae820d268 100644
--- a/samples-dev/swarm/swarm_ui_lib/view/MeasureText.dart
+++ b/samples-dev/swarm/swarm_ui_lib/view/MeasureText.dart
@@ -47,7 +47,7 @@ class MeasureText {
String quickTruncate(String text, num lineWidth, int maxLines) {
int targetLength = lineWidth * maxLines ~/ _typicalCharLength;
// Advance to next word break point.
- while(targetLength < text.length && !isWhitespace(text[targetLength])) {
+ while (targetLength < text.length && !isWhitespace(text[targetLength])) {
targetLength++;
}
@@ -64,8 +64,8 @@ class MeasureText {
* This function is safe to call with [:sb == null:] in which case just the
* line count is returned.
*/
- int addLineBrokenText(StringBuffer sb, String text, num lineWidth,
- int maxLines) {
+ int addLineBrokenText(
+ StringBuffer sb, String text, num lineWidth, int maxLines) {
// Strip surrounding whitespace. This ensures we create zero lines if there
// is no visible text.
text = text.trim();
@@ -112,8 +112,7 @@ class MeasureText {
return lines;
}
- void lineBreak(String text, num lineWidth, int maxLines,
- Function callback) {
+ void lineBreak(String text, num lineWidth, int maxLines, Function callback) {
_context.font = font;
int lines = 0;
num currentLength = 0;
@@ -128,8 +127,8 @@ class MeasureText {
// Treat the char after the end of the string as whitespace.
bool whitespace = i == len || isWhitespace(text[i]);
if (whitespace && !lastWhitespace) {
- num wordLength = _context.measureText(text.substring(
- wordStartIndex, i)).width;
+ num wordLength =
+ _context.measureText(text.substring(wordStartIndex, i)).width;
// TODO(jimhug): Replace the line above with this one to workaround
// dartium bug - error: unimplemented code
// num wordLength = (i - wordStartIndex) * 17;
@@ -146,7 +145,7 @@ class MeasureText {
return;
}
startIndex = wordStartIndex;
- currentLength = wordLength;
+ currentLength = wordLength;
}
lastWordEndIndex = i;
currentLength += _spaceLength;
« no previous file with comments | « samples-dev/swarm/swarm_ui_lib/view/ConveyorView.dart ('k') | samples-dev/swarm/swarm_ui_lib/view/PagedViews.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698