mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 14:19:48 +00:00
LibWeb: Convert callers of ImageCodecPlugin to the async API
The HTMLLinkElement caller is a bit hairy, so we shove an await() in there temporarily. This is sure to cause fun times for anyone debugging task/microtask execution order.
This commit is contained in:
parent
39dfb659cf
commit
651e78fedb
Notes:
sideshowbarker
2024-07-17 05:58:46 +09:00
Author: https://github.com/ADKaster
Commit: 651e78fedb
Pull-request: https://github.com/SerenityOS/serenity/pull/24028
Reviewed-by: https://github.com/LucasChollet
Reviewed-by: https://github.com/awesomekling
7 changed files with 78 additions and 71 deletions
|
@ -182,11 +182,14 @@ WebIDL::ExceptionOr<void> HTMLVideoElement::determine_element_poster_frame(Optio
|
|||
m_fetch_controller = nullptr;
|
||||
|
||||
// 6. If an image is thus obtained, the poster frame is that image. Otherwise, there is no poster frame.
|
||||
auto image = Platform::ImageCodecPlugin::the().decode_image(image_data);
|
||||
if (!image.has_value() || image->frames.is_empty())
|
||||
return;
|
||||
|
||||
m_poster_frame = move(image.release_value().frames[0].bitmap);
|
||||
(void)Platform::ImageCodecPlugin::the().decode_image(
|
||||
image_data,
|
||||
[strong_this = JS::Handle(*this)](Web::Platform::DecodedImage& image) -> ErrorOr<void> {
|
||||
if (!image.frames.is_empty())
|
||||
strong_this->m_poster_frame = move(image.frames[0].bitmap);
|
||||
return {};
|
||||
},
|
||||
[](auto&) {});
|
||||
});
|
||||
|
||||
VERIFY(response->body());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue