1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:47:35 +00:00

LibWeb: Call prepare_for_replaced_layout() on replaced boxes in GFC

We need to call prepare_for_replaced_layout() on grid items to populate
their natural sizes and aspect ration.
This commit is contained in:
Aliaksandr Kalenik 2023-10-31 06:38:07 +01:00 committed by Andreas Kling
parent a559dca816
commit 549dee4db1
3 changed files with 28 additions and 0 deletions

View file

@ -8,6 +8,7 @@
#include <LibWeb/DOM/Node.h>
#include <LibWeb/Layout/Box.h>
#include <LibWeb/Layout/GridFormattingContext.h>
#include <LibWeb/Layout/ReplacedBox.h>
namespace Web::Layout {
@ -1845,6 +1846,12 @@ void GridFormattingContext::run(Box const& box, LayoutMode, AvailableSpace const
box_state.set_indefinite_content_width();
if (!computed_values.height().is_length())
box_state.set_indefinite_content_height();
if (item.box->is_replaced_box()) {
auto& replaced_box = static_cast<Layout::ReplacedBox const&>(*item.box);
// FIXME: This const_cast is gross.
const_cast<Layout::ReplacedBox&>(replaced_box).prepare_for_replaced_layout();
}
}
// Do the first pass of resolving grid items box metrics to compute values that are independent of a track width