jfx
jfx copied to clipboard
8311895: CSS Transitions
Implementation of CSS Transitions.
Future enhancements
CSS transitions requires all participating objects to implement the Interpolatable
interface. For example, targeting -fx-background-color
only works if all background-related objects are interpolatable: Color
, BackgroundFill
, and Background
.
In a follow-up PR, the following types will implement the Interpolatable
interface:
LinearGradient
, RadialGradient
, Stop
, Background
, BackgroundFill
, BackgroundImage
, BackgroundPosition
, BackgroundSize
, BackgroundStroke
, BorderWidths
, CornerRadii
, Insets
.
Limitations
This implementation supports both shorthand and longhand notations for the transition
property. However, due to limitations of JavaFX CSS, mixing both notations doesn't work:
.button {
transition: -fx-background-color 1s;
transition-easing-function: linear;
}
This issue should be addressed in a follow-up enhancement.
Progress
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
- [ ] Change must be properly reviewed (3 reviews required, with at least 1 Reviewer, 2 Authors)
- [ ] Change requires CSR request JDK-8313383 to be approved
Issues
- JDK-8311895: CSS Transitions (Enhancement - P4)
- JDK-8313383: CSS Transitions (CSR)
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/870/head:pull/870
$ git checkout pull/870
Update a local copy of the PR:
$ git checkout pull/870
$ git pull https://git.openjdk.org/jfx.git pull/870/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 870
View PR using the GUI difftool:
$ git pr show -t 870
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/870.diff
Webrev
:wave: Welcome back mstrauss! 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.
@mstr2 this pull request can not be integrated into master
due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:
git checkout feature/css-transitions
git fetch https://git.openjdk.org/jfx master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push
@mstr2 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!
Hi @shaoerkuai, thanks for making a comment in an OpenJDK project!
All comments and discussions in the OpenJDK Community must be made available under the OpenJDK Terms of Use. 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 shaoerkuai for the summary.
If you are not an OpenJDK Author, Committer or Reviewer, simply check the box below to accept the OpenJDK Terms of Use for your comments.
- [ ] I agree to the OpenJDK Terms of Use for all comments I make in a project in the OpenJDK GitHub organization.
Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use.
@mstr2 This pull request has been inactive for more than 16 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open
pull request command.
/open
@mstr2 This pull request is now open
If this is moved forward, it will need a CSR.
/csr
@kevinrushforth has indicated that a compatibility and specification (CSR) request is needed for this pull request.
@mstr2 please create a CSR request for issue JDK-8311895 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.
Webrevs
- 22: Full - Incremental (29f43ed6)
- 21: Full (10c06a97)
- 20: Full - Incremental (8a938dc8)
- 19: Full - Incremental (f64ad706)
- 18: Full - Incremental (4cb6c876)
- 17: Full - Incremental (d3184e6c)
- 16: Full (a43dee30)
- 15: Full (6614abb9)
- 14: Full - Incremental (137a00c7)
- 13: Full - Incremental (f7ab6db3)
- 12: Full (7edb374f)
- 11: Full - Incremental (1595a190)
- 10: Full - Incremental (22aa4d64)
- 09: Full (b76568c3)
- 08: Full - Incremental (482b1ec4)
- 07: Full (035fe5ca)
- 06: Full - Incremental (0b779082)
- 05: Full - Incremental (da61e64c)
- 04: Full - Incremental (deb65ea3)
- 03: Full - Incremental (66ee849f)
- 02: Full - Incremental (94fa9d2a)
- 01: Full - Incremental (8e46c89f)
- 00: Full (9cdeb498)
Wow, replacing some Java code with CSS can make the Java code more focused on business logic, making it much cleaner.
/reviewers 3
@kevinrushforth The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 3 (with at least 1 Reviewer, 2 Authors).
@mstr2 This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 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!
Let’s keep this open.
@mstr2 This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 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!
Please stay open.
@hjohn Would you be willing to expand your feedback to a complete review?
@mstr2 This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 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!
@mstr2 This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open
pull request command.
/open
@mstr2 This pull request is now open
@mstr2 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:
8311895: CSS Transitions
Reviewed-by: mmack, nlisker, 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 4 new commits pushed to the master
branch:
- c8b96e4e6da18b4ab1331bb3a5b48cf1b8b3e2e6: 8333147: update maven classifier syntax to recent gradle version
- 4a33d5ef13c7bc72900fa6769fe4779ccec5bc98: 8330304: MenuBar: Invisible Menu works incorrectly with keyboard arrows
- 3e768dc78e68b8e2a9d39b72581ef2b1da0597b1: 8332748: Grammatical errors in animation API docs
- a39652b3e72dd40dc2a24e06490d6b365f69bbe3: 8323511: Scrollbar Click jumps inconsistent amount of pixels
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.
I've implemented @hjohn's suggestion of an interface between TransitionTimer
and StyleableProperty
with the new TransitionMediator
class. This cleans up the code and separates the interacting components.
This PR is now again ready for review.
@mstr2 This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 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!
- Attempting to do background-color transitions doesn't work, I presume because it's not yet
Interpolatable
in this PR. Do we need to emit a warning in such a case? Right now thetransition
CSS code just seems to be ignored.
CSS transitions work with styleable properties that are either primitives or Interpolatable
objects. So if you apply a transition to the sub-property -fx-background-color
, what really happens is that the CSS subsystem creates a new Background
instance and applies it to the Region.background
property. However, since Background
is not interpolatable, you won't see an animation. This will start to work once all relevant classes are interpolatable, which will come with a subsequent PR.
I'm not sure if we really need a warning. The unexpected non-animation is really only due to a few missing interpolatable classes, which will be fixed soon.
- Same with the current limitation of not being able to mix shorthand and longhand notations, do we need a warning if it is attempted?
This is out of scope for this PR, since the problem is not unique to the CSS transition
property. We should improve the CSS parser to handle shorthand/longhand notations uniformly.
I still don't know what happens when a value is programmatically set while a css transition is in progress. What I understood is that binding the property will not allow the transition to start/continue, but didn't see where setting a value was mentioned.
Any of the following actions will cancel a running transition:
- Setting the property value
- Binding the property
- Making the node invisible (i.e.
isTreeVisible()
returns false) - Removing the node from the scene graph
In effect, transitions are only active when "left alone", any programmatic interaction will cancel them.
This is what I would expect, so looks good. Where is this mentioned to the user?
This is what I would expect, so looks good. Where is this mentioned to the user?
Good question. Since we don't have any suitable API elements for javadocs, I've added some documentation to the CSS reference.
I think the CSR needs updating.