1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 19:55:06 +00:00

LibWeb: Add a dedicated function for parsing HTML length values

Presentation attribute lengths (width, height, etc.) can always be
unit-less (e.g "400") so going via the normal CSS parsing path only
works when the document is in quirks mode.

Add a separate parse_html_length() that always allows unit-less values.
This commit is contained in:
Andreas Kling 2020-07-22 01:13:18 +02:00
parent 9fc00d5d12
commit 5a7e57457e
4 changed files with 12 additions and 2 deletions

View file

@ -55,7 +55,7 @@ void HTMLTableCellElement::apply_presentational_hints(StyleProperties& style) co
return;
}
if (name == HTML::AttributeNames::width) {
if (auto parsed_value = parse_css_value(CSS::ParsingContext(document()), value))
if (auto parsed_value = parse_html_length(document(), value))
style.set_property(CSS::PropertyID::Width, parsed_value.release_nonnull());
return;
}