1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 18:15:07 +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

@ -167,7 +167,7 @@ void Frame::scroll_to_anchor(const String& fragment)
Gfx::FloatRect float_rect { layout_node.box_type_agnostic_position(), { (float)viewport_rect().width(), (float)viewport_rect().height() } };
if (is<Layout::Box>(layout_node)) {
auto& layout_box = downcast<Layout::Box>(layout_node);
auto padding_box = layout_box.box_model().padding_box(layout_box);
auto padding_box = layout_box.box_model().padding_box();
float_rect.move_by(-padding_box.left, -padding_box.top);
}