mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:18:11 +00:00
LibWeb: Apply rules for parsing a legacy color value
This commit is contained in:
parent
bc54560e59
commit
500552df54
5 changed files with 21 additions and 9 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <LibWeb/CSS/StyleProperties.h>
|
||||
#include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
|
||||
#include <LibWeb/HTML/HTMLMarqueeElement.h>
|
||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
@ -31,7 +32,8 @@ void HTMLMarqueeElement::apply_presentational_hints(CSS::StyleProperties& style)
|
|||
HTMLElement::apply_presentational_hints(style);
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name == HTML::AttributeNames::bgcolor) {
|
||||
auto color = Color::from_string(value);
|
||||
// https://html.spec.whatwg.org/multipage/rendering.html#the-marquee-element-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());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue