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

LibWeb: Remove fallback value from Length::resolved()

Nobody makes undefined Lengths now, (although actually removing
Undefined will come in a later commit) so we can remove this parameter,
and `resolved_or_auto()`/`resolved_or_zero()`.
This commit is contained in:
Sam Atkins 2022-02-18 16:17:27 +00:00 committed by Andreas Kling
parent 5b2482a939
commit 67066c5140
11 changed files with 106 additions and 120 deletions

View file

@ -57,10 +57,8 @@ Length Length::percentage_of(Percentage const& percentage) const
return Length { percentage.as_fraction() * raw_value(), m_type };
}
Length Length::resolved(Length const& fallback_for_undefined, Layout::Node const& layout_node) const
Length Length::resolved(Layout::Node const& layout_node) const
{
if (is_undefined())
return fallback_for_undefined;
if (is_calculated())
return m_calculated_style->resolve_length(layout_node).release_value();
if (is_relative())
@ -68,16 +66,6 @@ Length Length::resolved(Length const& fallback_for_undefined, Layout::Node const
return *this;
}
Length Length::resolved_or_auto(Layout::Node const& layout_node) const
{
return resolved(make_auto(), layout_node);
}
Length Length::resolved_or_zero(Layout::Node const& layout_node) const
{
return resolved(make_px(0), layout_node);
}
float Length::relative_length_to_px(Gfx::IntRect const& viewport_rect, Gfx::FontMetrics const& font_metrics, float root_font_size) const
{
switch (m_type) {