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

Commit b585dc7

Browse files
committed
cleanup
1 parent 502c5ff commit b585dc7

File tree

2 files changed

+3
-23
lines changed

2 files changed

+3
-23
lines changed

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

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -157,35 +157,15 @@ class CanvasParagraph implements ui.Paragraph {
157157
cssStyle
158158
..position = 'absolute'
159159
// Prevent the browser from doing any line breaks in the paragraph. We want
160-
// to insert our own <BR> breaks based on layout results.
160+
// to have full control of the paragraph layout.
161161
..whiteSpace = 'pre';
162162

163-
// if (width > longestLine) {
164-
// In this case, we set the width so that the CSS text-align property
165-
// works correctly.
166-
// When `longestLine` is >= `paragraph.width` that means the DOM element
167-
// will automatically size itself to fit the longest line, so there's no
168-
// need to set an explicit width.
169-
cssStyle.width = '${width}px';
170-
// }
171-
172-
// if (paragraphStyle.maxLines != null || paragraphStyle.ellipsis != null) {
173-
// cssStyle
174-
// ..overflow = 'hidden'
175-
// ..height = '${height}px';
176-
// }
177-
178163
// 2. Append all spans to the paragraph.
179164

180165
html.HtmlElement? lastSpanElement;
181166
final List<EngineLineMetrics> lines = computeLineMetrics();
182167

183168
for (int i = 0; i < lines.length; i++) {
184-
// Insert a <BR> element before each line except the first line.
185-
if (i > 0) {
186-
rootElement.append(html.document.createElement('br'));
187-
}
188-
189169
final EngineLineMetrics line = lines[i];
190170
final List<RangeBox> boxes = line.boxes;
191171
final StringBuffer buffer = StringBuffer();

lib/web_ui/test/html/paragraph/general_golden_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ Future<void> testMain() async {
371371
});
372372

373373
void testFontFeatures(EngineCanvas canvas) {
374-
const String text = 'Aa Bb Dd Ee Ff Difficult';
374+
const String text = 'Bb Difficult ';
375375
const FontFeature enableSmallCaps = FontFeature('smcp');
376376
const FontFeature disableSmallCaps = FontFeature('smcp', 0);
377377

@@ -446,7 +446,7 @@ Future<void> testMain() async {
446446
enableOnum,
447447
],
448448
));
449-
builder.addText('$text - $numeric');
449+
builder.addText('$text $numeric');
450450
builder.pop(); // enableSmallCaps, enableOnum
451451
},
452452
)..layout(constrain(double.infinity));

0 commit comments

Comments
 (0)