mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:37:34 +00:00
LibWeb: Don't round fragment widths while accumulating in LineBuilder
By rounding the fragment widths, we sometimes inserted line breaks prematurely, even though the fragment *would* fit.
This commit is contained in:
parent
d64a8c3d2a
commit
e8a5233b94
1 changed files with 2 additions and 2 deletions
|
@ -103,7 +103,7 @@ float LineBuilder::y_for_float_to_be_inserted_here(Box const& box)
|
||||||
float current_line_width = ensure_last_line_box().width();
|
float current_line_width = ensure_last_line_box().width();
|
||||||
// If there's already inline content on the current line, check if the new float can fit
|
// If there's already inline content on the current line, check if the new float can fit
|
||||||
// alongside the content. If not, place it on the next line.
|
// alongside the content. If not, place it on the next line.
|
||||||
if (current_line_width > 0 && roundf(current_line_width + width) > m_available_width_for_current_line)
|
if (current_line_width > 0 && (current_line_width + width) > m_available_width_for_current_line)
|
||||||
candidate_y += m_context.containing_block().line_height();
|
candidate_y += m_context.containing_block().line_height();
|
||||||
|
|
||||||
// Then, look for the next Y position where we can fit the new float.
|
// Then, look for the next Y position where we can fit the new float.
|
||||||
|
@ -138,7 +138,7 @@ bool LineBuilder::should_break(float next_item_width)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto current_line_width = ensure_last_line_box().width();
|
auto current_line_width = ensure_last_line_box().width();
|
||||||
return roundf(current_line_width + next_item_width) > m_available_width_for_current_line;
|
return (current_line_width + next_item_width) > m_available_width_for_current_line;
|
||||||
}
|
}
|
||||||
|
|
||||||
static float box_baseline(LayoutState const& state, Box const& box)
|
static float box_baseline(LayoutState const& state, Box const& box)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue