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

Commit a04fba4

Browse files
Make sure to call setHeightOverride as well on TextStyle and StrutStyle (#50920)
This fixes flutter/flutter#143877 We apparently need to call `setHeightOverride(true)` on `TextStyle` and `StrutStyle` objects in order to properly apply the height.
1 parent add0f51 commit a04fba4

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

lib/web_ui/skwasm/text/strut_style.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ SKWASM_EXPORT void strutStyle_setFontSize(StrutStyle* style,
3333

3434
SKWASM_EXPORT void strutStyle_setHeight(StrutStyle* style, SkScalar height) {
3535
style->setHeight(height);
36+
style->setHeightOverride(true);
3637
}
3738

3839
SKWASM_EXPORT void strutStyle_setHalfLeading(StrutStyle* style,

lib/web_ui/skwasm/text/text_style.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ SKWASM_EXPORT void textStyle_setWordSpacing(TextStyle* style,
9696

9797
SKWASM_EXPORT void textStyle_setHeight(TextStyle* style, SkScalar height) {
9898
style->setHeight(height);
99+
style->setHeightOverride(true);
99100
}
100101

101102
SKWASM_EXPORT void textStyle_setHalfLeading(TextStyle* style,

lib/web_ui/test/ui/text_golden_test.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ Future<void> testMain() async {
6868
layoutWidth: 50, paragraphHeight: 1.5);
6969
});
7070

71+
test('text styles - text style height overriding paragraph height', () async {
72+
await testTextStyle('text style height and paragraph style height',
73+
layoutWidth: 50, paragraphHeight: 1.5, height: 2.0);
74+
});
75+
7176
test('text styles - paragraph text height behavior', () async {
7277
await testTextStyle('paragraph text height behavior',
7378
layoutWidth: 50,

0 commit comments

Comments
 (0)