In a future commit, ownership of animation will be transferred from these clients to `AnimatedDecodedImageData` and we will need a way to invalidate them for new frames. This also revealed some `ImageProvider`s which don't yet support animated images (e.g. `<input type="file">`, `<object>`, etc) but that is left as a FIXME for now.
41 lines
840 B
C++
41 lines
840 B
C++
/*
|
|
* Copyright (c) 2023, Andreas Kling <andreas@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/HTML/DecodedImageData.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
void DecodedImageData::Client::register_with_decoded_image_data_if_needed()
|
|
{
|
|
auto const& image_data = decoded_image_data();
|
|
|
|
if (!image_data)
|
|
return;
|
|
|
|
image_data->m_clients.set(this);
|
|
}
|
|
|
|
void DecodedImageData::Client::unregister_with_decoded_image_data_if_needed()
|
|
{
|
|
auto const& image_data = decoded_image_data();
|
|
|
|
if (!image_data)
|
|
return;
|
|
|
|
image_data->m_clients.remove(this);
|
|
}
|
|
|
|
DecodedImageData::DecodedImageData() = default;
|
|
|
|
DecodedImageData::~DecodedImageData() = default;
|
|
|
|
void DecodedImageData::notify_clients_did_update()
|
|
{
|
|
for (auto* client : m_clients)
|
|
client->decoded_image_data_did_update();
|
|
}
|
|
|
|
}
|