jfx icon indicating copy to clipboard operation
jfx copied to clipboard

8263095: Provide a way for a custom control to indicate that its userAgentStyleSheet has changed

Open palexdev opened this issue 4 years ago • 11 comments

This change allows custom control to change their style dynamically When the user-agent stylesheet changes the property automatically calls NodeHelper.reapplyCSS(Region.this); to recompute the CSS for the node and its children. To make this work the StyleManager class must be fixed too. The line regionUserAgentStylesheet = weakRegionUserAgentStylesheetMap.computeIfAbsent((Region)region, Region::getUserAgentStylesheet); is problematic because if the region is already present in the map but the user-agent stylesheet changed, the value of regionUserAgentStylesheet is not updated and this leads to controls having the wrong style. To fix this issue I added this check:

if (((Region) region).getUserAgentStylesheet() != null && !((Region) region).getUserAgentStylesheet().equals(regionUserAgentStylesheet)) {
    weakRegionUserAgentStylesheetMap.put((Region) region, ((Region) region).getUserAgentStylesheet());
    regionUserAgentStylesheet = ((Region) region).getUserAgentStylesheet();
}


Progress

  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue
  • [ ] Change must be properly reviewed

Integration blocker

 ⚠️ The change requires a CSR request to be approved.

Issue

  • JDK-8263095: Provide a way for a custom control to indicate that its userAgentStyleSheet has changed

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/525/head:pull/525
$ git checkout pull/525

Update a local copy of the PR:
$ git checkout pull/525
$ git pull https://git.openjdk.java.net/jfx pull/525/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 525

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/525.diff

palexdev avatar May 31 '21 13:05 palexdev

Hi @palexdev, welcome to this OpenJDK project and thanks for contributing!

We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing /signed in a comment in this pull request.

If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user palexdev" as summary for the issue.

If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing /covered in a comment in this pull request.

bridgekeeper[bot] avatar May 31 '21 13:05 bridgekeeper[bot]

:warning: @palexdev a branch with the same name as the source branch for this pull request (master) is present in the target repository. If you eventually integrate this pull request then the branch master in your personal fork will diverge once you sync your personal fork with the upstream repository.

To avoid this situation, create a new branch for your changes and reset the master branch. You can do this by running the following commands in a local repository for your personal fork. Note: you do not have to name the new branch NEW-BRANCH-NAME.

$ git checkout -b NEW-BRANCH-NAME
$ git branch -f master 5e6d4429159e3fab9ec0aab9720393850d179710
$ git push -f origin master

Then proceed to create a new pull request with NEW-BRANCH-NAME as the source branch and close this one.

openjdk[bot] avatar May 31 '21 13:05 openjdk[bot]

Webrevs

mlbridge[bot] avatar Jun 01 '21 17:06 mlbridge[bot]

/reviewers 2

nlisker avatar Jun 01 '21 17:06 nlisker

@nlisker The number of required reviews for this PR is now set to 2 (with at least 1 of role reviewers).

openjdk[bot] avatar Jun 01 '21 17:06 openjdk[bot]

/csr

nlisker avatar Jun 01 '21 18:06 nlisker

@nlisker has indicated that a compatibility and specification (CSR) request is needed for this pull request. @palexdev please create a CSR request for issue JDK-8263095. This pull request cannot be integrated until the CSR request is approved.

openjdk[bot] avatar Jun 01 '21 18:06 openjdk[bot]

@nlisker Hello, sorry I'm new to contributions, my OCA has been approved recently I have read the CSR FAQ but I don't understand where I should go to create it

palexdev avatar Jun 02 '21 01:06 palexdev

Don't worry about the CSR for now, someone will create it when the review is near completion. However, since this is an enhancement, you should discuss it first in the mailing list as explained in the README file of the repo.

nlisker avatar Jun 02 '21 03:06 nlisker

Don't worry about the CSR for now, someone will create it when the review is near completion. However, since this is an enhancement, you should discuss it first in the mailing list as explained in the README file of the repo.

Exactly. The discussion should happen on [email protected]. Specifically, the place to start is with the newly proposed API and behavioral changes. This is what is important to get general agreement / buy-in on. Any newly proposed public methods need to be clearly documented and justified. Also, there needs to be a discussion as to whether this change in behavior should be done unconditionally, which the current PR proposes to do, or whether this behavior should be "opt in".

Since we haven't yet had the discussion, this PR is not yet ready to be reviewed. It can be used for illustrative purposes as long as the focus is on the public API and behavioral changes and not (yet anyway) on the code.

kevinrushforth avatar Jun 02 '21 21:06 kevinrushforth

Moving this to Draft to make it clear that it isn't yet ready for review.

kevinrushforth avatar Jun 04 '21 20:06 kevinrushforth

@palexdev This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

bridgekeeper[bot] avatar Mar 31 '23 23:03 bridgekeeper[bot]