1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:08:10 +00:00

LibWeb: When collapsing margins, consider border box heights

Empty boxes should be fully collapsed, but a box with border and/or
padding is not empty.

This fixes an issue where <hr> elements were getting weirdly collapsed
since they have zero content height (but some border height.)
This commit is contained in:
Andreas Kling 2021-01-02 03:46:26 +01:00
parent 5116b94114
commit bf3772362a
2 changed files with 7 additions and 1 deletions

View file

@ -58,6 +58,12 @@ public:
return width() + border_box.left + border_box.right;
}
float border_box_height() const
{
auto border_box = box_model().border_box();
return height() + border_box.top + border_box.bottom;
}
Gfx::FloatRect content_box_as_relative_rect() const
{
return { m_offset, m_size };