mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 14:45:07 +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:
parent
66e9dde86f
commit
2b8c7faee4
3 changed files with 35 additions and 2 deletions
|
@ -58,6 +58,22 @@ public:
|
|||
return width() + border_box.left + border_box.right;
|
||||
}
|
||||
|
||||
Gfx::FloatRect content_box_as_relative_rect() const
|
||||
{
|
||||
return { m_offset, m_size };
|
||||
}
|
||||
|
||||
Gfx::FloatRect margin_box_as_relative_rect() const
|
||||
{
|
||||
auto rect = content_box_as_relative_rect();
|
||||
auto margin_box = box_model().margin_box(*this);
|
||||
rect.set_x(rect.x() - margin_box.left);
|
||||
rect.set_width(rect.width() + margin_box.left + margin_box.right);
|
||||
rect.set_y(rect.y() - margin_box.top);
|
||||
rect.set_height(rect.height() + margin_box.top + margin_box.bottom);
|
||||
return rect;
|
||||
}
|
||||
|
||||
float absolute_x() const { return absolute_rect().x(); }
|
||||
float absolute_y() const { return absolute_rect().y(); }
|
||||
Gfx::FloatPoint absolute_position() const { return absolute_rect().location(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue