This PR https://github.com/godotengine/godot/pull/104451 introduced
a tricky regression. Canvas item transforms could risk not being
updated for multiple frames due to the conditional on the line
in this commit. Before the "approx_pos|size_changed" fix, the
transform would get updated incidentally either way. But now there's
a gap where (pos_changed && !size_changed) may not be true for a few
frames and there's nothing else left to trigger a transform update.
The fix is quite simple, for updating the canvas item transform
we remain trigger happy around position changes, but respect the
approx_size_changed.
The default limit is fine for most RID_Owners but 3d instances, CanvasItems, and physics bodies need a higher limit.
There is a small memory cost to increasing the limit, so it should only be done where needed.
* It turns out the majority of this work was done already by AThousandShips as part of #89451. This allows to do lock-less emitting of signals.
* This means, that only the signal map needs to be protected, making the task simple and without risk of deadlocks, or affecting performance.
* Objects can choose to not protect signals for performance (as example Node uses thread guards for protection, so these signals are not thread safe).
Issue conclusion: GraphNode port connections appear misaligned when switching between vertex and fragment modes, only realigning after zoom or layout refresh.
Investigation: The root cause was due to port positions being calculated before child layouts had finalized, resulting in inaccurate Y positions for ports. The original implementation relied on Control::position.y, which was not yet updated during the initial layout pass.
Explaination: This fix computes vertical offset using titlebar and stylebox sizes instead, ensuring port alignment is correct immediately after layout, without relying on zoom-triggered re-layouts.
Resolves: #105232
Add layout mode check to distinguish GraphEditor and ShaderGraphEditor
Fix port position calculation by distinguishing between GraphEditor and ShaderGraphEditor layouts.
Due to differences in layout flow and update timing (CPU vs GPU), ShaderGraphEditor requires manual vertical offset calculation, while standard GraphEditor can directly get the actual child positions after layout in run time.
This change adds a layout mode check (`is_using_resort_layout) to determine the appropriate method for computing port positions.
Fixed nits using cached values and removed redundant condition variable definition.
Add comment for the condition checking.