RFR: 8311895: CSS Transitions [v2]
Michael Strauß
mstrauss at openjdk.org
Mon Jul 31 18:07:54 UTC 2023
On Mon, 31 Jul 2023 12:39:26 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> Michael Strauß has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Make TransitionEvent final
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/css/TransitionDefinition.java line 45:
>
>> 43: */
>> 44: public record TransitionDefinition(String propertyName, Duration duration,
>> 45: Duration delay, Interpolator interpolator) {
>
> I see this is an internal class that makes use of `javafx.util.Duration`. I think it's not further exposed. I see a lot of calls getting the duration/delay which almost instantly converts the value to nano seconds. It might be an idea to use nanos here immediately (ie. use `long` in the constructor) and have the converter supply longs.
I've tried using `long` nanosecond fields. The amount of conversions doesn't change, it merely shifts around the location where the conversions happen. Since there's no obvious benefit, I prefer to use `javafx.util.Duration` for clarity.
Additionally, I've introduced two helper methods in `TransitionTimer` (`nanosToMillis` and `millisToNanos`) to make sure that conversion is done correctly in all places.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/870#discussion_r1279698006
More information about the openjfx-dev
mailing list