From 176baf7cdbbff0c5b644ad72d6c6930eb23a00bc Mon Sep 17 00:00:00 2001 From: Nicolas Ramz Date: Fri, 7 Jul 2023 11:42:25 +0200 Subject: [PATCH] LibWeb: Support background attribute on table elements --- Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp | 6 ++++++ Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp index 8e98162822..dd9132754e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp @@ -9,6 +9,8 @@ #include #include #include +#include +#include #include #include @@ -61,6 +63,10 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl if (auto parsed_value = parse_nonzero_dimension_value(value)) style.set_property(CSS::PropertyID::Height, parsed_value.release_nonnull()); return; + } else if (name == HTML::AttributeNames::background) { + if (auto parsed_value = document().parse_url(value); parsed_value.is_valid()) + style.set_property(CSS::PropertyID::BackgroundImage, CSS::ImageStyleValue::create(parsed_value).release_value_but_fixme_should_propagate_errors()); + return; } }); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp index 10e037b039..74c55de3bf 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include #include #include @@ -43,6 +45,10 @@ void HTMLTableRowElement::apply_presentational_hints(CSS::StyleProperties& style if (color.has_value()) style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors()); return; + } else if (name == HTML::AttributeNames::background) { + if (auto parsed_value = document().parse_url(value); parsed_value.is_valid()) + style.set_property(CSS::PropertyID::BackgroundImage, CSS::ImageStyleValue::create(parsed_value).release_value_but_fixme_should_propagate_errors()); + return; } }); }