RFR: 8242548: Honor line spacing in Labeled reflow calculation

John Hendrikx jhendrikx at openjdk.java.net
Wed Apr 22 15:56:21 UTC 2020


On Wed, 22 Apr 2020 12:46:03 GMT, Ajit Ghaisas <aghaisas at openjdk.org> wrote:

>> This is a solution for 8242548.  There was zero test coverage, so I added a few tests for this as well.
>
> modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/skin/Utils.java line 426:
> 
>> 425:
>> 426:         height += lineSpacing;
>> 427:
> 
> Modifying 'height' parameter seems incorrect as this parameter is used in other calculations below. If needed, use a
> separate local variable to use 'height+lineSpacing'

The height used needs to be changed everywhere.  However, I can move this to the caller instead, with a comment
explaining why:

> The computeClippedWrappedText call works with full lines (height of line + line spacing), including the last line.
> However the wrap height does not include the line spacing for the last line.  In order to avoid wrapping the last line
> of text even though there is sufficient space the wrap height passed to computeClippedWrappedText is increased with the
> line spacing so it computes the correct text.

-------------

PR: https://git.openjdk.java.net/jfx/pull/173


More information about the openjfx-dev mailing list