On Sat, 9 Mar 2024 10:27:21 GMT, Marius Hanl <[email protected]> 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
175:
> 173:
> 174: @Override
> 175: protected void show() {
Another idea I was trying that worked fine is to have a new method inside
`PopupWindow`, which we can call rather than `show()`:
protected final void applySceneStylesFromOwner(Window owner) {
Scene sceneValue = getScene();
final Scene ownerScene = getRootWindow(owner).getScene();
if (ownerScene != null) {
if (ownerScene.getUserAgentStylesheet() != null) {
sceneValue.setUserAgentStylesheet(ownerScene.getUserAgentStylesheet());
}
sceneValue.getStylesheets().setAll(ownerScene.getStylesheets());
if (sceneValue.getCursor() == null) {
sceneValue.setCursor(ownerScene.getCursor());
}
}
}
The `show()` method inside `PopupWindow` is also doing excactly the code above,
thats why I ended up calling it.
But we can also think about just calling that code directly and not `show`, we
just need to extract that part of the code and create a `protected` method with
it.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1394#discussion_r1518551314