mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-08 04:02:52 +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:
parent
cfe9b7a82b
commit
22a7cd9700
Notes:
github-actions[bot]
2025-01-27 00:04:07 +00:00
Author: https://github.com/shannonbooth
Commit: 22a7cd9700
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3362
Reviewed-by: https://github.com/tcl3 ✅
26 changed files with 135 additions and 107 deletions
Libraries/LibWeb/HTML
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue