RFR: 8345188: Support tree-structural pseudo-classes [v10]

John Hendrikx jhendrikx at openjdk.org
Thu Jan 9 21:43:46 UTC 2025


On Thu, 9 Jan 2025 19:13:20 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

> By the way, I still think that front-inserting nodes one by one is a pathological situation, and can be easily fixed by just using `addAll` instead of `add` in a loop.
> 
> In terms of a future enhancement, I can't really see us put in a lot of work just for one pathological use case. Discarding this feature will probably put it in the "never" category. On the other hand, there's a whole category of pseudo-classes that are unrepresentable right now in JavaFX, as they basically depend on a formula, like `nth-child(2n+1)`. But that's just speculation at this point.

I suspect browsers have an easy way to track the index of each child (without having to renumber them).  All that would take is a different underlying list type as Nodes must be unique.  A Tree structure for example can determine the index of a Node with O(log N) performance for adds/removals/find index.  If browsers support advanced features like `nth-child(2n+1)` I suspect they will not be using a structure that require renumbering all items or require a full search to determine the index.

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

PR Comment: https://git.openjdk.org/jfx/pull/1652#issuecomment-2581298176


More information about the openjfx-dev mailing list