mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-29 05:38:24 +00:00
LibWeb: Absolutize BackgroundSizeSVs in StyleComputer::absolutize_values
This commit is contained in:
parent
70cb8d23fb
commit
315f811d69
Notes:
github-actions[bot]
2025-08-06 16:45:47 +00:00
Author: https://github.com/Calme1709
Commit: 315f811d69
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5699
Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 13 additions and 1 deletions
|
@ -26,4 +26,15 @@ String BackgroundSizeStyleValue::to_string(SerializationMode mode) const
|
||||||
return MUST(String::formatted("{} {}", m_properties.size_x.to_string(mode), m_properties.size_y.to_string(mode)));
|
return MUST(String::formatted("{} {}", m_properties.size_x.to_string(mode), m_properties.size_y.to_string(mode)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ValueComparingNonnullRefPtr<CSSStyleValue const> BackgroundSizeStyleValue::absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const
|
||||||
|
{
|
||||||
|
auto absolutized_size_x = m_properties.size_x.absolutized(viewport_rect, font_metrics, root_font_metrics);
|
||||||
|
auto absolutized_size_y = m_properties.size_y.absolutized(viewport_rect, font_metrics, root_font_metrics);
|
||||||
|
|
||||||
|
if (absolutized_size_x == m_properties.size_x && absolutized_size_y == m_properties.size_y)
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
return BackgroundSizeStyleValue::create(absolutized_size_x, absolutized_size_y);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ public:
|
||||||
LengthPercentage size_y() const { return m_properties.size_y; }
|
LengthPercentage size_y() const { return m_properties.size_y; }
|
||||||
|
|
||||||
virtual String to_string(SerializationMode) const override;
|
virtual String to_string(SerializationMode) const override;
|
||||||
|
virtual ValueComparingNonnullRefPtr<CSSStyleValue const> absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const override;
|
||||||
|
|
||||||
bool properties_equal(BackgroundSizeStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(BackgroundSizeStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
calc(1em - 1px) calc(1em - 1px)
|
15px 15px
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue