RFR: JDK-8292276 : Add named colors from CSS Color Module Level 4 [v29]

Phil Race prr at openjdk.org
Tue Feb 28 01:07:26 UTC 2023


On Mon, 27 Feb 2023 21:56:28 GMT, ScientificWare <duke at openjdk.org> wrote:

>> This is referenced in Java Bug Database as
>> - [JDK-8292276 : Add named colors from CSS Color Module Level 4](https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8292276)
>> 
>> This is tracked in JBS as 
>> - [JDK-8292276 : Add named colors from CSS Color Module Level 4](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 : Add named colors from CSS Color Module Level 4](https://github.com/scientificware/jdk/issues/12)
>
> ScientificWare has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java
>   
>   Remove space.
>   
>   Co-authored-by: Alexey Ivanov <alexey.ivanov at oracle.com>

src/java.desktop/share/classes/javax/swing/text/html/CSS.java line 1421:

> 1419: 
> 1420:     private static final Map<String, Color> colorNames =
> 1421:         Map.ofEntries(

I think you can make this lazily initialized. As it is, the Map will be created when the class is initialised,
even if you never need it.

src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java line 1019:

> 1017:      * Converts a color string such as "RED",  "rgb(r g b)",
> 1018:      * "rgba(r g b a)" or "#NNN", "#NNNN", "#NNNNNN",
> 1019:      * "#NNNNNNNN" to a Color.

This specification change seems to be dependent on the change in implementation proposed in
https://github.com/openjdk/jdk/pull/10317/
JDK-8293776 : Adds CSS 4 and 8 digits hex coded Color
And BTW if you implemented that change on its own, it would not be spec compliant.

I think it best to WITHDRAW that other PR and absorb it in this PR

Also you should in the doc include the spec link.
spec limits what it will convert. I think

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

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



More information about the client-libs-dev mailing list