mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
LibWeb: Support bgcolor attribute on tr elements
This commit is contained in:
parent
bd93b4984b
commit
876ad69ea3
Notes:
sideshowbarker
2024-07-18 02:13:10 +09:00
Author: https://github.com/warpdesign 🔰 Commit: https://github.com/SerenityOS/serenity/commit/876ad69ea3 Pull-request: https://github.com/SerenityOS/serenity/pull/19794 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/awesomekling
|
@ -5,12 +5,15 @@
|
|||
*/
|
||||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/StyleProperties.h>
|
||||
#include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
|
||||
#include <LibWeb/DOM/ElementFactory.h>
|
||||
#include <LibWeb/DOM/HTMLCollection.h>
|
||||
#include <LibWeb/HTML/HTMLTableCellElement.h>
|
||||
#include <LibWeb/HTML/HTMLTableElement.h>
|
||||
#include <LibWeb/HTML/HTMLTableRowElement.h>
|
||||
#include <LibWeb/HTML/HTMLTableSectionElement.h>
|
||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||
#include <LibWeb/Namespace.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
@ -30,6 +33,20 @@ JS::ThrowCompletionOr<void> HTMLTableRowElement::initialize(JS::Realm& realm)
|
|||
return {};
|
||||
}
|
||||
|
||||
void HTMLTableRowElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||
{
|
||||
Base::apply_presentational_hints(style);
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
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())
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors());
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void HTMLTableRowElement::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
|
|
|
@ -32,6 +32,7 @@ private:
|
|||
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||
|
||||
JS::GCPtr<DOM::HTMLCollection> mutable m_cells;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue