On Mon, 31 May 2021 13:57:22 GMT, Alessadro Parisi <d...@openjdk.org> wrote:

> This change allows custom control to change their style dynamically
> When the user-agent stylesheet changes the property automatically calls 
> `NodeHelper.reapplyCSS(Region.this);` to recompute the CSS for the node and 
> its children.
> To make this work the StyleManager class must be fixed too.
> The line `regionUserAgentStylesheet = 
> weakRegionUserAgentStylesheetMap.computeIfAbsent((Region)region, 
> Region::getUserAgentStylesheet);
> ` is problematic because if the region is already present in the map but the 
> user-agent stylesheet changed, the value of `regionUserAgentStylesheet` is 
> not updated and this leads to controls having the wrong style.
> To fix this issue I added this check:
> 
> if (((Region) region).getUserAgentStylesheet() != null && !((Region) 
> region).getUserAgentStylesheet().equals(regionUserAgentStylesheet)) {
>     weakRegionUserAgentStylesheetMap.put((Region) region, ((Region) 
> region).getUserAgentStylesheet());
>     regionUserAgentStylesheet = ((Region) region).getUserAgentStylesheet();
> }

This pull request has been closed without being integrated.

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

PR: https://git.openjdk.org/jfx/pull/525

Reply via email to