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

LibWeb: Treat unresolvable percentages as auto to resolve sizes in GFC

Fixes the bug that currently we always consider tracks with percentage
size as ones with "fixed" length even when available size is not
definite. With this change tracks with percentage size when available
size is not definite will be considered as "intrinsic" sized.
This commit is contained in:
Aliaksandr Kalenik 2023-05-28 19:31:26 +03:00 committed by Andreas Kling
parent 30feb95d53
commit 537256fae2
6 changed files with 73 additions and 58 deletions

View file

@ -8,6 +8,7 @@
#include <AK/Vector.h>
#include <LibWeb/CSS/PercentageOr.h>
#include <LibWeb/Layout/AvailableSpace.h>
namespace Web::CSS {
@ -30,8 +31,8 @@ public:
Type type() const { return m_type; }
bool is_auto() const { return m_type == Type::LengthPercentage && m_length_percentage.is_auto(); }
bool is_length_percentage() const { return m_type == Type::LengthPercentage; }
bool is_auto(Layout::AvailableSize const&) const;
bool is_fixed(Layout::AvailableSize const&) const;
bool is_flexible_length() const { return m_type == Type::FlexibleLength; }
bool is_max_content() const { return m_type == Type::MaxContent; }
bool is_min_content() const { return m_type == Type::MinContent; }
@ -42,10 +43,7 @@ public:
// https://www.w3.org/TR/css-grid-2/#layout-algorithm
// An intrinsic sizing function (min-content, max-content, auto, fit-content()).
// FIXME: Add missing properties once implemented.
bool is_intrinsic_track_sizing() const
{
return is_auto() || is_max_content() || is_min_content();
}
bool is_intrinsic(Layout::AvailableSize const&) const;
bool is_definite() const
{