Skip to content

8357393: RichTextArea: fails to properly save text attributes #1813

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

andy-goryachev-oracle
Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle commented May 20, 2025

Fixing a bug that breaks proper saving of character attributes.

This, unfortunately, makes a breaking change in the RichTextArea native format [0].

References

[0] https://github.com/andy-goryachev-oracle/Test/blob/main/doc/RichTextArea/RichTextArea_DataFormat_V2.md


Progress

  • Change requires CSR request JDK-8357505 to be approved
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issues

  • JDK-8357393: RichTextArea: fails to properly save text attributes (Bug - P4)
  • JDK-8357505: RichTextArea: fails to properly save text attributes (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1813/head:pull/1813
$ git checkout pull/1813

Update a local copy of the PR:
$ git checkout pull/1813
$ git pull https://git.openjdk.org/jfx.git pull/1813/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1813

View PR using the GUI difftool:
$ git pr show -t 1813

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1813.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 20, 2025

👋 Welcome back angorya! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented May 20, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@andy-goryachev-oracle andy-goryachev-oracle changed the title 8357393: RichTextArea: fails to properly serialize text attributes 8357393: RichTextArea: fails to properly save text attributes May 21, 2025
@andy-goryachev-oracle
Copy link
Contributor Author

/csr

@openjdk openjdk bot added the csr Need approved CSR to integrate pull request label May 21, 2025
@openjdk
Copy link

openjdk bot commented May 21, 2025

@andy-goryachev-oracle has indicated that a compatibility and specification (CSR) request is needed for this pull request.

@andy-goryachev-oracle please create a CSR request for issue JDK-8357393 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.

@andy-goryachev-oracle andy-goryachev-oracle marked this pull request as ready for review May 21, 2025 20:42
@openjdk openjdk bot added the rfr Ready for review label May 21, 2025
@mlbridge
Copy link

mlbridge bot commented May 21, 2025

Webrevs

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks reasonable to me. I left a suggestion about whether we really need to allow null, but that's preexisting and could be considered in a follow-up.

Another thing that needs to be done in a follow-up is that you will need to add versioning to the internal rich text format. While this is still an incubating API we can break backward compatibility, but at some point, we will need a format that can evolve compatibility with newer runtimes able to read older files.

@@ -428,7 +428,7 @@ private static void initAccessor() {
StyleAttributeMapHelper.setAccessor(new StyleAttributeMapHelper.Accessor() {
@Override
public StyleAttributeMap filterAttributes(StyleAttributeMap ss, boolean isParagraph) {
return ss.filterAttributes(isParagraph);
return (ss == null ? null : ss.filterAttributes(isParagraph));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could skip the null check if you disallowed a null map.

* @param ss the style attribute map
* @return the instance
* @return the instance of StyleAttributeMap, or null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a good reason to allow null here? Unless there is a semantic difference between null and the empty map, it might be easier to make this non-nullable. This could be done later, since the fact that it can return null is preexisting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've recorded this in the feedback document - this might be worth doing.

@kevinrushforth
Copy link
Member

@Ziad-Mid Can you be the second reviewer?

/reviewers 2

@openjdk
Copy link

openjdk bot commented Jun 5, 2025

@kevinrushforth
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

@andy-goryachev-oracle
Copy link
Contributor Author

While this is still an incubating API we can break backward compatibility, but at some point, we will need a format that can evolve compatibility with newer runtimes able to read older files.

You are absolutely right: we must provide a mechanism for versioning as well as properly document the format. The draft spec is
https://github.com/andy-goryachev-oracle/Test/blob/main/doc/RichTextArea/RichTextArea_DataFormat_V2.md

but it is guaranteed to change to enable versioning (and addition of tab stop attributes in #1800)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
csr Need approved CSR to integrate pull request rfr Ready for review
Development

Successfully merging this pull request may close these issues.

2 participants