LibWeb: Move and rename CSSStyleValue to StyleValues/StyleValue.{h,cpp}

This reverts 0e3487b9ab.

Back when I made that change, I thought we could make our StyleValue
classes match the typed-om definitions directly. However, they have
different requirements. Typed-om types need to be mutable and GCed,
whereas StyleValues are immutable and ideally wouldn't require a JS VM.

While I was already making such a cataclysmic change, I've moved it into
the StyleValues directory, because it *not* being there has bothered me
for a long time. 😅
This commit is contained in:
Sam Atkins 2025-08-08 10:11:51 +01:00 committed by Tim Ledbetter
commit c57975c9fd
Notes: github-actions[bot] 2025-08-08 14:20:54 +00:00
167 changed files with 989 additions and 990 deletions

View file

@ -24,7 +24,7 @@ String ShadowStyleValue::to_string(SerializationMode mode) const
builder.append(' ');
builder.appendff("{} {}", m_properties.offset_x->to_string(mode), m_properties.offset_y->to_string(mode));
auto append_value = [&](ValueComparingRefPtr<CSSStyleValue const> const& value) {
auto append_value = [&](ValueComparingRefPtr<StyleValue const> const& value) {
if (!value)
return;
if (!builder.is_empty())
@ -39,28 +39,28 @@ String ShadowStyleValue::to_string(SerializationMode mode) const
return MUST(builder.to_string());
}
ValueComparingNonnullRefPtr<CSSStyleValue const> ShadowStyleValue::color() const
ValueComparingNonnullRefPtr<StyleValue const> ShadowStyleValue::color() const
{
if (!m_properties.color)
return CSSKeywordValue::create(Keyword::Currentcolor);
return *m_properties.color;
}
ValueComparingNonnullRefPtr<CSSStyleValue const> ShadowStyleValue::blur_radius() const
ValueComparingNonnullRefPtr<StyleValue const> ShadowStyleValue::blur_radius() const
{
if (!m_properties.blur_radius)
return LengthStyleValue::create(Length::make_px(0));
return *m_properties.blur_radius;
}
ValueComparingNonnullRefPtr<CSSStyleValue const> ShadowStyleValue::spread_distance() const
ValueComparingNonnullRefPtr<StyleValue const> ShadowStyleValue::spread_distance() const
{
if (!m_properties.spread_distance)
return LengthStyleValue::create(Length::make_px(0));
return *m_properties.spread_distance;
}
ValueComparingNonnullRefPtr<CSSStyleValue const> ShadowStyleValue::absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const
ValueComparingNonnullRefPtr<StyleValue const> ShadowStyleValue::absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const
{
auto absolutized_offset_x = offset_x()->absolutized(viewport_rect, font_metrics, root_font_metrics);
auto absolutized_offset_y = offset_y()->absolutized(viewport_rect, font_metrics, root_font_metrics);