mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:48:12 +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:
parent
30feb95d53
commit
537256fae2
6 changed files with 73 additions and 58 deletions
|
@ -36,6 +36,33 @@ GridSize::GridSize()
|
|||
|
||||
GridSize::~GridSize() = default;
|
||||
|
||||
bool GridSize::is_auto(Layout::AvailableSize const& available_size) const
|
||||
{
|
||||
if (m_type == Type::LengthPercentage) {
|
||||
if (m_length_percentage.is_percentage())
|
||||
return !available_size.is_definite();
|
||||
return m_length_percentage.is_auto();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GridSize::is_fixed(Layout::AvailableSize const& available_size) const
|
||||
{
|
||||
if (m_type == Type::LengthPercentage) {
|
||||
if (m_length_percentage.is_percentage())
|
||||
return available_size.is_definite();
|
||||
return !m_length_percentage.is_auto();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GridSize::is_intrinsic(Layout::AvailableSize const& available_size) const
|
||||
{
|
||||
return is_auto(available_size) || is_max_content() || is_min_content();
|
||||
}
|
||||
|
||||
GridSize GridSize::make_auto()
|
||||
{
|
||||
return GridSize(CSS::Length::make_auto());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue