8342703: CSS transition is not started when initial value was not specified #1607
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When the initial value of a styleable property is not specified in a stylesheet, no transition is started:
The expected behavior is that a transition is started in this case, since the default value of
-fx-opacity
is 1.The reason for this bug is that
StyleableProperty
implementations do not start a CSS transition when the value is applied for the first time. The intention behind this is that a node that is added to the scene graph should not start transitions. CSS transitions should only be started after the node has been shown for the first time.The logic to detect this situation is currently as follows:
However, this does not work. When no initial style is specified in the stylesheet,
this.origin
will not be set, and thus no transition will be started even after the node has been shown. The new logic works like this:A
Node.initialCssState
flag is added. Initially, this istrue
. Manually callingapplyCss
or similar methods will not clear this flag, as we consider all manual CSS processing to be part of the "initial CSS state". Only at the end ofScene.doCSSPass
will this flag be cleared on all nodes that have expressed their interest. This mechanism ensures that a node will be eligible for CSS transitions only after the following conditions have been satisfied:/reviewers 2
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1607/head:pull/1607
$ git checkout pull/1607
Update a local copy of the PR:
$ git checkout pull/1607
$ git pull https://git.openjdk.org/jfx.git pull/1607/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1607
View PR using the GUI difftool:
$ git pr show -t 1607
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1607.diff
Webrev
Link to Webrev Comment