On Fri, 18 Aug 2023 09:19:34 GMT, John Hendrikx <jhendr...@openjdk.org> wrote:
>> I also noticed this code, which I think will not do the correct thing when >> `change` is not 1 or -1: >> >> void adjust(int change) { >> count += change; >> >> if (count == 1) { >> set(true); >> } else if (count == 0) { >> set(false); >> } >> } >> >> For example, if focus within currently is `false`, and it is "adjusted" by >> 5, the count goes from 0 to 5 in one go. It will remain `false` then. Is >> this intended? > >> Is it possible a user can interfere with this process by adding a listener >> to `focusWithinProperty`? It fires events when it goes from `true` to >> `false` and vice versa. > > Can disregard this, it seems the property uses a special base class that > breaks with the general property contract. > I also noticed this code, which I think will not do the correct thing when > `change` is not 1 or -1: > > ``` > void adjust(int change) { > count += change; > > if (count == 1) { > set(true); > } else if (count == 0) { > set(false); > } > } > ``` > > For example, if focus within currently is `false`, and it is "adjusted" by 5, > the count goes from 0 to 5 in one go. It will remain `false` then. Is this > intended? Good catch! I've added another test for this edge case. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1210#discussion_r1298460756