On Thu, 27 Aug 2026 11:19:10 GMT, Michael Strauß <[email protected]> wrote:

>> This PR is an audit of several snapping-related methods in `Region`, along 
>> with some bug fixes.
>> 
>> I've added a helper method `snapAligned()`, which does the exact same thing 
>> as `snapSpace()`, but clearly states that the author knows that the value is 
>> already pixel-aligned. In addition, I've renamed several local variables 
>> around a "rawFoo" and "snappedFoo" naming scheme, so as to make it easier to 
>> see what's what.
>> 
>> This PR should probably be integrated before the other layout container PRs, 
>> because those use the `Region` layout methods.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> modules/javafx.graphics/src/main/java/javafx/scene/layout/Region.java line 
> 1999:
> 
>> 1997:         if (prefBaselineComplement != -1) {
>> 1998:             double baseline = child.getBaselineOffset();
>> 1999:             if (child.isResizable() && baseline == 
>> BASELINE_OFFSET_SAME_AS_HEIGHT) {
> 
> Here and in other places: The sentinel check unnecessarily required 
> `child.isResizable()`. A non-resizable node could also return 
> `BASELINE_OFFSET_SAME_AS_HEIGHT`; the current regular-baseline branch would 
> then add negative infinity. The check should be based on baseline alone.

I agree on that assessment, I already removed those in the variants I created 
for virtual layout containers as having `isResizable()` on a `Measurable` made 
no sense (and I didn't want to pass in a `Layoutable` just to access an 
unnecassry method).

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2278#discussion_r3872401974

Reply via email to