mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-02 22:55:23 +00:00
LibWeb: Make absolutized_length() helper a Length method
There were a mix of users between those who want to know if the Length changed, and those that just want an absolute Length. So, we now have two methods: Length::absolutize() returns an empty Optional if nothing changed, and Length::absolutized() always returns a value.
This commit is contained in:
committed by
Andreas Kling
parent
7d29262b8b
commit
16e3a86393
@@ -32,7 +32,7 @@ ValueComparingNonnullRefPtr<LengthStyleValue> LengthStyleValue::create(Length co
|
||||
|
||||
ValueComparingNonnullRefPtr<StyleValue const> LengthStyleValue::absolutized(CSSPixelRect const& viewport_rect, Gfx::FontPixelMetrics const& font_metrics, CSSPixels font_size, CSSPixels root_font_size, CSSPixels line_height, CSSPixels root_line_height) const
|
||||
{
|
||||
if (auto length = absolutized_length(m_length, viewport_rect, font_metrics, font_size, root_font_size, line_height, root_line_height); length.has_value())
|
||||
if (auto length = m_length.absolutize(viewport_rect, font_metrics, font_size, root_font_size, line_height, root_line_height); length.has_value())
|
||||
return LengthStyleValue::create(length.release_value());
|
||||
return *this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user