-
Notifications
You must be signed in to change notification settings - Fork 482
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
8342703: CSS transition is not started when initial value was not specified #1607
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back mstrauss! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
Webrevs
|
@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! |
* is completed. Nodes will use this event to determine whether they are in their initial | ||
* CSS state (see {@link Node#initialCssState}. | ||
*/ | ||
private final Set<Node> clearInitialCssStateNodes = Collections.newSetFromMap(new IdentityHashMap<>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use a normal HashSet
? What advantage has this approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HashSet
uses Object.equals
, which can be overridden by user code, and this would break the logic. It's the instance that wants to be notified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I never ever did that for Node
s (and I don't know why I would need to), but you are right, it is indeed possible and therefore a possible scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is overly cautious. Overriding equals on a class that did not implement equals in a hierarchy you don't control is not a very reasonable scenario. You will not be able to call super.equals
with reasonable results if the hierarchy did not implement it in the first place. This is because there may be private data that you can't access for your equality comparison (and Node
has lots of that). We also use WeakHashMap
s in several areas already with subtypes of Node
s as keys (I found Region
, Parent
and TreeView
being used as keys), so this kind of override should probably be documented as being unsupported on Node
.
Perhaps it should even be made final so FX internals can rely on it being correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I think we should make Node.equals()
final in this case.
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
Using Webrev
Link to Webrev Comment