<Swing Dev> RFR: 8260687: Inherited font size is smaller than expected when using StyleSheet to add styles [v3]
Alexey Ivanov
aivanov at openjdk.java.net
Thu Feb 11 21:44:44 UTC 2021
On Thu, 11 Feb 2021 18:04:26 GMT, Stanimir Stamenkov <github.com+1247730+stanio at openjdk.org> wrote:
>> 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.
> I have copied the changes from the [aivanov-jdk/jdk at f9e9977](https://github.com/aivanov-jdk/jdk/commit/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);
I do not think the order matters. The paragraph which does not specify the font size and the paragraph which specifies it as 100% have the same size. This can be confirmed with another added check, does it make sense?
> * 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.
Does it not? I can't see it has much of difference: visually the views have different font sizes which is confirmed by the existing check. But the font size in all three cases is expected to be the same.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2515
More information about the swing-dev
mailing list