1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +00:00

LibWeb: Make CSSStyleDeclaration an abstract class

This patch moves the CSS property+value storage down to a new subclass
of CSSStyleDeclaration called PropertyOwningCSSStyleDeclaration.

The JavaScript wrapper for CSSStyleDeclaration now calls virtual
functions on the C++ object.

This is preparation for supporting computed style CSSStyleDeclaration
objects which won't have internal property storage, but rather an
internal element pointer. :^)
This commit is contained in:
Andreas Kling 2021-09-12 19:24:01 +02:00
parent 10679b6df2
commit 0bcab60463
9 changed files with 106 additions and 69 deletions

View file

@ -499,7 +499,7 @@ void dump_style_rule(StringBuilder& builder, CSS::CSSStyleRule const& rule)
dump_selector(builder, selector);
}
builder.append(" Declarations:\n");
for (auto& property : rule.declaration().properties()) {
for (auto& property : verify_cast<CSS::PropertyOwningCSSStyleDeclaration>(rule.declaration()).properties()) {
builder.appendff(" {}: '{}'\n", CSS::string_from_property_id(property.property_id), property.value->to_string());
}
}