RFR: JDK-8292276 : Add named colors from CSS Color Module Level 4 [v30]
ScientificWare
duke at openjdk.org
Sun Aug 6 00:30:47 UTC 2023
> 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 with a new target base due to a merge or a rebase. The pull request now contains 11 commits:
- Merge master
- Merge master
# Conflicts:
# src/java.desktop/share/classes/javax/swing/text/html/CSS.java
# src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java
- CSS.java
- Updates copyright date to 2023.
- Adds the missing color names defined by :
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)
- Adds relative imports.
- Replaces, if ... then ... else statements with a Map called "colorNamed".
StyleSheet.java ;
- Updates copyright date to 2023.
- Updates stringToColor specifications to integrate a reference to CSS Color Module 4 for color names and hexadecimal notation.
MissingColorNames.java :
- Création d'un test pour les nouveaux noms de couleurs ajoutés.
- MissingColorNames.java :
Moves jtreg tags to the class declaration. Comment with tags isn't collapsed when viewed in an IDE if it's placed before the class declaration.
- JDK8292276MissingColorNamesInCSS.java -> MissingColorNames.java :
- Changement de nom.
- Déplacement vers un autre dossier.
- Simplification d'une description.
- Ajout d'espaces manquants.
- Correction de l'alignement d'un délimiteur de commentaire.
CSS.java :
- Changement de nom pour la variable colorNamed.
- Ajout du modificateur final à la variable ColorNames.
- Uniformisation de l'utilisation de la variable strlc.
- renvoi direct de la couleur trouvée si elle existe.
- Problème de configuration de KWrite.
Qui rajoutait un retour ligne à la fin de chaque fichier.
- CSS.java
- Corrige une grossière erreur de code :
Modifie l'emplacement de la mise en minuscules pour le placer juste après les cas pour lequel cela n'a pas d'importance et surtout après avoir envisager le cas null.
Sinon ce pouvait engendrer un NPE.
- Modifie la déclaration des couleurs opaques. En choisissant la déclaration avec trois entiers.
JDS8292276MissingColorNamesInCSS.java :
- Ajout du cas null.
- Ajout du test sur le
- Erreur de nom.
Un caractère de retour à la ligne s'est immiscer dans le nom du dossier.
- This commit modifies stringToColor method
- by correcting orange definition,
- by adding 132 missing color names,
- including transparent keyword
- but excluding currentcolor keyword.
- by treating RGB and Hex notations in insensitive case mode.
This commit modifies stringToColor method which has no modifier, so only usages are limited to :
- its Class.
- The inner Class ColorValue also without modifier uses it through the method to return the Color Object
- its Package.
- stringToColor is also used by javax.swing.text.html.StyleSheet stringToColor method to publicly return the Color Object.
- conclusion : since Color Object is publicly exposed, one can't change method behavior. This preventing to return a constant Color excepted for the existing String.isEmpty argument.
Refactoring resolving color value and align it with 5.7. Resolving Values Values) will be treated in another PR. Extends JDK-8149631 rgb(...) CSS color values are not parsed properly.
- Test case for JDK-8292276
Adds a jtreg test case that fails before JDK-8292276 patch and passes after.
Test the Cyan color name.
Cyan is the missing color name that originates the PR JDK8292276 : Missing Color NamesIn CSS.
Cyan name, as most color names Colors defined in CSS Color Module Level 4, is not referenced in CSS.java.
This test fails, if getAttribute doesn't return a cyan Color Object.
When a color name is missing getAttribute returns a black Color Object.
- ... and 1 more: https://git.openjdk.org/jdk/compare/90d795ab...bd2811dd
-------------
Changes: https://git.openjdk.org/jdk/pull/9825/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=9825&range=29
Stats: 274 lines in 4 files changed: 215 ins; 0 del; 59 mod
Patch: https://git.openjdk.org/jdk/pull/9825.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/9825/head:pull/9825
PR: https://git.openjdk.org/jdk/pull/9825
More information about the client-libs-dev
mailing list