RFR: JDK-8292276 : Missing color names in CSS [v14]
Alexey Ivanov
aivanov at openjdk.org
Mon Sep 12 19:52:49 UTC 2022
On Sat, 10 Sep 2022 13:37:57 GMT, ScientificWare <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)
>
> ScientificWare has updated the pull request incrementally with one additional commit since the last revision:
>
> Error in comment.
>
> Sync. comment with code : "fails ... if stringToColor(null) doesn't return null".
src/java.desktop/share/classes/javax/swing/text/html/CSS.java line 133:
> 131: * @author Timothy Prinzing
> 132: * @author Scott Violet
> 133: * @author Guy Abossolo Foh - ScientificWare
New author tags aren't added.
src/java.desktop/share/classes/javax/swing/text/html/CSS.java line 1419:
> 1417: }
> 1418:
> 1419: private static Map<String, Color> colorNamed =
It should also be declared `final`.
The field should be either `colorNames` or `namedColors`. You meant the former?
test/jdk/javax/swing/text/html/CSS/JDK8292276MissingColorNamesInCSS/JDK8292276MissingColorNamesInCSS.java line 31:
> 29: * @summary Missing Color Names in CSS
> 30: * @run main JDK8292276MissingColorNamesInCSS
> 31: * @author Guy Abossolo Foh - ScientificWare
Author tags aren't added any more, existing ones are usually removed from tests when modified.
test/jdk/javax/swing/text/html/CSS/JDK8292276MissingColorNamesInCSS/JDK8292276MissingColorNamesInCSS.java line 44:
> 42: import static javax.swing.text.html.CSS.Attribute.BORDER_RIGHT_COLOR;
> 43:
> 44: public class JDK8292276MissingColorNamesInCSS {
The class name can be shortened: `MissingColorNames`. It should placed in `CSS` folder or add to `ColorValue` folder.
test/jdk/javax/swing/text/html/CSS/JDK8292276MissingColorNamesInCSS/JDK8292276MissingColorNamesInCSS.java line 77:
> 75: color = attributeSet.getAttribute(COLOR);
> 76: bdleftcolor = attributeSet.getAttribute(BORDER_LEFT_COLOR);
> 77: bdrightcolor = attributeSet.getAttribute(BORDER_RIGHT_COLOR);
Declare the variables where they're used for the first time, `attributeSet` is also included.
Use camelCase for readability of `leftColor` and `rightColor`.
test/jdk/javax/swing/text/html/CSS/JDK8292276MissingColorNamesInCSS/JDK8292276MissingColorNamesInCSS.java line 79:
> 77: bdrightcolor = attributeSet.getAttribute(BORDER_RIGHT_COLOR);
> 78:
> 79: if(styleSheet.stringToColor(null) != null){
Suggestion:
if (styleSheet.stringToColor(null) != null){
Space is missing.
-------------
PR: https://git.openjdk.org/jdk/pull/9825
More information about the client-libs-dev
mailing list