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

Commit cb2460f

Browse files
committed
Warn when popping out of empty text style stack
1 parent a3f185d commit cb2460f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,12 @@ class CkParagraphBuilder implements ui.ParagraphBuilder {
752752
void pop() {
753753
if (_styleStack.length <= 1) {
754754
// The top-level text style is paragraph-level. We don't pop it off.
755+
if (assertionsEnabled) {
756+
html.window.console.warn(
757+
'Cannot pop text style in ParagraphBuilder. '
758+
'Already popped all text styles from the style stack.',
759+
);
760+
}
755761
return;
756762
}
757763
_commands.add(const _ParagraphCommand.pop());

lib/web_ui/test/canvaskit/canvas_golden_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,6 @@ void testMain() {
578578
'canvaskit_text_styles_do_not_leak.png',
579579
picture,
580580
region: ui.Rect.fromLTRB(0, 0, testWidth, 850),
581-
write: true,
582581
);
583582
});
584583
// TODO: https://github.com/flutter/flutter/issues/60040

0 commit comments

Comments
 (0)