Skip to content

8342462: TextAreaSkin: remove USE_MULTIPLE_NODES #1601

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

Conversation

andy-goryachev-oracle
Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle commented Oct 16, 2024

Removed "not yet fully implemented" USE_MULTIPLE_NODES and related code.

I would like to remove the early unfinished idea of using multiple Text nodes in TextAreaSkin to clean up the code, to make it easier to do fixes for JDK-8342233 and JDK-8296266.

Also some minor cleanup.

Summary of Changes

  • removed USE_MULTIPLE_NODES and code paths that correspond to its true value
  • permanently adding one Text node to paragraphNodes Group, keeping the latter for compatibility purposes
  • removed any code that scans paragraphNodes children
  • using getTextNode() in place of ((Text)paragraphNodes.getChildren().get(0))

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8342462: TextAreaSkin: remove USE_MULTIPLE_NODES (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1601

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 16, 2024

👋 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 Oct 16, 2024

@andy-goryachev-oracle 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:

8342462: TextAreaSkin: remove USE_MULTIPLE_NODES

Reviewed-by: kcr

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 7 new commits pushed to the master branch:

  • 6ac2dd3: 8336031: Create implementation of NSAccessibilityStaticText protocol
  • f5b18ad: 8337280: Include jdk.jsobject module with JavaFX
  • f71c390: 8340003: Bump minimum JDK version for JavaFX to JDK 22
  • 77482de: 8341372: BackgroundPosition, BorderImage, BorderStroke, CornerRadii should be final
  • c4b1e1c: 8341686: FX: Update copyright year in docs, readme files to 2025
  • 1c86d3b: 8340850: Wrong bug ID listed as reason for skipping SwingNodePlatformExitCrashTest
  • 9c31cb0: 8340005: Eliminate native access calls from javafx.swing

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 master branch, type /integrate in a new comment.

@openjdk openjdk bot changed the title 8342462 TextAreaSkin: remove USE_MULTIPLE_NODES 8342462: TextAreaSkin: remove USE_MULTIPLE_NODES Oct 16, 2024
@andy-goryachev-oracle andy-goryachev-oracle marked this pull request as ready for review October 17, 2024 14:53
@openjdk openjdk bot added the rfr Ready for review label Oct 17, 2024
@mlbridge
Copy link

mlbridge bot commented Oct 17, 2024

Webrevs

@kevinrushforth
Copy link
Member

Either @arapte or I will review this. I think a single reviewer will be enough, given that the functionality hasn't changed.

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.

This looks equivalent to the current code, and I couldn't see anything wrong in my testing. I left a couple questions inline.

return null;
@Override
protected PathElement[] getUnderlineShape(int start, int end) {
return getTextNode().underlineShape(start, end);
Copy link
Member

Choose a reason for hiding this comment

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

The former code would return null if start > textNode.textProperty().getValueSafe().length(). I think this is OK, given that the implementation of Text::underlineShape checks -- what do you think? This applies to getRangeShape, too.

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 think it's ok. The javadoc for TextInputControlSkin::underlineShape() does not specify a null return value.

In fact, the javadoc for Text::rangeShape() and ::underlineShape() say

@return an array of {@code PathElement} which can be used to create a {@code Shape}

implying that it should never be null as the return value is typically used in Shape::getElements().setAll() or .addAll() which will throw an NPE if the thing is null. In fact, Text::rangeShape() (used for underline and range shape) always returns a non-null value.


if (y < contentView.snappedTopInset()) {
// Select the character at x in the first row
return 0;
Copy link
Member

Choose a reason for hiding this comment

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

I see that the implementation of the now-removed getNextInsertionPoint method also returned 0 unconditionally, so this is equivalent, but... isn't the comment wrong, since x isn't used in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comment is indeed wrong, will fix.

return 0;
} else if (y > contentView.snappedTopInset() + contentView.getHeight()) {
// Select the character at x in the last row
return (textArea.getLength() - paragraphNode.getText().length());
Copy link
Member

Choose a reason for hiding this comment

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

Same question about the comment being wrong.

@openjdk openjdk bot added the ready Ready to be integrated label Oct 21, 2024
@openjdk openjdk bot removed the ready Ready to be integrated label Oct 21, 2024
@openjdk openjdk bot added the ready Ready to be integrated label Oct 21, 2024
@andy-goryachev-oracle
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Oct 22, 2024

Going to push as commit e2a3074.
Since your change was applied there have been 7 commits pushed to the master branch:

  • 6ac2dd3: 8336031: Create implementation of NSAccessibilityStaticText protocol
  • f5b18ad: 8337280: Include jdk.jsobject module with JavaFX
  • f71c390: 8340003: Bump minimum JDK version for JavaFX to JDK 22
  • 77482de: 8341372: BackgroundPosition, BorderImage, BorderStroke, CornerRadii should be final
  • c4b1e1c: 8341686: FX: Update copyright year in docs, readme files to 2025
  • 1c86d3b: 8340850: Wrong bug ID listed as reason for skipping SwingNodePlatformExitCrashTest
  • 9c31cb0: 8340005: Eliminate native access calls from javafx.swing

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 22, 2024
@openjdk openjdk bot closed this Oct 22, 2024
@openjdk openjdk bot removed ready Ready to be integrated rfr Ready for review labels Oct 22, 2024
@openjdk
Copy link

openjdk bot commented Oct 22, 2024

@andy-goryachev-oracle Pushed as commit e2a3074.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@andy-goryachev-oracle andy-goryachev-oracle deleted the 8342462.text.area.skin.cleanup branch October 22, 2024 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants