1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

LibWeb: Store bottom edge location with each LineBox

Previously we were computing the bottom edge of a line box by finding
the bottommost fragment on the line.

That method didn't give correct results for line boxes with no fragments
(which is exactly what you get when inserting a bunch of <br> elements.)

To cover all situations, we now keep track of the bottommost edge in the
LineBox object itself.
This commit is contained in:
Andreas Kling 2022-02-27 13:34:34 +01:00
parent 4b6295e667
commit c6cf240f9a
4 changed files with 11 additions and 8 deletions

View file

@ -229,11 +229,12 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho
auto& line_box = block.line_boxes()[line_box_index];
for (size_t i = 0; i < indent; ++i)
builder.append(" ");
builder.appendff(" {}line {}{} width: {}\n",
builder.appendff(" {}line {}{} width: {}, bottom: {}\n",
line_box_color_on,
line_box_index,
color_off,
(int)line_box.width());
line_box.width(),
line_box.bottom());
for (size_t fragment_index = 0; fragment_index < line_box.fragments().size(); ++fragment_index) {
auto& fragment = line_box.fragments()[fragment_index];
for (size_t i = 0; i < indent; ++i)