-
Notifications
You must be signed in to change notification settings - Fork 6k
[libTxt] resolve null leading distribution in dart:ui. #25510
[libTxt] resolve null leading distribution in dart:ui. #25510
Conversation
d433931 to
a73d75e
Compare
lib/ui/text.dart
Outdated
| /// | ||
| /// See [encode] for the creation of the encoded form. | ||
| TextHeightBehavior.fromEncoded(int encoded) | ||
| const TextHeightBehavior.fromEncoded(int encoded, this.leadingDistribution) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should leadingDistribution be taken out of the TextHeightBehavior object?
leadingDistribution is an attribute that can be applied to individual runs of text. But the other members of TextHeightBehavior can only apply to the whole paragraph.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the framework TextStyle.leadingnDistribution can be null in which case it defers to ParagraphStyle.textHeightBehavior.leadingDistribution. You mean we should add it as a separate field to ParagraphStyle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does make more sense for fromEncoded and encode. But that would break some tests in the framework. Would it be possible to make these 2 methods private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - I think it would be more consistent to make leadingDistribution a field in ParagraphStyle that can optionally be overridden in the TextStyle
AFAIK there isn't any need for TextHeightBehavior.encode and TextHeightBehavior.fromEncoded to be public.
Most other encode/decode methods for these objects are private (like _encodeParagraphStyle and _encodeTextStyle)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the framework ParagraphStyle code, moving leadingDistribution to ParagraphStyle is going to break it. Is there a process for making such changes? Or I can hide the ugliness by making these methods private at the cost of testability.
25b0d33 to
f59045f
Compare
f59045f to
3c97fe9
Compare
…aph-level-halfleading-attribute
…level-halfleading-attribute
|
@jason-simmons #25627 includes the skparagraph half leading commit. Updated the |
Remove
{StrutStyle, TextStyle}.has_leading_distribution_overridefrom libTxt, and make{StrutStyle, TextStyle}.half_leadingfinal (so they'll never default toParagraphStyle.text_height_behaviorduring layout, instead they are resolved earlier than that: when the paragraph is being built).SkParagraphrelies onTextStyle.==to breakTextStyles intoRuns. IfTextStyle.leadingDistributionmay depend onParagraphStylethen we won't be able to provide a reasonableTextStyle.==implementation. Plus it makes more sense to me to do the defaulting in dart:ui.Related Issue: flutter/flutter#72521
Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.