From 9137d28546027b4d1778cc7b11c83bf264bc17e9 Mon Sep 17 00:00:00 2001 From: Jackson Gardner Date: Fri, 23 Feb 2024 11:41:51 -0800 Subject: [PATCH 1/2] Make sure to call `setHeightOverride` as well on TextStyle and StrutStyle. --- lib/web_ui/skwasm/text/strut_style.cpp | 1 + lib/web_ui/skwasm/text/text_style.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/web_ui/skwasm/text/strut_style.cpp b/lib/web_ui/skwasm/text/strut_style.cpp index 41f9edf52e7fd..f3c7ea0d2fa33 100644 --- a/lib/web_ui/skwasm/text/strut_style.cpp +++ b/lib/web_ui/skwasm/text/strut_style.cpp @@ -33,6 +33,7 @@ SKWASM_EXPORT void strutStyle_setFontSize(StrutStyle* style, SKWASM_EXPORT void strutStyle_setHeight(StrutStyle* style, SkScalar height) { style->setHeight(height); + style->setHeightOverride(true); } SKWASM_EXPORT void strutStyle_setHalfLeading(StrutStyle* style, diff --git a/lib/web_ui/skwasm/text/text_style.cpp b/lib/web_ui/skwasm/text/text_style.cpp index b520f52a5424d..c0a50451fb10e 100644 --- a/lib/web_ui/skwasm/text/text_style.cpp +++ b/lib/web_ui/skwasm/text/text_style.cpp @@ -96,6 +96,7 @@ SKWASM_EXPORT void textStyle_setWordSpacing(TextStyle* style, SKWASM_EXPORT void textStyle_setHeight(TextStyle* style, SkScalar height) { style->setHeight(height); + style->setHeightOverride(true); } SKWASM_EXPORT void textStyle_setHalfLeading(TextStyle* style, From 2c5f54ce9de41601b8a96494034e3898297803ab Mon Sep 17 00:00:00 2001 From: Jackson Gardner Date: Fri, 23 Feb 2024 11:51:19 -0800 Subject: [PATCH 2/2] Add test for overriding text height. --- lib/web_ui/test/ui/text_golden_test.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/web_ui/test/ui/text_golden_test.dart b/lib/web_ui/test/ui/text_golden_test.dart index 60b956647875f..66813ff44c418 100644 --- a/lib/web_ui/test/ui/text_golden_test.dart +++ b/lib/web_ui/test/ui/text_golden_test.dart @@ -68,6 +68,11 @@ Future testMain() async { layoutWidth: 50, paragraphHeight: 1.5); }); + test('text styles - text style height overriding paragraph height', () async { + await testTextStyle('text style height and paragraph style height', + layoutWidth: 50, paragraphHeight: 1.5, height: 2.0); + }); + test('text styles - paragraph text height behavior', () async { await testTextStyle('paragraph text height behavior', layoutWidth: 50,