Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 136a057

Browse files
authored
[web] Rename LineMetrics.text to LineMetrics.displayText (#16734)
1 parent 941aee3 commit 136a057

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

lib/web_ui/lib/src/engine/bitmap_canvas.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ class BitmapCanvas extends EngineCanvas {
447447
x += line.left;
448448
final double letterSpacing = style.letterSpacing;
449449
if (letterSpacing == null || letterSpacing == 0.0) {
450-
ctx.fillText(line.text, x, y);
450+
ctx.fillText(line.displayText, x, y);
451451
} else {
452452
// When letter-spacing is set, we go through a more expensive code path
453453
// that renders each character separately with the correct spacing
@@ -459,9 +459,9 @@ class BitmapCanvas extends EngineCanvas {
459459
// would put 5px before each letter and 5px after it, but on the web, we
460460
// put no spacing before the letter and 10px after it. This is how the DOM
461461
// does it.
462-
final int len = line.text.length;
462+
final int len = line.displayText.length;
463463
for (int i = 0; i < len; i++) {
464-
final String char = line.text[i];
464+
final String char = line.displayText[i];
465465
ctx.fillText(char, x, y);
466466
x += letterSpacing + ctx.measureText(char).width;
467467
}

lib/web_ui/lib/src/engine/text/paragraph.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ class EngineLineMetrics implements ui.LineMetrics {
1616
this.left,
1717
this.baseline,
1818
this.lineNumber,
19-
}) : text = null,
19+
}) : displayText = null,
2020
startIndex = -1,
2121
endIndex = -1,
2222
endIndexWithoutNewlines = -1;
2323

2424
EngineLineMetrics.withText(
25-
this.text, {
25+
this.displayText, {
2626
@required this.startIndex,
2727
@required this.endIndex,
2828
@required this.endIndexWithoutNewlines,
@@ -35,7 +35,7 @@ class EngineLineMetrics implements ui.LineMetrics {
3535
@required this.left,
3636
this.baseline,
3737
@required this.lineNumber,
38-
}) : assert(text != null),
38+
}) : assert(displayText != null),
3939
assert(startIndex != null),
4040
assert(endIndex != null),
4141
assert(endIndexWithoutNewlines != null),
@@ -44,8 +44,8 @@ class EngineLineMetrics implements ui.LineMetrics {
4444
assert(left != null),
4545
assert(lineNumber != null && lineNumber >= 0);
4646

47-
/// The textual content representing this line.
48-
final String text;
47+
/// The text to be rendered on the screen representing this line.
48+
final String displayText;
4949

5050
/// The index (inclusive) in the text where this line begins.
5151
final int startIndex;
@@ -89,7 +89,7 @@ class EngineLineMetrics implements ui.LineMetrics {
8989

9090
@override
9191
int get hashCode => ui.hashValues(
92-
text,
92+
displayText,
9393
startIndex,
9494
endIndex,
9595
hardBreak,
@@ -113,7 +113,7 @@ class EngineLineMetrics implements ui.LineMetrics {
113113
return false;
114114
}
115115
final EngineLineMetrics typedOther = other;
116-
return text == typedOther.text &&
116+
return displayText == typedOther.displayText &&
117117
startIndex == typedOther.startIndex &&
118118
endIndex == typedOther.endIndex &&
119119
hardBreak == typedOther.hardBreak &&

lib/web_ui/test/text/measurement_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ void main() async {
11381138

11391139
/// Shortcut to avoid many line wraps in the tests above.
11401140
EngineLineMetrics line(
1141-
String text,
1141+
String displayText,
11421142
int startIndex,
11431143
int endIndex, {
11441144
double width,
@@ -1147,7 +1147,7 @@ EngineLineMetrics line(
11471147
double left,
11481148
}) {
11491149
return EngineLineMetrics.withText(
1150-
text,
1150+
displayText,
11511151
startIndex: startIndex,
11521152
endIndex: endIndex,
11531153
hardBreak: hardBreak,

0 commit comments

Comments
 (0)