Skip to content

Conversation

@AustinMReppert
Copy link

@AustinMReppert AustinMReppert commented Dec 23, 2025

Incremental Apply Layout

After computing taffy's layout, consumers must apply taffy's layout to their own tree. This is quite expensive when the tree is large. Only the taffy nodes that updated should be applied. This PR introduces a has_new_layout field that is updated when a Taffy node's set_unrounded_layout is called.

The names used were based on Yoga's Incremental Layout.

Notes:

  • The flag does not propagate down to children. Consumers may have to do some propagation.
  • This could be a feature.
  • This still requires users iterate over all nodes to apply the layout. Long term, it may make sense to provide a list of updated nodes or have some sort of layout event system.

Here is a demo of what the behavior looks like.
taffy-has-new-layout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant