On Sat, 9 Mar 2024 10:27:21 GMT, Marius Hanl <mh...@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 updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Allow Tooltip to process the owner styles first so that also global 
> stylesheets are considered for the e.g. tooltip show-delay

modules/javafx.controls/src/main/java/javafx/scene/control/Tooltip.java line 
177:

> 175:     protected void show() {
> 176:         // The very first show call is just for us to do the correct CSS 
> processing, so we ignore the request here.
> 177:         if (!cssForced) {

I am *very* suspicious of this change.  Yes, it sort of works, but I wonder if 
it might backfire as it breaks the contract of show() and also depends on some 
assumptions ("The very first show call is just for us to do the correct CSS 
processing").

Would it be possible to try the applySceneStylesFromOwner() approach, maybe by 
moving the method to Utils to avoid changing the API?  This issue does not seem 
to be limited to Tooltip - there is a similar code in CustomColorDialog:88 for 
example.

What do you think?

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1394#discussion_r1561619791

Reply via email to