1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 03:34:58 +00:00

LibWeb: Use the margin box of floating elements for flowing around

Inline content flows around the entire margin box of floating elements,
not just the content box.
This commit is contained in:
Andreas Kling 2020-12-12 19:58:23 +01:00
parent 66e9dde86f
commit 2b8c7faee4
3 changed files with 35 additions and 2 deletions

View file

@ -62,7 +62,7 @@ static AvailableSpaceForLineInfo available_space_for_line(const InlineFormatting
for (ssize_t i = bfc.left_floating_boxes().size() - 1; i >= 0; --i) {
auto& floating_box = *bfc.left_floating_boxes().at(i);
Gfx::FloatRect rect { floating_box.effective_offset(), floating_box.size() };
auto rect = floating_box.margin_box_as_relative_rect();
if (rect.contains_vertically(y)) {
info.left = rect.right() + 1;
break;
@ -73,7 +73,7 @@ static AvailableSpaceForLineInfo available_space_for_line(const InlineFormatting
for (ssize_t i = bfc.right_floating_boxes().size() - 1; i >= 0; --i) {
auto& floating_box = *bfc.right_floating_boxes().at(i);
Gfx::FloatRect rect { floating_box.effective_offset(), floating_box.size() };
auto rect = floating_box.margin_box_as_relative_rect();
if (rect.contains_vertically(y)) {
info.right = rect.left() - 1;
break;