Skip to content

Round out-of-flow boxes inside display: none subtrees - #1378

Open
AI-Dico wants to merge 1 commit into
DioxusLabs:mainfrom
AI-Dico:fix/round-hidden-out-of-flow
Open

AI-Dico wants to merge 1 commit into
DioxusLabs:mainfrom
AI-Dico:fix/round-hidden-out-of-flow

Conversation

@AI-Dico

@AI-Dico AI-Dico commented Oct 30, 2026

Copy link
Copy Markdown

Fixes #1357

round_layout reaches out-of-flow boxes only through their containing block's hoisted child list, and skips them in the normal child walk. Hidden layout builds no hoisted lists, so an absolute/fixed box inside a display: none subtree (and everything under it) was never visited. Its final layout kept whatever it had in the last visible pass. #1356 worked around this for TaffyTree only.

This takes option 2 from the issue:

  • New RoundTree::is_hidden(node_id). round_layout propagates the hidden state down, and inside a hidden subtree it visits every child through the normal child list (out-of-flow ones included) and doesn't follow hoisted lists.
  • TaffyView implements it with Display::None, so the TaffyTree: reset the rounded layout of out-of-flow boxes in hidden subtrees #1356 workaround in the PerformHiddenLayout branch is no longer needed and is removed. Every final_layout read in TaffyTree is behind use_rounding, and with rounding on round_layout now reaches every hidden descendant.
  • The two custom-tree examples implement is_hidden, and their is_out_of_flow now returns false for display: none nodes. That is what the is_out_of_flow docs already require, and TaffyView already did it; without it, a hidden position: absolute child of a visible parent would never be visited.

is_hidden has a default implementation returning false, so existing RoundTree implementors keep compiling, and keep the old behaviour until they override it (the docs say they should). If you'd rather make it required for 0.16, that's a one-line change.

Relation to #1354: hidden subtrees no longer read hoisted lists at all, so this neither depends on nor conflicts with clearing them on the hidden path. Stale lists on visible leaves are still #1354's problem.

Tests (tests/hand_written/rounding.rs): a custom low-level tree checks absolute/fixed descendants under static/relative/absolute hidden ancestors, with root and non-root hiding, nested out-of-flow boxes and in-flow leaves (failed on main: the hidden box kept location (1, 1) and size (10, 10)); a visible control checks that each node is still visited once with unchanged rounding. Full cargo test passes (7005 tests), clippy and fmt are clean.

round_layout reaches out-of-flow boxes only through their containing
block's hoisted child list, but hidden layout builds no hoisted lists, so an
absolute/fixed box inside a display: none subtree was never visited and kept
its final layout from an earlier visible pass.

Add RoundTree::is_hidden (defaults to false for source compatibility) and,
inside hidden subtrees, visit every child through the normal child list.
TaffyView implements it, which replaces the TaffyTree-only workaround from
DioxusLabs#1356.

Fixes DioxusLabs#1357

This branch has not been deployed

No deployments
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.

round_layout never visits out-of-flow boxes inside display: none subtrees

1 participant