On Thu, 1 Jun 2023 18:33:41 GMT, Phil Race <p...@openjdk.org> wrote: >> Prasanta Sadhukhan has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Use relative variable in equals/hashcode > > src/java.desktop/share/classes/javax/swing/text/html/CSS.java line 2684: > >> 2682: return val instanceof CSS.LengthValue lu >> 2683: && Objects.equals(svalue, lu.svalue); >> 2684: } > > Why is this case still using the string and not 'span' ?
This is because it can cater to both units like px,pt and % For example, for attributes `{"margin-top: 42px", "margin-top: 22px"}` `span `22.0, 42.0 `percentage `false `units `px where we can use `span == lu.span && units == lu.units` check but for attributes like `{"margin-top: 100%", "margin-top: 200%"}` `span `1.0 for both `percentage `true `units `null (where the above equality check will not work and we need to use the string so for optimization I have used the same check for both) I guess span is 1.0 is because of this code https://github.com/openjdk/jdk/blob/325940b0919e649e84358db35a55b3ac5dfe0acf/src/java.desktop/share/classes/javax/swing/text/html/CSS.java#L2557-L2561 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13405#discussion_r1213916093