mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-28 21:26:22 +00:00
LibWeb: Add method to absolutize CalculatedOr
This commit is contained in:
parent
0df9c225aa
commit
c8bd58c0ba
Notes:
github-actions[bot]
2025-08-06 16:46:01 +00:00
Author: https://github.com/Calme1709
Commit: c8bd58c0ba
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5699
Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 14 additions and 0 deletions
|
@ -78,6 +78,20 @@ public:
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Self absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const
|
||||||
|
{
|
||||||
|
return m_value.visit(
|
||||||
|
[&](T const& value) {
|
||||||
|
if constexpr (IsSame<T, Length>)
|
||||||
|
return Self { value.absolutized(viewport_rect, font_metrics, root_font_metrics) };
|
||||||
|
else
|
||||||
|
return *static_cast<Self const*>(this);
|
||||||
|
},
|
||||||
|
[&](NonnullRefPtr<CalculatedStyleValue const> const& value) {
|
||||||
|
return Self { value->absolutized(viewport_rect, font_metrics, root_font_metrics)->as_calculated() };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
bool operator==(CalculatedOr<Self, T> const& other) const
|
bool operator==(CalculatedOr<Self, T> const& other) const
|
||||||
{
|
{
|
||||||
if (is_calculated() || other.is_calculated())
|
if (is_calculated() || other.is_calculated())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue