RFR: 7083187: Class CSS.CssValue is missing implementations of equals() and hashCode() [v15]

Alexey Ivanov aivanov at openjdk.org
Wed Jun 7 14:26:08 UTC 2023


On Wed, 7 Jun 2023 13:55:06 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> src/java.desktop/share/classes/javax/swing/text/html/CSS.java line 2684:
>> 
>>> 2682:             if (percentage) {
>>> 2683:                 return val instanceof CSS.LengthValue lu
>>> 2684:                        && Objects.equals(svalue, lu.svalue);
>> 
>> Doesn't comparing `span` work for percentage values? The comment for `span` field implies it should contain the parsed value.
>> 
>> This comparison could fail for the case where there's a space before the `%` in the string.
>
>> This comparison could fail for the case where there's a space before the `%` in the string.
> 
> `FontSize` does handle `{"font-size: 100%", "font-size: 100 %"}` pair, but `LengthValue` doesn't.

No, it doesn't. For some reason, both `100%` and `200%` are parsed so that `span = 1.0`.

Let's leave it as is then. It handles the most common case.

Handling a space before the percent sign can be postponed to a later fix.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13405#discussion_r1221688903



More information about the client-libs-dev mailing list