1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 17:34:59 +00:00

LibWeb: Support the hspace and vspace attributes on img elements

These map HTML dimension values to CSS margin values.
This commit is contained in:
Andreas Kling 2022-03-26 11:43:27 +01:00
parent c92d28b4ea
commit 0e806f58fe
2 changed files with 12 additions and 0 deletions

View file

@ -55,6 +55,16 @@ void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) c
} else if (name == HTML::AttributeNames::height) {
if (auto parsed_value = parse_dimension_value(value))
style.set_property(CSS::PropertyID::Height, parsed_value.release_nonnull());
} else if (name == HTML::AttributeNames::hspace) {
if (auto parsed_value = parse_dimension_value(value)) {
style.set_property(CSS::PropertyID::MarginLeft, *parsed_value);
style.set_property(CSS::PropertyID::MarginRight, *parsed_value);
}
} else if (name == HTML::AttributeNames::vspace) {
if (auto parsed_value = parse_dimension_value(value)) {
style.set_property(CSS::PropertyID::MarginTop, *parsed_value);
style.set_property(CSS::PropertyID::MarginBottom, *parsed_value);
}
}
});
}