ladybird/Userland/Libraries/LibWeb/Painting/ImagePaintable.h
Aliaksandr Kalenik 6f5a0bd5de LibWeb: Save image provider in ImagePaintable
Refactoring towards making paintable be independant from layout nodes.

No behaviour change intended.
2024-02-27 16:53:13 +01:00

42 lines
977 B
C++

/*
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Layout/ImageBox.h>
#include <LibWeb/Painting/PaintableBox.h>
namespace Web::Painting {
class ImagePaintable final
: public PaintableBox
, public DOM::Document::ViewportClient {
JS_CELL(ImagePaintable, PaintableBox);
public:
static JS::NonnullGCPtr<ImagePaintable> create(Layout::ImageBox const&);
virtual void paint(PaintContext&, PaintPhase) const override;
Layout::ImageBox const& layout_box() const;
private:
// ^JS::Cell
virtual void visit_edges(Visitor&) override;
virtual void finalize() override;
// ^Document::ViewportClient
virtual void did_set_viewport_rect(CSSPixelRect const&) final;
ImagePaintable(Layout::ImageBox const&, String alt_text);
bool m_renders_as_alt_text { false };
String m_alt_text;
Layout::ImageProvider const& m_image_provider;
};
}