mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:57:44 +00:00
LibWeb: Support bgcolor attribute on tr elements
This commit is contained in:
parent
bd93b4984b
commit
876ad69ea3
2 changed files with 18 additions and 0 deletions
|
@ -5,12 +5,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibWeb/Bindings/Intrinsics.h>
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
|
#include <LibWeb/CSS/StyleProperties.h>
|
||||||
|
#include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
|
||||||
#include <LibWeb/DOM/ElementFactory.h>
|
#include <LibWeb/DOM/ElementFactory.h>
|
||||||
#include <LibWeb/DOM/HTMLCollection.h>
|
#include <LibWeb/DOM/HTMLCollection.h>
|
||||||
#include <LibWeb/HTML/HTMLTableCellElement.h>
|
#include <LibWeb/HTML/HTMLTableCellElement.h>
|
||||||
#include <LibWeb/HTML/HTMLTableElement.h>
|
#include <LibWeb/HTML/HTMLTableElement.h>
|
||||||
#include <LibWeb/HTML/HTMLTableRowElement.h>
|
#include <LibWeb/HTML/HTMLTableRowElement.h>
|
||||||
#include <LibWeb/HTML/HTMLTableSectionElement.h>
|
#include <LibWeb/HTML/HTMLTableSectionElement.h>
|
||||||
|
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||||
#include <LibWeb/Namespace.h>
|
#include <LibWeb/Namespace.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -30,6 +33,20 @@ JS::ThrowCompletionOr<void> HTMLTableRowElement::initialize(JS::Realm& realm)
|
||||||
return {};
|
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)
|
void HTMLTableRowElement::visit_edges(Cell::Visitor& visitor)
|
||||||
{
|
{
|
||||||
Base::visit_edges(visitor);
|
Base::visit_edges(visitor);
|
||||||
|
|
|
@ -32,6 +32,7 @@ private:
|
||||||
|
|
||||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||||
virtual void visit_edges(Cell::Visitor&) override;
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||||
|
|
||||||
JS::GCPtr<DOM::HTMLCollection> mutable m_cells;
|
JS::GCPtr<DOM::HTMLCollection> mutable m_cells;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue