On Thu, 10 Sep 2026 00:16:40 GMT, Marius Hanl <[email protected]> wrote:

>> modules/javafx.graphics/src/main/java/javafx/scene/CssStyleHelper.java line 
>> 104:
>> 
>>> 102:                 ancestor.cssHelperStale = false;
>>> 103:                 ancestor.cssHelperResolvedEarly = true;
>>> 104:                 ancestor.styleHelper = createStyleHelper(ancestor, 
>>> path, index);
>> 
>> `cssHelperStale` is reset before the the new helper is created, which will 
>> cause problems if the new helper resets css properties, invoking listeners.  
>> if such a listener styles another descendant, or adds another descendant, 
>> the CSS code will see `cssHelperStale=false` but observe the old helper 
>> instance.
>> 
>> we might want to consider either a "resolving" state or detect this 
>> condition and retry.
>
> Not sure I understand. Why would it do that? We just create it and move on. 
> No other method is called.

the use case is this:
- layout() is called at the top of the hierarchy
- a child is added somewhere in layoutChildren(), which invokes reapplyCSS(), 
which calls createStyleHelper()
- createStyleHelper() triggers another property change, and let's say that 
property has a listener that adds another child
- since isPerformingLayout() is true, the child's css is processed immediately

the issue is that while `ancestor.cssHelperStale = false`, the 
`ancestor.styleHelper` is still old, causing wrong css to be applied (which 
represents a regression)

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2225#discussion_r3982829675

Reply via email to