LibWeb/Layout: Don't inject natural size in prepare_for_replaced_layout

Instead, compute them on demand. This affects ReplacedBox and its
subclasses.

This commit is centered around a new Box::auto_content_box_size
method. It returns a SizeWithAspectRatio representing the natural
size of a replaced element, or the size derived from attributes
for text input and textarea. These values are used when the
corresponding axis is auto or indefinite.

Although introducing this API choke-point for sizing replaced and
replaced-like elements was the main goal, it's notable that layout
becomes more robust in the face of dynamic changes due to reduced
potential for stale size values (at the cost of extra calculations
and allocations).
This commit is contained in:
Jonathan Gamble
2026-01-11 00:31:07 -06:00
committed by Sam Atkins
parent b8ee6ec476
commit ec50525675
Notes: github-actions[bot] 2026-02-06 10:41:24 +00:00
32 changed files with 293 additions and 190 deletions

View File

@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
1 Fail
Fail .flexbox 1
1 Pass
Pass .flexbox 1