mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
LibWeb: Properly handle the <td align> attribute
When valid, this attribute needs to result in an IdentifierStyleValue. Before this change we were turning it into a StringStyleValue, which then defaulted to left alignment for all values. For "center" and "middle", we turn it into -libweb-center. All other values are passed verbatim to the CSS parser.
This commit is contained in:
parent
c1511ebbea
commit
5c132724ea
Notes:
sideshowbarker
2024-07-18 01:49:08 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/5c132724ea9
1 changed files with 7 additions and 4 deletions
|
@ -28,10 +28,13 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl
|
|||
return;
|
||||
}
|
||||
if (name == HTML::AttributeNames::align) {
|
||||
if (value.equals_ignoring_case("center") || value.equals_ignoring_case("middle"))
|
||||
style.set_property(CSS::PropertyID::TextAlign, StringView("-libweb-center"));
|
||||
else
|
||||
style.set_property(CSS::PropertyID::TextAlign, value.view());
|
||||
if (value.equals_ignoring_case("center"sv) || value.equals_ignoring_case("middle"sv)) {
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebCenter));
|
||||
} else {
|
||||
CSS::Parser parser(CSS::ParsingContext(document()), value.view());
|
||||
if (auto parsed_value = parser.parse_as_css_value(CSS::PropertyID::TextAlign))
|
||||
style.set_property(CSS::PropertyID::TextAlign, parsed_value.release_nonnull());
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (name == HTML::AttributeNames::width) {
|
||||
|
|
Loading…
Reference in a new issue