mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:27:45 +00:00
LibWeb: Split ImageStyleValue out of StyleValue.{h,cpp}
This commit is contained in:
parent
76de017a51
commit
35b240c87d
7 changed files with 166 additions and 126 deletions
|
@ -675,43 +675,6 @@ public:
|
|||
virtual void paint(PaintContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering image_rendering) const = 0;
|
||||
};
|
||||
|
||||
class ImageStyleValue final
|
||||
: public AbstractImageStyleValue
|
||||
, public ImageResourceClient {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<ImageStyleValue> create(AK::URL const& url) { return adopt_ref(*new ImageStyleValue(url)); }
|
||||
virtual ~ImageStyleValue() override = default;
|
||||
|
||||
virtual ErrorOr<String> to_string() const override;
|
||||
virtual bool equals(StyleValue const& other) const override;
|
||||
|
||||
virtual void load_any_resources(DOM::Document&) override;
|
||||
|
||||
Optional<CSSPixels> natural_width() const override;
|
||||
Optional<CSSPixels> natural_height() const override;
|
||||
|
||||
bool is_paintable() const override { return bitmap(0) != nullptr; }
|
||||
void paint(PaintContext& context, DevicePixelRect 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;
|
||||
|
||||
size_t m_current_frame_index { 0 };
|
||||
size_t m_loops_completed { 0 };
|
||||
RefPtr<Platform::Timer> m_timer;
|
||||
};
|
||||
|
||||
enum class GradientRepeating {
|
||||
Yes,
|
||||
No
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue