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

@ -113,7 +113,7 @@ Optional<DescriptorID> descriptor_id_from_string(AtRuleID, StringView);
FlyString to_string(DescriptorID);
bool at_rule_supports_descriptor(AtRuleID, DescriptorID);
RefPtr<CSSStyleValue const> descriptor_initial_value(AtRuleID, DescriptorID);
RefPtr<StyleValue const> descriptor_initial_value(AtRuleID, DescriptorID);
struct DescriptorMetadata {
enum class ValueType {
@ -150,7 +150,7 @@ ErrorOr<void> generate_implementation_file(JsonObject const& at_rules_data, Core
generator.append(R"~~~(
#include <LibWeb/CSS/DescriptorID.h>
#include <LibWeb/CSS/CSSStyleValue.h>
#include <LibWeb/CSS/StyleValues/StyleValue.h>
#include <LibWeb/CSS/Parser/Parser.h>
namespace Web::CSS {
@ -276,12 +276,12 @@ bool at_rule_supports_descriptor(AtRuleID at_rule_id, DescriptorID descriptor_id
}
RefPtr<CSSStyleValue const> descriptor_initial_value(AtRuleID at_rule_id, DescriptorID descriptor_id)
RefPtr<StyleValue const> descriptor_initial_value(AtRuleID at_rule_id, DescriptorID descriptor_id)
{
if (!at_rule_supports_descriptor(at_rule_id, descriptor_id))
return nullptr;
static Array<Array<RefPtr<CSSStyleValue const>, @descriptor_count@>, @at_rule_count@> initial_values;
static Array<Array<RefPtr<StyleValue const>, @descriptor_count@>, @at_rule_count@> initial_values;
if (auto initial_value = initial_values[to_underlying(at_rule_id)][to_underlying(descriptor_id)])
return initial_value.release_nonnull();