mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-16 21:20:18 +00:00
LibWeb/CSS: Prepare Size for use in GridSize
Make it constructible from a LengthPercentage, report whether it contains a length-percentage, and add an equality operator.
This commit is contained in:
parent
d3e04c96d9
commit
ad5f7c56c1
Notes:
github-actions[bot]
2025-09-04 12:34:27 +00:00
Author: https://github.com/AtkinsSJ
Commit: ad5f7c56c1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6043
2 changed files with 16 additions and 0 deletions
|
@ -44,6 +44,18 @@ Size Size::make_calculated(NonnullRefPtr<CalculatedStyleValue const> calculated)
|
|||
return Size { Type::Calculated, move(calculated) };
|
||||
}
|
||||
|
||||
Size Size::make_length_percentage(LengthPercentage const& length_percentage)
|
||||
{
|
||||
if (length_percentage.is_auto())
|
||||
return make_auto();
|
||||
if (length_percentage.is_length())
|
||||
return make_length(length_percentage.length());
|
||||
if (length_percentage.is_percentage())
|
||||
return make_percentage(length_percentage.percentage());
|
||||
VERIFY(length_percentage.is_calculated());
|
||||
return make_calculated(length_percentage.calculated());
|
||||
}
|
||||
|
||||
Size Size::make_min_content()
|
||||
{
|
||||
return Size { Type::MinContent, Length::make_auto() };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue