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

LibWeb: Store layout box model metrics as floats

Instead of storing them as CSS::Lengths, we now store the resolved
values for margin/padding/border/offset top/right/bottom/left with
each Layout::NodeWithStyleAndBoxModelMetrics.

This simplifies a lot of code since it's no longer necessary to
resolve values before using them.
This commit is contained in:
Andreas Kling 2020-12-12 21:02:06 +01:00
parent 1042762deb
commit 9d442ba606
7 changed files with 132 additions and 134 deletions

View file

@ -54,7 +54,7 @@ public:
float border_box_width() const
{
auto border_box = box_model().border_box(*this);
auto border_box = box_model().border_box();
return width() + border_box.left + border_box.right;
}
@ -66,7 +66,7 @@ public:
Gfx::FloatRect margin_box_as_relative_rect() const
{
auto rect = content_box_as_relative_rect();
auto margin_box = box_model().margin_box(*this);
auto margin_box = box_model().margin_box();
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);