1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:28:12 +00:00

LibWeb: Implement CSSRule and CSSStyleDeclaration serialization

There are a handful of FIXME's here, but this seems generally good.
Note that CSS *values* don't get serialized in a spec-compliant way
since we currently rely on StyleValue::to_string() which is ad-hoc.
This commit is contained in:
Andreas Kling 2021-10-01 19:57:45 +02:00
parent c953103d2f
commit 3db847c64a
14 changed files with 461 additions and 9 deletions

View file

@ -38,6 +38,11 @@ public:
String get_property_value(StringView property) const;
String css_text() const;
void set_css_text(StringView);
virtual String serialized() const = 0;
protected:
CSSStyleDeclaration() { }
};
@ -63,6 +68,8 @@ public:
Optional<StyleProperty> custom_property(const String& custom_property_name) const { return m_custom_properties.get(custom_property_name); }
size_t custom_property_count() const { return m_custom_properties.size(); }
virtual String serialized() const final override;
protected:
explicit PropertyOwningCSSStyleDeclaration(Vector<StyleProperty>, HashMap<String, StyleProperty>);