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

Commit 88c0fd5

Browse files
undo textDirection change
1 parent dc2505a commit 88c0fd5

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ abstract class _CombinedFragment extends TextFragment {
114114

115115
final LineBreakType type;
116116

117-
ui.TextDirection get textDirection => _textDirection!;
117+
ui.TextDirection? get textDirection => _textDirection;
118118
ui.TextDirection? _textDirection;
119119

120120
final FragmentFlow fragmentFlow;
@@ -365,7 +365,7 @@ mixin _FragmentBox on _CombinedFragment, _FragmentMetrics, _FragmentPosition {
365365
top,
366366
line.left + right,
367367
bottom,
368-
textDirection,
368+
textDirection!,
369369
);
370370

371371
/// Whether or not the trailing spaces of this fragment are part of trailing
@@ -388,14 +388,14 @@ mixin _FragmentBox on _CombinedFragment, _FragmentMetrics, _FragmentPosition {
388388
top,
389389
line.left + right - widthOfTrailingSpaces,
390390
bottom,
391-
textDirection,
391+
textDirection!,
392392
)
393393
: ui.TextBox.fromLTRBD(
394394
line.left + left + widthOfTrailingSpaces,
395395
top,
396396
line.left + right,
397397
bottom,
398-
textDirection,
398+
textDirection!,
399399
);
400400
}
401401
return _textBoxIncludingTrailingSpaces;
@@ -488,7 +488,7 @@ mixin _FragmentBox on _CombinedFragment, _FragmentMetrics, _FragmentPosition {
488488
top,
489489
line.left + right,
490490
bottom,
491-
textDirection,
491+
textDirection!,
492492
);
493493
}
494494

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ class TextLayoutService {
296296
sandwichStart = null;
297297

298298
if (i < line.fragments.length){
299-
previousDirection = line.fragments[i].textDirection;
299+
previousDirection = line.fragments[i].textDirection!;
300300
}
301301
}
302302
}
@@ -429,7 +429,7 @@ class TextLayoutService {
429429
final bool closestGraphemeStartInFragment = !fragment.hasLeadingBrokenGrapheme
430430
|| dx <= fragment.line.left
431431
|| fragment.line.left + fragment.line.width <= dx
432-
|| switch (fragment.textDirection) {
432+
|| switch (fragment.textDirection!) {
433433
// If dx is closer to the trailing edge, no need to check other fragments.
434434
ui.TextDirection.ltr => dx >= (fragment.left + fragment.right) / 2,
435435
ui.TextDirection.rtl => dx <= (fragment.left + fragment.right) / 2,
@@ -438,7 +438,7 @@ class TextLayoutService {
438438
if (closestGraphemeStartInFragment) {
439439
return candidate1;
440440
}
441-
final bool searchLeft = switch (fragment.textDirection) {
441+
final bool searchLeft = switch (fragment.textDirection!) {
442442
ui.TextDirection.ltr => true,
443443
ui.TextDirection.rtl => false,
444444
};

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class TextPaintService {
6767
}
6868

6969
_prepareCanvasForFragment(canvas, fragment);
70-
final double fragmentX = fragment.textDirection == ui.TextDirection.ltr
70+
final double fragmentX = fragment.textDirection! == ui.TextDirection.ltr
7171
? fragment.left
7272
: fragment.right;
7373

@@ -96,7 +96,7 @@ class TextPaintService {
9696
}
9797
}
9898

99-
canvas.setCssFont(style.cssFontString, fragment.textDirection);
99+
canvas.setCssFont(style.cssFontString, fragment.textDirection!);
100100
canvas.setUpPaint(paint.paintData, null);
101101
}
102102
}

0 commit comments

Comments
 (0)