On Mon, 17 Aug 2026 23:44:34 GMT, Michael Strauß <[email protected]> wrote:
>> `Region.layoutInArea()` calls `Region.boundedNodeSizeWithBias()`, which >> derives the dependent value from a potentially unsnapped value, after which >> `layoutInArea()` assigns a potentially different, snapped value to the >> child. This is wrong, because the dependent value is effectively computed >> against a value that might not be assigned to the child. >> >> For a horizontally biased child, the current sequence is effectively: >> >> >> double rawWidth = boundedSize(...); >> double rawHeight = boundedSize( >> child.minHeight(rawWidth), >> ... child.prefHeight(rawWidth) ..., >> child.maxHeight(rawWidth)); >> >> child.resize( >> snapSize(rawWidth), >> snapSize(rawHeight)); >> >> >> The correct sequence would be: >> >> >> double width = snapSize(boundedSize(...)); >> double height = snapSize(boundedSize( >> child.minHeight(width), >> ... child.prefHeight(width) ..., >> child.maxHeight(width))); >> >> child.resize(width, height); >> >> >> This snapping bug can only be observed when all of the following conditions >> are met: >> 1. pixel snapping is enabled >> 2. the child is resizable and has a horizontal or vertical content bias >> 3. the bounded primary dimension is not already correctly snapped >> 4. the dependent size constraints change between the raw and snapped primary >> dimensions >> >> This came out of the "snapping rules" I've compiled for PR #2260, >> specifically the rule [Use the same snapped dependent dimension for >> measurement and >> layout](https://github.com/openjdk/jfx/pull/2260/changes#diff-3fe4ab83269e3ae0ec167ebe622893aff218168e7cab666e5a64c99e6dfbfd4fR464). >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Michael Strauß has updated the pull request incrementally with one additional > commit since the last revision: > > doc change LGTM. The test fails before and passes after the fix. ------------- Marked as reviewed by kcr (Lead). PR Review: https://git.openjdk.org/jfx/pull/2261#pullrequestreview-4965303183
