mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-12 01:46:46 +02:00
LibWeb/HTML: Support align attributes on table sections and rows
thead, tbody, tfoot, tr, td, and th all have an `align` presentational attribute with identical definitions. We previously only supported it for td and th, and also allowed arbitrary text-align values instead of the 4 dictated by the spec.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
0b4cea5b29
commit
73c4b77f68
Notes:
github-actions[bot]
2026-04-30 13:21:30 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/73c4b77f684 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/9177 Reviewed-by: https://github.com/gmta ✅
@@ -46,6 +46,7 @@ bool HTMLTableRowElement::is_presentational_hint(FlyString const& name) const
|
||||
return true;
|
||||
|
||||
return first_is_one_of(name,
|
||||
HTML::AttributeNames::align,
|
||||
HTML::AttributeNames::bgcolor,
|
||||
HTML::AttributeNames::background,
|
||||
HTML::AttributeNames::height,
|
||||
@@ -56,7 +57,10 @@ void HTMLTableRowElement::apply_presentational_hints(GC::Ref<CSS::CascadedProper
|
||||
{
|
||||
Base::apply_presentational_hints(cascaded_properties);
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name == HTML::AttributeNames::bgcolor) {
|
||||
if (name == HTML::AttributeNames::align) {
|
||||
if (auto parsed_value = parse_table_child_element_align_value(value))
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::TextAlign, parsed_value.release_nonnull());
|
||||
} else 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);
|
||||
if (color.has_value())
|
||||
|
||||
Reference in New Issue
Block a user