Repository navigation
Improve transform tracking. - #1811
Conversation
|
I'm not certain about this PR. It seems to add complexity (you now have to remember the difference between Could we instead use something like xilem/xilem_masonry/src/view/prop.rs Line 61 in 19c3360 and remove |
|
Yes, it's significant complexity cost for a minor Xilem quirk. I created #1820 which moves the tracking to Xilem and would allow us to greatly reduce the complexity of Masonry's tracking. |
|
Should we close this, then? |
fab2ab8 to
8dbf0b4
Compare
f262be0 to
e6d5e15
Compare
|
No, this PR is still valid. It is now simplified and no longer splits the transform dirty tracking. |
| assert!( | ||
| !records.iter().any(|record| matches!( | ||
| record, | ||
| Record::PointerEvent(_) | Record::Update(Update::HoveredChanged(true)) | ||
| )), | ||
| "pointer should not reach the child before scroll translation" | ||
| ); |
There was a problem hiding this comment.
Seems like assert_all would give more info in case of an error.
There was a problem hiding this comment.
Perhaps, but it requires a new dependency, right? Doesn't seem important enough to add a whole new dep.
There was a problem hiding this comment.
No, I mean the helper function we define in masonry_testing.
The old
transform_changedwas busted. It was internally documented as trackingtransformandscroll_translation, but in practice it was also trackingorigin, but then exposed inMutateCtx::transform_has_changedwith the claim that it only trackstransform-- and then Xilem was using it with that assumption.This PR cleans that up by removing
MutateCtx::transform_has_changedand properly documentingtransform_changedas tracking everything which affects the full transform that the compose pass calculates. Currently that istransform,scroll_translation, andorigin.What's more, the
transform_changedflag isn't even merged up the tree, yet the compose pass checks it to decide whether to traverse into a branch. Thus, the compose pass was implicitly depending on unrelated code paths to set theneeds_composeflag.This PR sets the
needs_composeflag explicitly, to ensure things remain working even when that flag isn't being set elsewhere.The composing logic was duplicated in both the compose and accessibility passes. Yet it is critical for correct accessibility behavior for that to stay in sync with the compose results.
This PR introduces
WidgetState::compose_local_transformas a helper method, which will calculate the correct local transform. This will help this logic stay in sync. This is especially relevant as the logic gets more fragile, i.e. with the pixel snapping of #1803.Finally, this PR adds a new test which makes sure that scroll translation doesn't trigger a layout, is respected by hit testing, and that the regular and accessibility bounds are the same.