> `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 ------------- Changes: - all: https://git.openjdk.org/jfx/pull/2261/files - new: https://git.openjdk.org/jfx/pull/2261/files/f5288ea6..2fc8382d Webrevs: - full: https://webrevs.openjdk.org/?repo=jfx&pr=2261&range=01 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=2261&range=00-01 Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jfx/pull/2261.diff Fetch: git fetch https://git.openjdk.org/jfx.git pull/2261/head:pull/2261 PR: https://git.openjdk.org/jfx/pull/2261
