-
Notifications
You must be signed in to change notification settings - Fork 735
Closed
Labels
Milestone
Description
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.