mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-30 13:19:47 +00:00
LibWeb: Port Document encoding_parse_url and parse_url to Optional<URL>
This ports two more APIs away from URL::is_valid.
This commit is contained in:
committed by
Tim Ledbetter
parent
cfe9b7a82b
commit
22a7cd9700
@@ -125,12 +125,13 @@ void HTMLBodyElement::attribute_changed(FlyString const& name, Optional<String>
|
||||
document().set_visited_link_color(color.value());
|
||||
} else if (name.equals_ignoring_ascii_case("background"sv)) {
|
||||
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:attr-background
|
||||
m_background_style_value = CSS::ImageStyleValue::create(document().encoding_parse_url(value.value_or(String {})));
|
||||
m_background_style_value->on_animate = [this] {
|
||||
if (paintable()) {
|
||||
paintable()->set_needs_display();
|
||||
}
|
||||
};
|
||||
if (auto maybe_background_url = document().encoding_parse_url(value.value_or(String {})); maybe_background_url.has_value()) {
|
||||
m_background_style_value = CSS::ImageStyleValue::create(maybe_background_url.value());
|
||||
m_background_style_value->on_animate = [this] {
|
||||
if (paintable())
|
||||
paintable()->set_needs_display();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#undef __ENUMERATE
|
||||
|
||||
Reference in New Issue
Block a user