mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
LibWeb: Add Layout::Box::border_box_as_relative_rect()
This helper returns the border box (content+padding+border) of a given box. Margin not included.
This commit is contained in:
parent
37f0bd0a42
commit
723ea4bcd7
1 changed files with 11 additions and 0 deletions
|
@ -88,6 +88,17 @@ public:
|
||||||
return { m_offset, m_size };
|
return { m_offset, m_size };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Gfx::FloatRect border_box_as_relative_rect() const
|
||||||
|
{
|
||||||
|
auto rect = content_box_as_relative_rect();
|
||||||
|
auto border_box = box_model().border_box();
|
||||||
|
rect.set_x(rect.x() - border_box.left);
|
||||||
|
rect.set_width(rect.width() + border_box.left + border_box.right);
|
||||||
|
rect.set_y(rect.y() - border_box.top);
|
||||||
|
rect.set_height(rect.height() + border_box.top + border_box.bottom);
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
Gfx::FloatRect margin_box_as_relative_rect() const
|
Gfx::FloatRect margin_box_as_relative_rect() const
|
||||||
{
|
{
|
||||||
auto rect = content_box_as_relative_rect();
|
auto rect = content_box_as_relative_rect();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue