RFR: JDK-8293776 : Adds CSS 4 and 8 digits hex coded Color [v13]

Alexey Ivanov aivanov at openjdk.org
Tue Feb 28 16:02:47 UTC 2023


On Sun, 5 Feb 2023 09:55:27 GMT, ScientificWare <duke at openjdk.org> wrote:

>> This is referenced in Java Bug Database as
>> - [JDK-8293776 : Adds CSS 4 and 8 digits hex coded Color](https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8293776)
>> 
>> This is tracked in JBS as 
>> - [JDK-8293776 : Adds CSS 4 and 8 digits hex coded Color](https://bugs.openjdk.java.net/browse/JDK-8293776)
>> 
>> Adds the 4 and 8 digits color hex notations to CSS.java, as described in :
>> CSS Color Module Level 4
>> W3C Candidate Recommendation Snapshot, 5 July 2022
>> [6.2 The RGB Hexadecimal Notations: `#RRGGBB`](https://www.w3.org/TR/css-color-4/#hex-notation)
>> 
>> Designed from : [ScientificWare JDK-8293776 : Adds CSS 4 and 8 digits hex coded Color](https://github.com/scientificware/jdk/issues/13)
>
> ScientificWare has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Updates copyright date.
>    
>    Updates copyright date to 2023.
>  - Updates copyright date.
>    
>    Updates copyright date to 2023.

Changes requested by aivanov (Reviewer).

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

> 1380:             value = dv | value << 4;
> 1381:         }
> 1382:         return new Color(value, true);

I wonder if it can be written in a clearer way. It looks cool yet not straightforward at all, so it requires explaining what's going on.

I guess a previous versions was clearer. However, I grasped how it works.

I would rather avoid assigning values inside the if-condition and extract the assignments into separate line.

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

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



More information about the client-libs-dev mailing list