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

LibWeb: Move "visible in viewport" state tracking to ImageLoader

This should technically apply to any LayoutImage, so let's just move
it to ImageLoader.
This commit is contained in:
Andreas Kling 2020-06-14 19:32:23 +02:00
parent c45615128b
commit 73c9f7ebf4
7 changed files with 12 additions and 13 deletions

View file

@ -44,7 +44,7 @@ void ImageLoader::load(const URL& url)
set_resource(ResourceLoader::the().load_resource(Resource::Type::Image, request));
}
void ImageLoader::set_visible_in_viewport(bool visible_in_viewport)
void ImageLoader::set_visible_in_viewport(bool visible_in_viewport) const
{
if (m_visible_in_viewport == visible_in_viewport)
return;
@ -54,7 +54,7 @@ void ImageLoader::set_visible_in_viewport(bool visible_in_viewport)
// the whole document, updating "is visible in viewport" flags, and this could lead
// to the same bitmap being marked volatile back and forth unnecessarily.
if (resource())
resource()->update_volatility();
const_cast<ImageResource*>(resource())->update_volatility();
}
void ImageLoader::resource_did_load()