1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:47:44 +00:00

LibWeb: Rough implementation of CSS namespace rule

This provides a rough implementation of the CSS @namespace rule.
Currently we just support default namespaces, namespace prefixes
are still to come.
This commit is contained in:
Jonah 2023-07-29 11:51:15 -05:00 committed by Sam Atkins
parent 3f7d97f098
commit 60e35f2a97
18 changed files with 266 additions and 3 deletions

View file

@ -679,6 +679,9 @@ ErrorOr<void> dump_rule(StringBuilder& builder, CSS::CSSRule const& rule, int in
case CSS::CSSRule::Type::Keyframe:
case CSS::CSSRule::Type::Keyframes:
break;
case CSS::CSSRule::Type::Namespace:
TRY(dump_namespace_rule(builder, verify_cast<CSS::CSSNamespaceRule const>(rule), indent_levels));
break;
}
return {};
}
@ -835,4 +838,14 @@ void dump_tree(StringBuilder& builder, Painting::Paintable const& paintable, boo
}
}
ErrorOr<void> dump_namespace_rule(StringBuilder& builder, CSS::CSSNamespaceRule const& namespace_, int indent_levels)
{
indent(builder, indent_levels);
TRY(builder.try_appendff(" Namespace: {}\n", namespace_.namespace_uri()));
if (!namespace_.prefix().is_null() && !namespace_.prefix().is_empty())
TRY(builder.try_appendff(" Prefix: {}\n", namespace_.prefix()));
return {};
}
}