mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
LibWeb: Support animated backgrounds
This commit is contained in:
parent
bfdb30c74a
commit
6ff9a88c3b
3 changed files with 54 additions and 14 deletions
|
@ -1171,23 +1171,29 @@ public:
|
|||
|
||||
virtual void load_any_resources(DOM::Document&) override;
|
||||
|
||||
Gfx::Bitmap const* bitmap() const { return m_bitmap; }
|
||||
|
||||
Optional<int> natural_width() const override;
|
||||
Optional<int> natural_height() const override;
|
||||
|
||||
bool is_paintable() const override { return !m_bitmap.is_null(); }
|
||||
bool is_paintable() const override { return bitmap(0) != nullptr; }
|
||||
void paint(PaintContext& context, Gfx::IntRect const& dest_rect, CSS::ImageRendering image_rendering) const override;
|
||||
|
||||
Function<void()> on_animate;
|
||||
|
||||
private:
|
||||
ImageStyleValue(AK::URL const&);
|
||||
|
||||
// ^ResourceClient
|
||||
virtual void resource_did_load() override;
|
||||
|
||||
void animate();
|
||||
Gfx::Bitmap const* bitmap(size_t index) const;
|
||||
|
||||
AK::URL m_url;
|
||||
WeakPtr<DOM::Document> m_document;
|
||||
RefPtr<Gfx::Bitmap> m_bitmap;
|
||||
|
||||
size_t m_current_frame_index { 0 };
|
||||
size_t m_loops_completed { 0 };
|
||||
RefPtr<Platform::Timer> m_timer;
|
||||
};
|
||||
|
||||
enum class GradientRepeating {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue