RFR: 8342703: CSS transition is not started when initial value was not specified [v3]

Andy Goryachev angorya at openjdk.org
Tue Jan 7 20:54:43 UTC 2025


On Tue, 7 Jan 2025 20:49:20 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/javafx/css/StyleableBooleanProperty.java line 74:
>> 
>>> 72:     public void applyStyle(StyleOrigin origin, Boolean v) {
>>> 73:         // If the value is applied for the first time, we don't start a transition.
>>> 74:         TransitionDefinition transition = getBean() instanceof Node node && !NodeHelper.isInitialCssState(node) ?
>> 
>> minor: to simplify the code in many places, you could change `isInitialState` to accept an `Object` argument instead of `Node` and do an `instanceof` there.
>
> I don't think this would work, since we need the `Node`-typed `node` variable as an argument for `NodeHelper.findTransitionDefinition`, so we can't remove the `instanceof` test here.

NodeHelper:


    public static boolean isInitialCssState(Object node) {
        if(node instanceof Node n) {
            return nodeAccessor.isInitialCssState(n);
        }
        return false;
    }

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1607#discussion_r1906025294


More information about the openjfx-dev mailing list