diff options
author | Andreas Kling <kling@serenityos.org> | 2020-06-14 19:32:23 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-14 19:32:23 +0200 |
commit | 73c9f7ebf4ae07492367c1c39f940603046b780e (patch) | |
tree | f4dccb566f8fc798536390211abf93d415cc2663 /Libraries/LibWeb/Loader | |
parent | c45615128b5bb9bc295390fff814fa7b7c843b1b (diff) | |
download | serenity-73c9f7ebf4ae07492367c1c39f940603046b780e.zip |
LibWeb: Move "visible in viewport" state tracking to ImageLoader
This should technically apply to any LayoutImage, so let's just move
it to ImageLoader.
Diffstat (limited to 'Libraries/LibWeb/Loader')
-rw-r--r-- | Libraries/LibWeb/Loader/ImageLoader.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibWeb/Loader/ImageLoader.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Libraries/LibWeb/Loader/ImageLoader.cpp b/Libraries/LibWeb/Loader/ImageLoader.cpp index e3e3502805..a6b3ecae58 100644 --- a/Libraries/LibWeb/Loader/ImageLoader.cpp +++ b/Libraries/LibWeb/Loader/ImageLoader.cpp @@ -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() diff --git a/Libraries/LibWeb/Loader/ImageLoader.h b/Libraries/LibWeb/Loader/ImageLoader.h index 14c8cd3288..71cd48ff64 100644 --- a/Libraries/LibWeb/Loader/ImageLoader.h +++ b/Libraries/LibWeb/Loader/ImageLoader.h @@ -41,7 +41,7 @@ public: const Gfx::Bitmap* bitmap() const; const Gfx::ImageDecoder* image_decoder() const; - void set_visible_in_viewport(bool); + void set_visible_in_viewport(bool) const; Function<void()> on_load; Function<void()> on_fail; @@ -57,7 +57,7 @@ private: void animate(); RefPtr<Gfx::ImageDecoder> m_decoder; - bool m_visible_in_viewport { false }; + mutable bool m_visible_in_viewport { false }; size_t m_current_frame_index { 0 }; size_t m_loops_completed { 0 }; |