On Fri, 2 Jun 2023 04:57:34 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> wrote:
>> 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 Removed optimization for non-percentage units which I guess will be more used and it will also do away with `{"margin-top: 42px", "margin-top: 42 px"}` space issue ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13405#discussion_r1214059460