1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:38:10 +00:00

LibWeb: Propagate errors from StyleValue construction

Turns out we create a lot of these, mostly from places that don't return
ErrorOr. The yak stack grows.
This commit is contained in:
Sam Atkins 2023-05-05 15:02:03 +01:00 committed by Andreas Kling
parent 36bb04d792
commit d16600a48b
76 changed files with 445 additions and 415 deletions

View file

@ -34,11 +34,11 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
if (name.equals_ignoring_ascii_case("bgcolor"sv)) {
auto color = Color::from_string(value);
if (color.has_value())
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()));
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors());
} else if (name.equals_ignoring_ascii_case("text"sv)) {
auto color = Color::from_string(value);
if (color.has_value())
style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()));
style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors());
} else if (name.equals_ignoring_ascii_case("background"sv)) {
VERIFY(m_background_style_value);
style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value);
@ -62,7 +62,7 @@ void HTMLBodyElement::parse_attribute(DeprecatedFlyString const& name, Deprecate
if (color.has_value())
document().set_visited_link_color(color.value());
} else if (name.equals_ignoring_ascii_case("background"sv)) {
m_background_style_value = CSS::ImageStyleValue::create(document().parse_url(value));
m_background_style_value = CSS::ImageStyleValue::create(document().parse_url(value)).release_value_but_fixme_should_propagate_errors();
m_background_style_value->on_animate = [this] {
if (layout_node()) {
layout_node()->set_needs_display();