RFR: 8320796: CssMetaData.combine() [v6]

John Hendrikx jhendrikx at openjdk.org
Wed Nov 29 21:53:26 UTC 2023


On Wed, 29 Nov 2023 21:21:43 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

> 3. Adding two pointers to every Node is not a good solution, in my opinion.  Replacing lazy initialization with a busy one is not a good solution.  Am I missing something here?

Given that it is a huge hassle to implement your own CSS properties, a more user friendly solution that has no performance downsides is not something that is beyond consideration because it would add 8 bytes to `Node`.  The lazy instantiation is also not an issue, as to display the scene (time to display an FX window is the benchmark here) these properties must be initialized anyway; they can't be deferred indefinitely like some other rarely used properties.

Current solution requires a static field, a static method, and an override of `getCssMetaData`, and manual management of parent CSS properties (which you are improving here slightly, but still manual).

New solution I offered is backwards compatible if we don't make `Node#getCssMetaData` final, and even would allow you to "skip" properties still (if that's even something you'd want at all).  All existing controls can be cleaned up and no longer need to override `getCssMetaData`.  They will need to retain `getClassCssMetaData` for being compatible with 3rd party controls that still call this, but it will no longer be used inside FX itself.

For new (user created) controls, all that is needed is a call in the constructor (`contributeProperties`) -- no fiddling with parent properties for "manual" inheritance, no static method, no lazy initialization, just a plain and simple list of "here are my CSS properties".

Is it out of scope for this?  Sure.  Would this alternative still require this PR?  No.  Is this new public API addition innocent enough that it doesn't matter?  Sure.

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

PR Comment: https://git.openjdk.org/jfx/pull/1296#issuecomment-1832751395


More information about the openjfx-dev mailing list