1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

LibWeb: Add support for animated images to HTMLImageElement

Uses a Core::Timer (similar to HTMLBlinkElement) to transition between
frames of an animated image. Also keeps track of the number of animation
loops.
This commit is contained in:
Peter Nelson 2020-05-03 17:57:13 +01:00 committed by Andreas Kling
parent d22bb92764
commit b8f5b81019
2 changed files with 44 additions and 0 deletions

View file

@ -27,6 +27,7 @@
#pragma once
#include <AK/ByteBuffer.h>
#include <LibCore/Forward.h>
#include <LibGfx/Forward.h>
#include <LibWeb/DOM/HTMLElement.h>
@ -56,10 +57,16 @@ public:
private:
void load_image(const String& src);
void animate();
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) const override;
RefPtr<Gfx::ImageDecoder> m_image_decoder;
ByteBuffer m_encoded_data;
size_t m_current_frame_index { 0 };
size_t m_loops_completed { 0 };
NonnullRefPtr<Core::Timer> m_timer;
};
template<>