Skip to content
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

Let containing blocks layout their absolute descendants, not parents #41488

Closed
wants to merge 2 commits into from

Commits on Dec 4, 2023

  1. Insets no longer apply to statically positioned nodes (facebook#41369)

    Summary:
    X-link: facebook/yoga#1454
    
    
    One of the most basic aspects of statically positioned nodes is that [insets do not apply to them](https://developer.mozilla.org/en-US/docs/Web/CSS/position#static). So I put a guard inside `Node::relativePosition` where we take that into account when setting the position.
    
    Reviewed By: NickGerleman
    
    Differential Revision: D50507808
    Joe Vilches authored and facebook-github-bot committed Dec 4, 2023
    Configuration menu
    Copy the full SHA
    9f9193a View commit details
    Browse the repository at this point in the history
  2. Let containing blocks layout their absolute descendants, not parents (f…

    …acebook#41488)
    
    Summary:
    
    X-link: facebook/yoga#1470
    
    The way we plan on implementing `position: static` is by changing how we lay out absolutely positioned nodes. Instead of letting their direct parent lay them out we are going to let their containing block handle it. This is useful because by the time the containing block gets to this step it will already know its size, which is needed to ensure that absolute nodes can get the right value with percentage units. Additionally, it means that we can "translate" the position of the absolute nodes to be relative to their parent fairly easily, instead of some second pass that would not be possible with a different design.
    
    This change just gets the core pieces of this process going. It makes it so that containing blocks will layout out absolute descendants that they contain. We also pass in the containing block size to the owner size args for `layoutAbsoluteChild`. This new path will only happen if we have the errata turned off. If there is no positioned ancestor for a given node we just assume the root is. This is not exactly how it works on the web - there is a notion of an initial containing block - but we are not implementing that as of right now.
    
    Reviewed By: NickGerleman
    
    Differential Revision: D51182593
    Joe Vilches authored and facebook-github-bot committed Dec 4, 2023
    Configuration menu
    Copy the full SHA
    8509cbc View commit details
    Browse the repository at this point in the history