From 3ffc7bd131eae3ea25178bc5a4c239a0d4c8fbc4 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Tue, 18 Feb 2025 10:09:40 +0000 Subject: [PATCH] LibWeb: Apply `HTMLTableElement` bordercolor presentational hint --- Libraries/LibWeb/HTML/AttributeNames.h | 1 + Libraries/LibWeb/HTML/HTMLTableElement.cpp | 14 +++++++++ .../tables/table-bordercolor-001-ref.html | 26 +++++++++++++++++ .../tables/table-bordercolor-001.html | 29 +++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/tables/table-bordercolor-001-ref.html create mode 100644 Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/tables/table-bordercolor-001.html diff --git a/Libraries/LibWeb/HTML/AttributeNames.h b/Libraries/LibWeb/HTML/AttributeNames.h index 945f72b63cb..5dacd3d0880 100644 --- a/Libraries/LibWeb/HTML/AttributeNames.h +++ b/Libraries/LibWeb/HTML/AttributeNames.h @@ -33,6 +33,7 @@ namespace AttributeNames { __ENUMERATE_HTML_ATTRIBUTE(behavior, "behavior") \ __ENUMERATE_HTML_ATTRIBUTE(bgcolor, "bgcolor") \ __ENUMERATE_HTML_ATTRIBUTE(border, "border") \ + __ENUMERATE_HTML_ATTRIBUTE(bordercolor, "bordercolor") \ __ENUMERATE_HTML_ATTRIBUTE(bottommargin, "bottommargin") \ __ENUMERATE_HTML_ATTRIBUTE(cellpadding, "cellpadding") \ __ENUMERATE_HTML_ATTRIBUTE(cellspacing, "cellspacing") \ diff --git a/Libraries/LibWeb/HTML/HTMLTableElement.cpp b/Libraries/LibWeb/HTML/HTMLTableElement.cpp index a685aad9a65..fd8201267c7 100644 --- a/Libraries/LibWeb/HTML/HTMLTableElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLTableElement.cpp @@ -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::Refset_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); + } + } }); } diff --git a/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/tables/table-bordercolor-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/tables/table-bordercolor-001-ref.html new file mode 100644 index 00000000000..1b128e61715 --- /dev/null +++ b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/tables/table-bordercolor-001-ref.html @@ -0,0 +1,26 @@ + + +Reference case for table bordercolor attribute behaving like border-color property + + + + + +
I should not have a border.
+ + +
I should not have a border.
+ + +
I should not have a border.
+ + +
I should not have a border.
+ + +
I should have a border.
+ + +
I should have a border.
diff --git a/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/tables/table-bordercolor-001.html b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/tables/table-bordercolor-001.html new file mode 100644 index 00000000000..8ca0eb8c0e9 --- /dev/null +++ b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/tables/table-bordercolor-001.html @@ -0,0 +1,29 @@ + + +Test for table bordercolor attribute behaving like border-color property + + + + + + + + +
I should not have a border.
+ + +
I should not have a border.
+ + +
I should not have a border.
+ + +
I should not have a border.
+ + +
I should have a border.
+ + +
I should have a border.