mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 15:28:55 +00:00
LibWeb: Apply HTMLTableElement
bordercolor presentational hint
This commit is contained in:
parent
01c659ce9b
commit
3ffc7bd131
Notes:
github-actions[bot]
2025-02-20 17:12:59 +00:00
Author: https://github.com/tcl3
Commit: 3ffc7bd131
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3613
Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 70 additions and 0 deletions
|
@ -62,6 +62,7 @@ bool HTMLTableElement::is_presentational_hint(FlyString const& name) const
|
|||
HTML::AttributeNames::background,
|
||||
HTML::AttributeNames::bgcolor,
|
||||
HTML::AttributeNames::border,
|
||||
HTML::AttributeNames::bordercolor,
|
||||
HTML::AttributeNames::cellpadding,
|
||||
HTML::AttributeNames::cellspacing,
|
||||
HTML::AttributeNames::height,
|
||||
|
@ -123,6 +124,19 @@ void HTMLTableElement::apply_presentational_hints(GC::Ref<CSS::CascadedPropertie
|
|||
apply_border_style(CSS::PropertyID::BorderRightStyle, CSS::PropertyID::BorderRightWidth, CSS::PropertyID::BorderRightColor);
|
||||
apply_border_style(CSS::PropertyID::BorderBottomStyle, CSS::PropertyID::BorderBottomWidth, CSS::PropertyID::BorderBottomColor);
|
||||
}
|
||||
if (name == HTML::AttributeNames::bordercolor) {
|
||||
// https://html.spec.whatwg.org/multipage/rendering.html#tables-2:attr-table-bordercolor
|
||||
// When a table element has a bordercolor attribute, its value is expected to be parsed using the rules for parsing a legacy color value,
|
||||
// and if that does not return failure, the user agent is expected to treat the attribute as a presentational hint setting the element's
|
||||
// 'border-top-color', 'border-right-color', 'border-bottom-color', and 'border-left-color' properties to the resulting color.
|
||||
if (auto parsed_color = parse_legacy_color_value(value); parsed_color.has_value()) {
|
||||
auto color_value = CSS::CSSColorValue::create_from_color(parsed_color.value());
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::BorderTopColor, color_value);
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::BorderRightColor, color_value);
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::BorderBottomColor, color_value);
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::BorderLeftColor, color_value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue