mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
LibWeb: Render SVG-as-image into an isolated top-level browsing context
In order to separate the SVG content from the rest of the engine, it gets its very own Page, PageClient, top-level browsing context, etc. Unfortunately, we do have to get the palette and CSS/device pixel ratios from the host Page for now, maybe that's something we could refactor in the future. Note that this doesn't work visually yet, since we don't calculate the intrinsic sizes & ratio for SVG images. That comes next. :^)
This commit is contained in:
parent
e63f68661f
commit
41ab0837fa
3 changed files with 139 additions and 21 deletions
|
@ -12,7 +12,7 @@ namespace Web::SVG {
|
|||
|
||||
class SVGDecodedImageData final : public HTML::DecodedImageData {
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<SVGDecodedImageData>> create(ByteBuffer encoded_svg);
|
||||
static ErrorOr<NonnullRefPtr<SVGDecodedImageData>> create(Page&, AK::URL const&, ByteBuffer encoded_svg);
|
||||
virtual ~SVGDecodedImageData() override;
|
||||
|
||||
virtual RefPtr<Gfx::Bitmap const> bitmap(size_t frame_index, Gfx::IntSize) const override;
|
||||
|
@ -28,7 +28,17 @@ public:
|
|||
virtual bool is_animated() const override { return false; }
|
||||
|
||||
private:
|
||||
SVGDecodedImageData();
|
||||
class SVGPageClient;
|
||||
SVGDecodedImageData(NonnullOwnPtr<Page>, NonnullOwnPtr<SVGPageClient>, JS::Handle<DOM::Document>, JS::Handle<SVG::SVGSVGElement>);
|
||||
|
||||
void render(Gfx::IntSize) const;
|
||||
mutable RefPtr<Gfx::Bitmap> m_bitmap;
|
||||
|
||||
NonnullOwnPtr<Page> m_page;
|
||||
NonnullOwnPtr<SVGPageClient> m_page_client;
|
||||
|
||||
JS::Handle<DOM::Document> m_document;
|
||||
JS::Handle<SVG::SVGSVGElement> m_root_element;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue