1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:08:10 +00:00

LibWeb: Treat img width/height attributes as HTML dimension values

This commit is contained in:
Andreas Kling 2022-03-26 11:39:33 +01:00
parent 075bdfdef8
commit c92d28b4ea

View file

@ -50,13 +50,11 @@ void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) c
{ {
for_each_attribute([&](auto& name, auto& value) { for_each_attribute([&](auto& name, auto& value) {
if (name == HTML::AttributeNames::width) { if (name == HTML::AttributeNames::width) {
if (auto parsed_value = parse_html_length(document(), value)) { if (auto parsed_value = parse_dimension_value(value))
style.set_property(CSS::PropertyID::Width, parsed_value.release_nonnull()); style.set_property(CSS::PropertyID::Width, parsed_value.release_nonnull());
}
} else if (name == HTML::AttributeNames::height) { } else if (name == HTML::AttributeNames::height) {
if (auto parsed_value = parse_html_length(document(), value)) { if (auto parsed_value = parse_dimension_value(value))
style.set_property(CSS::PropertyID::Height, parsed_value.release_nonnull()); style.set_property(CSS::PropertyID::Height, parsed_value.release_nonnull());
}
} }
}); });
} }