On Fri, 20 Nov 2020 03:41:54 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> 
wrote:

>> src/java.desktop/share/classes/javax/swing/plaf/basic/BasicHTML.java line 64:
>> 
>>> 62:     public static View createHTMLView(JComponent c, String html) {
>>> 63:         BasicEditorKit kit = getFactory();
>>> 64:         int beginIndex = html.indexOf("rgba(");
>> 
>> Don't we need to implement this parsing similarly to rgb()? somewhere inside 
>> kit.createDefaultDocument() or where we parse rgb()?
>
> The problem is the alpha color not being present in c.getForeground() so we 
> need to parse alpha here to pass the value to displayPropertiesToCSS(). I 
> have already mentioned it below.

As far as I understand the only place where we decode `rgb()` is 
`CSS.stringToColor` and that code missing the `rgba()` case.
Just to double-check.
If the test case `TestTranslucentLabelText` will be modified to use `rgb()` 
instead of `rgba()` then the color which was set by the user to the `Component` 
will be ignored, and the correct color from the `rgb()` will be used. So it 
does not matter that `c.getForeground()` contains some opaque color, it is 
ignored, why the similar case for` rgba()` does not work in the same way?

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

PR: https://git.openjdk.java.net/jdk/pull/1158

Reply via email to