On Tue, 6 Oct 2026 21:06:31 GMT, Andy Goryachev <[email protected]> wrote:

>> When ContextMenu.show(node, side, x, y) is executed, the CSS is evaluated 
>> multiple times.
>> Of these 3 times, 2 process a non-final CSS state.
>> This leads to temporary, unnecessary changes.
>> 
>> This is fixed by properly defining the stylesheets and the 
>> ownerWindow/ownerNode properties of the context menu
>> before applyCss is called. The previous solution was incomplete and resulted 
>> in unnecessary CSS calls.
>> 
>> Slightly related to my other PR: https://github.com/openjdk/jfx/pull/2213
>> But it is fixed in a way that works independently of it.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> modules/javafx.controls/src/test/java/test/javafx/scene/control/ContextMenuTest.java
>  line 69:
> 
>> 67: import test.com.sun.javafx.scene.control.infrastructure.MouseEventFirer;
>> 68: import test.com.sun.javafx.scene.control.infrastructure.StageLoader;
>> 69: import test.javafx.scene.CssStyleHelperTest;
> 
> this produces two errors in Eclipse:
> 
> 
> Description   Resource        Type    Path    Location
> CssStyleHelperTest cannot be resolved ContextMenuTest.java    Java Problem    
> /controls/src/test/java/test/javafx/scene/control       line 733
> The type test.javafx.scene.CssStyleHelperTest is not accessible       
> ContextMenuTest.java    Java Problem    
> /controls/src/test/java/test/javafx/scene/control       line 71
> 
> 
> 
> what bothers me here is that the `toDataURL()` method referred to should not 
> be in a file called `CssStyleHelperTest` but maybe in `Utils`, and also that 
> the are creating an inter-module dependency for tests.
> 
> Is there a way to create a utility package accessible to all the modules 
> where we can park all the little utility methods?  Or do we have to duplicate 
> this and similar methods across the modules?
> 
> we also have two `CssStyleHelperTest` classes in graphics/src/test and 
> tests/system

yeah it should really just be copied into this class. I will (want to) 
eventually improve the tests, but for now I was a bit scared due to backports, 
so will probably make a mailing thread about it first.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2215#discussion_r4200659342

Reply via email to