-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement "root" layout mode #530
Comments
Hmm.... so investigating this, it looks like web more or less treats the viewport as a Perhaps we can eventually make the viewport behaviour configurable through something like the following enum (as a tree-wide config setting): enum ViewportLayoutBehaviour {
BlockLike,
GridLike,
FlexLike, // Do we even need this? Not sure what it would be useful for.
} Where |
@nicoburns (Assuming I've understood the discussion here), I think a FlexLike root might be of interest to React Native users implementing a new virtualised ListView. Each cell in the list could be effectively a new root/viewport, and – as Flexbox layout is the default in React Native – it'd be the appropriate display mode there. |
This is quite a critical blocker for layout systems that try to behave like browsers. Taffy right now requires you to wrap the actual root node with another dummy root node in order for things like margin to work. That wouldn't be a big issue but the way block layout & its margin collapsing works makes recreating browser layouts impossible. |
What problem does this solve or what need does it fill?
There are some styles that can only or are best applied by the parent of a node. These include:
position
(notablyposition: absolute
)top
/bottom
/left
/right
margin
And perhaps:
width
/height
/max_width
/max_height
/min_width
/min_height
aspect_ratio
Currently these are either not applied to root nodes, or are applied in a duplicated manner within the node's algorithm itself.
What solution would you like?
Much like we have a dedicated simple algorithm for leaf nodes, we ought to create one for root nodes which is applied to the top-level node in any call to
compute_layout
.Additional context
<html>
node to have styles likeposition
/top
/left
/margin
, etc applied. And it seems like a useful thing to allow, so I think we ought to the same.position: fixed
nodes which layout in a very similar way to the root node.The text was updated successfully, but these errors were encountered: