1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:37:44 +00:00

LibWeb: Include custom properties in CSS dump

This commit is contained in:
Sam Atkins 2021-11-30 16:23:35 +00:00 committed by Andreas Kling
parent c268d0fa13
commit 1d5d27aa22
2 changed files with 10 additions and 1 deletions

View file

@ -558,13 +558,21 @@ void dump_style_rule(StringBuilder& builder, CSS::CSSStyleRule const& rule, int
}
indent(builder, indent_levels);
builder.append(" Declarations:\n");
for (auto& property : verify_cast<CSS::PropertyOwningCSSStyleDeclaration>(rule.declaration()).properties()) {
auto& style_declaration = verify_cast<CSS::PropertyOwningCSSStyleDeclaration>(rule.declaration());
for (auto& property : style_declaration.properties()) {
indent(builder, indent_levels);
builder.appendff(" {}: '{}'", CSS::string_from_property_id(property.property_id), property.value->to_string());
if (property.important)
builder.append(" \033[31;1m!important\033[0m");
builder.append('\n');
}
for (auto& property : style_declaration.custom_properties()) {
indent(builder, indent_levels);
builder.appendff(" {}: '{}'", property.key, property.value.value->to_string());
if (property.value.important)
builder.append(" \033[31;1m!important\033[0m");
builder.append('\n');
}
}
void dump_sheet(CSS::StyleSheet const& sheet)