RFR: 8204568: Relative CSS-Attributes don't work all time [v4]

Kevin Rushforth kcr at openjdk.java.net
Sat Mar 6 16:39:11 UTC 2021


On Sat, 6 Mar 2021 16:10:18 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:

>> Issue is that the size of properties that are relatively(`em`) sized is not computed correctly when the reference `-fx-font-size` is also specified relatively and is nested.
>> 
>> Fix is a slight variation of an earlier suggestion in [the PR](https://github.com/javafxports/openjdk-jfx/pull/94).
>> 
>> Fix is very specific to this scenario and did not show any side effect nor any test failure.
>> 
>> There are 12 new unit tests added along with fix:
>> - Two tests fail before and pass after this fix. These test verify the reported failing scenario.
>> sameRelativeFontSizeNestedParentTest
>> relativeFontSizeDeepNestedParentControlTest
>> - Two other tests fail both before and after this fix. They are not related to the fix. These two tests are ignored. I shall file new JBS issues to track these cases and update PR with the IDs added to @Ignore.
>> propertySizesRelativeToFontSizeOfControlTest
>> propertySizesRelativeToFontSizeOfParentTest
>> - Other 8 tests are sanity tests which pass both before and after this fix.
>
> Ambarish Rapte has updated the pull request incrementally with one additional commit since the last revision:
> 
>   rephrasing comment statements and review corrections

Two additional comments, and otherwise looks good to me.

modules/javafx.controls/src/test/java/test/javafx/css/PropertySizeTest.java line 219:

> 217:         p4.setStyle("-fx-font-size: 0.5em");
> 218: 
> 219:         // Ideally relative font size of a parent should be relative to font size of its parent.

This is a bit confusing. I think you are saying that the relative size of a (node's) parent should be relative to the size of _that parent's_ parent, right? If so, then maybe something like this?

// Ideally the relative font size of a parent should be relative to the font size of that parent's parent.

modules/javafx.controls/src/test/java/test/javafx/css/PropertySizeTest.java line 257:

> 255:         // The expected behavior of -fx-font-size calculation with nested set of parents is that
> 256:         // the font size of a parent is always calculated relative to font size of its parent.
> 257:         // But currently it is calculated relative to font size of grandparent.

Minor suggestion: "...relative to _the_ font size of _its_ grandparent."

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

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


More information about the openjfx-dev mailing list