<Swing Dev> RFR: 8260687: Inherited font size is smaller than expected when using StyleSheet to add styles [v3]

Stanimir Stamenkov github.com+1247730+stanio at openjdk.java.net
Thu Feb 11 18:09:40 UTC 2021


On Thu, 11 Feb 2021 16:32:36 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Stanimir Stamenkov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8260687: Replace line-endings in BodyInheritedFontSize.java
>
> The fix looks good to me too. It passes the set of the four tests related to the recent fixes:
> 
> - javax/swing/text/html/CSS/8231286/HtmlFontSizeTest.java
> - javax/swing/text/html/CSS/4765271/bug4765271.java
> - javax/swing/text/html/StyleSheet/TestWrongCSSFontSize.java
> - javax/swing/text/html/StyleSheet/8260687/BodyInheritedFontSize.java
> 
> I've just updated BodyInheritedFontSize.java on [my JDK-8260687 branch](https://github.com/aivanov-jdk/jdk/tree/JDK-8260687) to include your test case with `font-size: 100%`.

I have copied the changes from the aivanov-jdk/jdk at f9e997776fe4 branch earlier and made my revision to include the `font-size: 100%` case.  I have the following adjustments that don't appear included in @aivanov-jdk's latest change:

-   The `<p style="font-size: 100%">...</p>` has to be before the `<p>...</p>` to trigger the pre-existing problem (f.e. in Java 11);
-   Replace `StyleConstants.getFontSize()` for `GlyphView.getFont().getSize()`
    
    The former is unreliable as it doesn't explicitly send a `StyleSheet` context and depends on a generally unknown state of the `CSS.styleSheet.w3cLengthUnits` the `FontSize` declaration has been instantiated from.  At the end, it doesn't report the actual font set to the view – it computes a new result that might differ from the actual.

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

PR: https://git.openjdk.java.net/jdk/pull/2515


More information about the swing-dev mailing list