mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:57:45 +00:00
LibWeb: Include custom properties in CSS dump
This commit is contained in:
parent
c268d0fa13
commit
1d5d27aa22
2 changed files with 10 additions and 1 deletions
|
@ -65,6 +65,7 @@ public:
|
||||||
virtual bool set_property(PropertyID, StringView css_text) override;
|
virtual bool set_property(PropertyID, StringView css_text) override;
|
||||||
|
|
||||||
const Vector<StyleProperty>& properties() const { return m_properties; }
|
const Vector<StyleProperty>& properties() const { return m_properties; }
|
||||||
|
const HashMap<String, StyleProperty>& custom_properties() const { return m_custom_properties; }
|
||||||
Optional<StyleProperty> custom_property(const String& custom_property_name) const { return m_custom_properties.get(custom_property_name); }
|
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(); }
|
size_t custom_property_count() const { return m_custom_properties.size(); }
|
||||||
|
|
||||||
|
|
|
@ -558,13 +558,21 @@ void dump_style_rule(StringBuilder& builder, CSS::CSSStyleRule const& rule, int
|
||||||
}
|
}
|
||||||
indent(builder, indent_levels);
|
indent(builder, indent_levels);
|
||||||
builder.append(" Declarations:\n");
|
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);
|
indent(builder, indent_levels);
|
||||||
builder.appendff(" {}: '{}'", CSS::string_from_property_id(property.property_id), property.value->to_string());
|
builder.appendff(" {}: '{}'", CSS::string_from_property_id(property.property_id), property.value->to_string());
|
||||||
if (property.important)
|
if (property.important)
|
||||||
builder.append(" \033[31;1m!important\033[0m");
|
builder.append(" \033[31;1m!important\033[0m");
|
||||||
builder.append('\n');
|
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)
|
void dump_sheet(CSS::StyleSheet const& sheet)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue