RFR: JDK-8292276 : Missing color names in CSS.

ScientificWare duke at openjdk.org
Fri Aug 12 10:09:13 UTC 2022


On Fri, 12 Aug 2022 09:48:54 GMT, ExE Boss <duke at openjdk.org> wrote:

>> This is referenced in Java Bug Database as
>> - [JDK-8292276 : Missing color names in CSS](https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8292276)
>> 
>> This is tracked in JBS as 
>> - [JDK-8292276 : Missing color names in CSS](https://bugs.openjdk.java.net/browse/JDK-8292276)
>> 
>> Adds missing color names, defined by CSS Level 4, in CSS.java :
>> CSS Color Module Level 4
>> W3C Candidate Recommendation Snapshot, 5 July 2022
>> [7.1 Named Colors](https://www.w3.org/TR/css-color-4/#named-color)
>> 
>> Designed from : [ScientificWare JDK-8292276 : Missing color names in CSS](https://github.com/scientificware/jdk/issues/12)
>
> src/java.desktop/share/classes/javax/swing/text/html/CSS.java line 1703:
> 
>> 1701:             color = hexToColor("#f5f5f5");
>> 1702:         else if (str.equalsIgnoreCase("Yellowgreen"))
>> 1703:             color = hexToColor("#9acd32");
> 
> This should probably use <code>switch([str.toLowerCase][String::toLowerCase]([Locale.ROOT]))</code> instead of a linear search.
> 
> [String::toLowerCase]: https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/String.html#toLowerCase(java.util.Locale)
> [Locale.ROOT]: https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/util/Locale.html#ROOT

Hi @ExE-Boss, Thanks for reviewing, I made several propositions here https://github.com/scientificware/jdk/issues/12.

Including switch usage with direct Color generating.
The last on is to move this logic to Color.java.

May I have your comments about them ?

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

PR: https://git.openjdk.org/jdk/pull/9825



More information about the client-libs-dev mailing list