Repository navigation
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1357
round_layoutreaches 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 adisplay: nonesubtree (and everything under it) was never visited. Its final layout kept whatever it had in the last visible pass. #1356 worked around this forTaffyTreeonly.This takes option 2 from the issue:
RoundTree::is_hidden(node_id).round_layoutpropagates 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.TaffyViewimplements it withDisplay::None, so the TaffyTree: reset the rounded layout of out-of-flow boxes in hidden subtrees #1356 workaround in thePerformHiddenLayoutbranch is no longer needed and is removed. Everyfinal_layoutread inTaffyTreeis behinduse_rounding, and with rounding onround_layoutnow reaches every hidden descendant.is_hidden, and theiris_out_of_flownow returnsfalsefordisplay: nonenodes. That is what theis_out_of_flowdocs already require, andTaffyViewalready did it; without it, a hiddenposition: absolutechild of a visible parent would never be visited.is_hiddenhas a default implementation returningfalse, so existingRoundTreeimplementors 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 onmain: 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. Fullcargo testpasses (7005 tests), clippy and fmt are clean.