RFR: 8264591: HBox/VBox child widths pixel-snap to wrong value [v7]
Michael Strauß
mstrauss at openjdk.org
Thu Mar 16 19:44:08 UTC 2023
On Thu, 16 Mar 2023 19:19:06 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> Michael Strauß has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 12 commits:
>>
>> - changes per review
>> - Merge branch 'master' into fixes/box-snap-to-pixel
>>
>> # Conflicts:
>> # modules/javafx.graphics/src/test/java/test/javafx/scene/layout/HBoxTest.java
>> # modules/javafx.graphics/src/test/java/test/javafx/scene/layout/VBoxTest.java
>> - Merge branch 'openjdk:master' into fixes/box-snap-to-pixel
>> - revert snappedSum
>> - don't call snappedSum in hot loop
>> - Improved code documentation
>> - Merge branch 'master' into fixes/box-snap-to-pixel
>> - changed some method names, make test config a local class
>> - added documentation, improved method names
>> - Merge branch 'master' into fixes/box-snap-to-pixel
>> - ... and 2 more: https://git.openjdk.org/jfx/compare/a35c3bf7...fbbc273a
>
> modules/javafx.graphics/src/main/java/javafx/scene/layout/VBox.java line 567:
>
>> 565: // distribute (currentDelta), as well as children that are eligible to grow or
>> 566: // shrink (adjustingNumber).
>> 567: while ((currentDelta > Double.MIN_VALUE || currentDelta < -Double.MIN_VALUE) && adjustingNumber > 0) {
>
> same question: is it possible to enter an infinite loop?
>
> I suspect the problem being solved here is the same as with the constrained column resize policy with non-integer scale JDK-8299753. I was going to use some kind of simulated annealing algorithm there, perhaps it could be extracted into a generic utility and used in all three cases.
I don't know that a randomized algorithm would be preferable for this problem, since the algorithm implemented here seems to work pretty well as it is. But if the two problems are very similar, factoring out the implementation might be a good idea.
In any case, this shouldn't prevent this PR from being integrated, as it also includes tests for the desired outcome. These will come in handy if the implementation is refactored at some point in the future.
-------------
PR: https://git.openjdk.org/jfx/pull/445
More information about the openjfx-dev
mailing list