On Mon, 10 Aug 2026 17:15:28 GMT, Andy Goryachev <[email protected]> wrote:

>> Does not happen as we will check with `contains`. There is also a test for 
>> this scenario.
>
> I suppose I need to spell this out.  L527 adds new stylesheets, but there is 
> not removing operation.  So if you keep adding stylesheets and not removing 
> the old stylesheets, they just get accumulated.
> 
> Think of a scenario when a stylesheet is not sourced from a file/resource, 
> but generated programmatically via a data url.

I guess this question is also about reusing `PopupWindow`?

The problem is that the stylesheets and the user agent stylesheet are hard to 
get right. 
We don't want to overwrite any user stylesheet but still add the owner ones.

Even if we try to track that, we may still accidently remove a stylesheet set 
from the developer. Or that was intended to stay. 
Think about we add the owner stylesheets, the developer checks the stylesheets 
with `contains` later and does not add a stylesheet because it is already there 
- fine. We show it again, and e.g. the owner changed, the stylesheets is 
removed but the developer really wanted that one stylesheet to stay.

I think this can't be solved perfectly, because the current magic logic is 
already bad. We could only try to solve this on a best-effort basis.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2236#discussion_r3802399348

Reply via email to