1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:57:45 +00:00

LibWeb: Allocate CSS::ComputedValues objects on the heap

This makes them cheap to move around, since we can store them in a
NonnullOwnPtr instead of memcopying 2584(!) bytes.

Drastically reduces the chance of stack overflow while building the
layout tree for deeply nested DOMs (since tree building was putting
these things on the stack).

This change also exposed a completely unnecessary ComputedValues deep
copy in block layout.
This commit is contained in:
Andreas Kling 2024-01-27 08:38:27 +01:00
parent d89e42902e
commit ad7e6878fe
11 changed files with 40 additions and 33 deletions

View file

@ -755,7 +755,7 @@ void BlockFormattingContext::layout_block_level_children(BlockContainer const& b
auto& block_container_state = m_state.get_mutable(block_container);
if (!block_container_state.has_definite_width()) {
auto width = greatest_child_width(block_container);
auto computed_values = block_container.computed_values();
auto const& computed_values = block_container.computed_values();
// NOTE: Min and max constraints are not applied to a box that is being sized as intrinsic because
// according to css-sizing-3 spec:
// The min-content size of a box in each axis is the size it would have if it was a float given an