RFR: 8323801: <s> tag doesn't strikethrough the text
Alexey Ivanov
aivanov at openjdk.org
Fri Feb 9 14:07:04 UTC 2024
On Fri, 9 Feb 2024 10:52:01 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> When `<s>` tag is used inside `<u>`, the `line-through` style is lost, and the text is rendered with `underline` only. However, if `<strike>` is used, the text is rendered with both `underline` and `line-through` styles.
>>
>> Both `<s>` and `<strike>` should render the text the same way.
>
> src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java line 2504:
>
>> 2502: tagMap.put(HTML.Tag.SPAN, ca);
>> 2503: tagMap.put(HTML.Tag.STRIKE, conv);
>> 2504: tagMap.put(HTML.Tag.S, conv);
>
> Should we not update the spec
> https://github.com/openjdk/jdk/blob/71b46c38a820319851cade2a15d64a657d4d7284/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java#L2314-L2319
> to mention that it is now `ConvertAction `and not `CharacterAction`
It's a good question.
We can't do it because `ConvertAction` is not public. In fact, `B`, `FONT`, `I`, `STRIKE`, `SUB`, `SUP`, `U` use `ConvertAction` instead of the specified `CharacterAction`.
The bigger problem is that `ConvertAction` does not extend `CharacterAction`, which means the implementation is different from what is specified. It is the result of [JDK-4171509](https://bugs.openjdk.org/browse/JDK-4171509).
There are a few more inconsistencies between the table and the real implementation. There are also references to non-public action classes, such as `TitleAction`, `LinkAction`…
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17659#discussion_r1484361842
More information about the client-libs-dev
mailing list