Make sure to call setHeightOverride as well on TextStyle and StrutStyle (flutter/engine#50920)

This fixes https://github.com/flutter/flutter/issues/143877

We apparently need to call `setHeightOverride(true)` on `TextStyle` and `StrutStyle` objects in order to properly apply the height.
This commit is contained in:
Jackson Gardner 2024-02-26 10:52:59 -08:00 committed by GitHub
parent 45b0c5ef88
commit d1d7c08ce9
3 changed files with 7 additions and 0 deletions

View File

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

View File

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

View File

@ -68,6 +68,11 @@ Future<void> 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,