<Swing Dev> RFR: 8231286: HTML font size too large with high-DPI scaling and W3C_LENGTH_UNITS [v4]

Alexey Ivanov aivanov at openjdk.java.net
Tue Feb 2 20:35:43 UTC 2021


On Tue, 2 Feb 2021 15:16:35 GMT, Matthias Perktold <github.com+7334069+mperktold at openjdk.org> wrote:

> It seems Toolkit.getDefaultToolkit().getScreenResolution() can return 93/94/95 instead of 96 in mac/linux in internal mach5 testing systems causing failure in this test Test.java. Probably we need to make the testcase hardcoded to 96

I guess so.
Where does this `Test.java` come from?

> 
> I also suggest fixing JDK-8260687 to not use font inherit for W3C_LENGTH_UNIT case
> 
> ```
> --- a/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java
> +++ b/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java
> @@ -2823,7 +2823,7 @@ public class StyleSheet extends StyleContext {
>          }
> 
>          Object doGetAttribute(Object key) {
> -            if (key == CSS.Attribute.FONT_SIZE && !isDefined(key)) {
> +            if (key == CSS.Attribute.FONT_SIZE && !isDefined(key) && !isW3CLengthUnits()) {
>                  // CSS.FontSize represents a specified value and we need
>                  // to inherit a computed value so don't resolve percentage
>                  // value from parent.
> ```

Does such a fix not bring back the problem with relative units for the case where W3C_LENGTH_UNIT is enabled?

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

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


More information about the swing-dev mailing list