1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 13:27:34 +00:00

LibWeb: Add border box top/bottom metrics to line box fragments

This will allow us to support more kinds of vertical alignment.
This commit is contained in:
Andreas Kling 2022-02-26 09:24:40 +01:00
parent 8b369bf7bd
commit 797f51e122
6 changed files with 22 additions and 10 deletions

View file

@ -219,8 +219,12 @@ float FormattingContext::compute_auto_height_for_block_level_element(FormattingS
top = 0;
if (!line_boxes.is_empty()) {
for (auto& fragment : line_boxes.last().fragments()) {
if (!bottom.has_value() || (fragment.offset().y() + fragment.height()) > bottom.value())
bottom = fragment.offset().y() + fragment.height();
float fragment_top = fragment.offset().y() - fragment.border_box_top();
if (!top.has_value() || fragment_top < *top)
top = fragment_top;
float fragment_bottom = fragment.offset().y() + fragment.height() + fragment.border_box_bottom();
if (!bottom.has_value() || fragment_bottom > *bottom)
bottom = fragment_bottom;
}
}
} else {