Skip to content

[css-inline-3] leading-trim through to descendant line boxes #5237

@fantasai

Description

@fantasai

The current definition of leading-trim relies on the concept of “first formatted line”. This was done for two reasons:

  • it drills down through unstyled block boxes, which is helpful to the author and absolutely necessary given the way we generate anonymous block boxes
  • it correctly aborts on nested formatting contexts, replaced elements, etc.

However, it might be a bit too aggressive, as it also drills through styled block boxes. Consider

  <section style="leading-trim: start">
     <div class="warning" style="border: solid 10px; padding: 0.2em">...</div>
     <p>Whatever normal paragraph.</p>
  </section>

The .warning would probably be a bit surprised if the section trimmed its half-leading when it didn't request such trimming itself.

I think we might want to borrow the logic from margin collapsing, and not drill into boxes with non-zero padding/border. Whether or not the margins could have collapsed seems closely related to whether or not this block’s own content edge is adjacent to its descendant's first/last line box and therefore whether it should be controlling the leading on that line.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions