mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:47:34 +00:00
LibWeb: Fix floats y offset calculation
There is a difference in y offset position calculation for floats when LineBuilder provides final y position while for blocks it needs to be adjusted by `y_offset`. This difference already accounted in floating box position calculation and this patch also makes it accounted in check whether a floating boxes on the same line intersect between each other.
This commit is contained in:
parent
63cf9b973d
commit
56ceb6a106
1 changed files with 5 additions and 1 deletions
|
@ -773,7 +773,11 @@ void BlockFormattingContext::layout_floating_box(Box const& box, BlockContainer
|
||||||
|
|
||||||
if (fits_on_line) {
|
if (fits_on_line) {
|
||||||
auto const previous_rect = margin_box_rect_in_ancestor_coordinate_space(previous_box.box, root(), m_state);
|
auto const previous_rect = margin_box_rect_in_ancestor_coordinate_space(previous_box.box, root(), m_state);
|
||||||
if (previous_rect.contains_vertically(y_in_root + side_data.y_offset)) {
|
// NOTE: If we're in inline layout, the LineBuilder has already provided the right Y offset.
|
||||||
|
// In block layout, we adjust by the side's current Y offset here.
|
||||||
|
if (!line_builder)
|
||||||
|
y_in_root += side_data.y_offset;
|
||||||
|
if (previous_rect.contains_vertically(y_in_root)) {
|
||||||
// This box touches another already floating box. Stack after others.
|
// This box touches another already floating box. Stack after others.
|
||||||
offset_from_edge = wanted_offset_from_edge;
|
offset_from_edge = wanted_offset_from_edge;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue