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

@ -183,23 +183,23 @@ void dump_tree(StringBuilder& builder, const Layout::Node& layout_node, bool sho
if (show_box_model) {
// Dump the horizontal box properties
builder.appendf(" [%g+%g+%g %g %g+%g+%g]",
box.box_model().margin.left.to_px(box),
box.box_model().border.left.to_px(box),
box.box_model().padding.left.to_px(box),
box.box_model().margin.left,
box.box_model().border.left,
box.box_model().padding.left,
box.width(),
box.box_model().padding.right.to_px(box),
box.box_model().border.right.to_px(box),
box.box_model().margin.right.to_px(box));
box.box_model().padding.right,
box.box_model().border.right,
box.box_model().margin.right);
// And the vertical box properties
builder.appendf(" [%g+%g+%g %g %g+%g+%g]",
box.box_model().margin.top.to_px(box),
box.box_model().border.top.to_px(box),
box.box_model().padding.top.to_px(box),
box.box_model().margin.top,
box.box_model().border.top,
box.box_model().padding.top,
box.height(),
box.box_model().padding.bottom.to_px(box),
box.box_model().border.bottom.to_px(box),
box.box_model().margin.bottom.to_px(box));
box.box_model().padding.bottom,
box.box_model().border.bottom,
box.box_model().margin.bottom);
}
builder.append("\n");