LibWeb: Fix crashing when grid track size is calc() with percentage

Use contains_percentage() that works for calc() values instead of
is_percentage().

This fixes issue when tracks with calc() that has percentages where
considered as "fixed" tracks with resolvable size which led to
incorrectly resolved infinite final track sizes.
This commit is contained in:
Aliaksandr Kalenik 2023-06-02 18:31:39 +03:00 committed by Andreas Kling
commit 2ade229f27
Notes: sideshowbarker 2024-07-17 06:09:44 +09:00
3 changed files with 25 additions and 2 deletions

View file

@ -39,7 +39,7 @@ GridSize::~GridSize() = default;
bool GridSize::is_auto(Layout::AvailableSize const& available_size) const
{
if (m_type == Type::LengthPercentage) {
if (m_length_percentage.is_percentage())
if (m_length_percentage.contains_percentage())
return !available_size.is_definite();
return m_length_percentage.is_auto();
}
@ -50,7 +50,7 @@ bool GridSize::is_auto(Layout::AvailableSize const& available_size) const
bool GridSize::is_fixed(Layout::AvailableSize const& available_size) const
{
if (m_type == Type::LengthPercentage) {
if (m_length_percentage.is_percentage())
if (m_length_percentage.contains_percentage())
return available_size.is_definite();
return !m_length_percentage.is_auto();
}