forked from firka/flutter
[web] Rename LineMetrics.text to LineMetrics.displayText (flutter/engine#16734)
This commit is contained in:
@@ -447,7 +447,7 @@ class BitmapCanvas extends EngineCanvas {
|
||||
x += line.left;
|
||||
final double letterSpacing = style.letterSpacing;
|
||||
if (letterSpacing == null || letterSpacing == 0.0) {
|
||||
ctx.fillText(line.text, x, y);
|
||||
ctx.fillText(line.displayText, x, y);
|
||||
} else {
|
||||
// When letter-spacing is set, we go through a more expensive code path
|
||||
// that renders each character separately with the correct spacing
|
||||
@@ -459,9 +459,9 @@ class BitmapCanvas extends EngineCanvas {
|
||||
// would put 5px before each letter and 5px after it, but on the web, we
|
||||
// put no spacing before the letter and 10px after it. This is how the DOM
|
||||
// does it.
|
||||
final int len = line.text.length;
|
||||
final int len = line.displayText.length;
|
||||
for (int i = 0; i < len; i++) {
|
||||
final String char = line.text[i];
|
||||
final String char = line.displayText[i];
|
||||
ctx.fillText(char, x, y);
|
||||
x += letterSpacing + ctx.measureText(char).width;
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ class EngineLineMetrics implements ui.LineMetrics {
|
||||
this.left,
|
||||
this.baseline,
|
||||
this.lineNumber,
|
||||
}) : text = null,
|
||||
}) : displayText = null,
|
||||
startIndex = -1,
|
||||
endIndex = -1,
|
||||
endIndexWithoutNewlines = -1;
|
||||
|
||||
EngineLineMetrics.withText(
|
||||
this.text, {
|
||||
this.displayText, {
|
||||
@required this.startIndex,
|
||||
@required this.endIndex,
|
||||
@required this.endIndexWithoutNewlines,
|
||||
@@ -35,7 +35,7 @@ class EngineLineMetrics implements ui.LineMetrics {
|
||||
@required this.left,
|
||||
this.baseline,
|
||||
@required this.lineNumber,
|
||||
}) : assert(text != null),
|
||||
}) : assert(displayText != null),
|
||||
assert(startIndex != null),
|
||||
assert(endIndex != null),
|
||||
assert(endIndexWithoutNewlines != null),
|
||||
@@ -44,8 +44,8 @@ class EngineLineMetrics implements ui.LineMetrics {
|
||||
assert(left != null),
|
||||
assert(lineNumber != null && lineNumber >= 0);
|
||||
|
||||
/// The textual content representing this line.
|
||||
final String text;
|
||||
/// The text to be rendered on the screen representing this line.
|
||||
final String displayText;
|
||||
|
||||
/// The index (inclusive) in the text where this line begins.
|
||||
final int startIndex;
|
||||
@@ -89,7 +89,7 @@ class EngineLineMetrics implements ui.LineMetrics {
|
||||
|
||||
@override
|
||||
int get hashCode => ui.hashValues(
|
||||
text,
|
||||
displayText,
|
||||
startIndex,
|
||||
endIndex,
|
||||
hardBreak,
|
||||
@@ -113,7 +113,7 @@ class EngineLineMetrics implements ui.LineMetrics {
|
||||
return false;
|
||||
}
|
||||
final EngineLineMetrics typedOther = other;
|
||||
return text == typedOther.text &&
|
||||
return displayText == typedOther.displayText &&
|
||||
startIndex == typedOther.startIndex &&
|
||||
endIndex == typedOther.endIndex &&
|
||||
hardBreak == typedOther.hardBreak &&
|
||||
|
||||
@@ -1138,7 +1138,7 @@ void main() async {
|
||||
|
||||
/// Shortcut to avoid many line wraps in the tests above.
|
||||
EngineLineMetrics line(
|
||||
String text,
|
||||
String displayText,
|
||||
int startIndex,
|
||||
int endIndex, {
|
||||
double width,
|
||||
@@ -1147,7 +1147,7 @@ EngineLineMetrics line(
|
||||
double left,
|
||||
}) {
|
||||
return EngineLineMetrics.withText(
|
||||
text,
|
||||
displayText,
|
||||
startIndex: startIndex,
|
||||
endIndex: endIndex,
|
||||
hardBreak: hardBreak,
|
||||
|
||||
Reference in New Issue
Block a user