Skip to content

Implement "root" layout mode #530

@nicoburns

Description

@nicoburns

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 (notably position: absolute)
  • top/bottom/left/right
  • margin

And perhaps:

  • 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

  • I've tested this on web, and browsers allow the root <html> node to have styles like position/top/left/margin, etc applied. And it seems like a useful thing to allow, so I think we ought to the same.
  • This layout mode could probably be reused for layout of position: fixed nodes which layout in a very similar way to the root node.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions