LibWeb: Support align attribute on table elements

This commit is contained in:
implicitfield 2023-11-19 12:22:49 +04:00 committed by Andreas Kling
parent 7a766bdb83
commit a54e62bea0
Notes: sideshowbarker 2024-07-17 18:13:59 +09:00
5 changed files with 70 additions and 0 deletions

View file

@ -61,6 +61,15 @@ void HTMLTableElement::apply_presentational_hints(CSS::StyleProperties& style) c
style.set_property(CSS::PropertyID::Height, parsed_value.release_nonnull());
return;
}
if (name == HTML::AttributeNames::align) {
if (value.equals_ignoring_ascii_case("center"sv)) {
style.set_property(CSS::PropertyID::MarginLeft, CSS::IdentifierStyleValue::create(CSS::ValueID::Auto));
style.set_property(CSS::PropertyID::MarginRight, CSS::IdentifierStyleValue::create(CSS::ValueID::Auto));
} else if (auto parsed_value = parse_css_value(CSS::Parser::ParsingContext { document() }, value.view(), CSS::PropertyID::Float)) {
style.set_property(CSS::PropertyID::Float, parsed_value.release_nonnull());
}
return;
}
if (name == HTML::AttributeNames::bgcolor) {
// https://html.spec.whatwg.org/multipage/rendering.html#tables-2:rules-for-parsing-a-legacy-colour-value
auto color = parse_legacy_color_value(value);