RFR: JDK-8296387: [Tooltip, CSS] -fx-show-delay is only applied to the first tooltip that is shown before it is displayed [v2]

John Hendrikx jhendrikx at openjdk.org
Sat Mar 9 04:10:01 UTC 2024


On Fri, 8 Mar 2024 16:10:26 GMT, Marius Hanl <mhanl at openjdk.org> wrote:

>> This PR fixes a long standing issue where the `Tooltip` will always wait one second until it appears the very first time, even if the 
>> `-fx-show-delay` was set to another value.
>> 
>> The culprit is, that the `cssForced` flag is not inside `Tooltip`, but inside the `TooltipBehaviour`. So the very first `Tooltip` gets processed correctly, but after no `Tooltip` will be processed by CSS before showing, resulting in the set `-fx-show-delay` to not be applied immediately.
>> 
>> Added a bunch of headful tests for the behaviour since there were none before.
>
> Marius Hanl has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   JDK-8296387: [Tooltip, CSS] -fx-show-delay is only applied to the first tooltip that is shown before it is displayed

Although the change is an improvement, I think a similar problem will still be present when CSS changes.  The `cssForced` flag I think needs to reset to `false` whenever a CSS styleable property of the tool tip is modified.  That would include all such properties...

This is a bit of a general issue in JavaFX (it really shouldn't be possible for any `Node` to be shown that hasn't had CSS processed for it), yet this can easily happen, and depending on how different the default style is versus the intended style, this can lead to a visual artifact (most noticable is for example a white background, when it is supposed to be black or transparent).

Perhaps we should open an issue to solve this for all controls in one go? A solution that would prevent **any** `Node` from being displayed without CSS applied?

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

PR Review: https://git.openjdk.org/jfx/pull/1394#pullrequestreview-1926087206


More information about the openjfx-dev mailing list