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

@ -16,7 +16,7 @@ namespace Web::CSS {
Optional<Color> CSSRGB::to_color(ColorResolutionContext color_resolution_context) const
{
auto resolve_rgb_to_u8 = [&color_resolution_context](CSSStyleValue const& style_value) -> Optional<u8> {
auto resolve_rgb_to_u8 = [&color_resolution_context](StyleValue const& style_value) -> Optional<u8> {
// <number> | <percentage> | none
auto normalized = [](double number) {
if (isnan(number))
@ -54,7 +54,7 @@ Optional<Color> CSSRGB::to_color(ColorResolutionContext color_resolution_context
return 0;
};
auto resolve_alpha_to_u8 = [&color_resolution_context](CSSStyleValue const& style_value) -> Optional<u8> {
auto resolve_alpha_to_u8 = [&color_resolution_context](StyleValue const& style_value) -> Optional<u8> {
auto alpha_0_1 = resolve_alpha(style_value, color_resolution_context.calculation_resolution_context);
if (alpha_0_1.has_value())
return llround(clamp(alpha_0_1.value() * 255.0f, 0.0f, 255.0f));
@ -72,7 +72,7 @@ Optional<Color> CSSRGB::to_color(ColorResolutionContext color_resolution_context
return Color(r_val.value(), g_val.value(), b_val.value(), alpha_val.value());
}
bool CSSRGB::equals(CSSStyleValue const& other) const
bool CSSRGB::equals(StyleValue const& other) const
{
if (type() != other.type())
return false;