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, 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,