LibWeb: Only consider main size for item height in intrinsic sizing

We did not actually check whether we are in intrinsic sizing mode, and
should actually use the available space in all other cases. This will
allow for proper determination of the hypothetical cross size in the
next commit.
This commit is contained in:
Jelle Raaijmakers 2025-11-04 16:10:16 +01:00 committed by Jelle Raaijmakers
parent f9b4fa9702
commit 4ff17fc8d7
Notes: github-actions[bot] 2025-11-05 11:02:48 +00:00

View file

@ -1,6 +1,7 @@
/*
* Copyright (c) 2021-2025, Andreas Kling <andreas@ladybird.org>
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -22,9 +23,9 @@ CSSPixels FlexFormattingContext::get_pixel_width(FlexItem const& item, CSS::Size
CSSPixels FlexFormattingContext::get_pixel_height(FlexItem const& item, CSS::Size const& size) const
{
if (is_row_layout()) {
// NOTE: In a row layout, after we've determined the main size, we use that as the available width
// for any intrinsic sizing layout needed to resolve the height.
if (is_row_layout() && size.is_intrinsic_sizing_constraint()) {
// NOTE: In a row layout, after we've determined the main size, we use that as the available width for any
// intrinsic sizing layout needed to resolve the height.
auto available_width = item.main_size.has_value() ? AvailableSize::make_definite(item.main_size.value()) : AvailableSize::make_indefinite();
auto available_height = AvailableSize::make_indefinite();
auto available_space = AvailableSpace { available_width, available_height };