-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8323801: <s> tag doesn't strikethrough the text #17659
Conversation
If <s> is inside <u>, line-through is lost, yet it's preserved if <strike> is used. Ensure both elements are handled similarly.
👋 Welcome back aivanov! A progress list of the required criteria for merging this PR into |
@aivanov-jdk The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks good. The <s>
tag works as expected as in the case of standard HTML with the fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested changes and checked results myself locally. Looks good. Only comment is to possibly rename the test to HTMLUnderlineAndStrike or something similar just to be more clear about what it tests, just in case underline needs to be tested too. I'm fine with it as is though if that's preferred.
@@ -2473,7 +2501,7 @@ public HTMLReader(int offset, int popDepth, int pushDepth, | |||
tagMap.put(HTML.Tag.SMALL, ca); | |||
tagMap.put(HTML.Tag.SPAN, ca); | |||
tagMap.put(HTML.Tag.STRIKE, conv); | |||
tagMap.put(HTML.Tag.S, ca); | |||
tagMap.put(HTML.Tag.S, conv); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we not update the spec
jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLDocument.java
Lines 2314 to 2319 in 71b46c3
* <th scope="row">{@code HTML.Tag.STRIKE} | |
* <td>CharacterAction | |
* <tr> | |
* <th scope="row">{@code HTML.Tag.S} | |
* <td>CharacterAction | |
* <tr> |
to mention that it is now
ConvertAction
and not CharacterAction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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
…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we can do away with those tags which mention internal class OR mention the public action instead, like TagAction instead of ConvertAction
HiddenAction instead of TitleAction etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree we should do something about it. I think ConvertAction
can be subclass of CharacterAction
, then the listed actions in the table will be more inline with the implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've submitted JDK-8325620: HTMLReader uses ConvertAction instead of specified CharacterAction for <b>
, <i>
, <u>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HiddenAction instead of TitleAction etc
I've submitted JDK-8325623: HTMLReader refers to non-public classes as tag handlers
I decided to submit separate bugs because ConvertAction
would likely have some source code changes. However, both bugs can be addressed as one changeset.
|
||
if (!errors.isEmpty()) { | ||
errors.delete(errors.length() - 2, errors.length()); | ||
throw new Error(errors + " must have both " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be RuntimeException inline with other tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error
is shorter and conveys the reason better.
If you insist, I can use RuntimeException
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's about consistency...majority client tests uses RE while handful uses Error...not sure if there is any consensus on it..
@aivanov-jdk This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 256 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updates look good
/integrate |
Going to push as commit 80b63b6.
Your commit was automatically rebased without conflicts. |
@aivanov-jdk Pushed as commit 80b63b6. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
When
<s>
tag is used inside<u>
, theline-through
style is lost, and the text is rendered withunderline
only. However, if<strike>
is used, the text is rendered with bothunderline
andline-through
styles.Both
<s>
and<strike>
should render the text the same way.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17659/head:pull/17659
$ git checkout pull/17659
Update a local copy of the PR:
$ git checkout pull/17659
$ git pull https://git.openjdk.org/jdk.git pull/17659/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 17659
View PR using the GUI difftool:
$ git pr show -t 17659
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17659.diff
Webrev
Link to Webrev Comment