mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-22 02:26:11 +00:00
LibWeb: Paint SVGDecodedImageData
via Navigable::paint()
Going via the `ViewportPaintable` missed some steps (in particular computing clip rects), which meant nested SVGs within SVGs-as-images were completely clipped.
This commit is contained in:
parent
4b66f5662b
commit
06ed56f4f6
5
Tests/LibWeb/Ref/assets/nested-svg.svg
Normal file
5
Tests/LibWeb/Ref/assets/nested-svg.svg
Normal file
|
@ -0,0 +1,5 @@
|
|||
<svg width="22" height="22" xmlns="http://www.w3.org/2000/svg">
|
||||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" x="5" y="5">
|
||||
<rect width="12" height="12" fill="red" />
|
||||
</svg>
|
||||
</svg>
|
After Width: | Height: | Size: 237 B |
5
Tests/LibWeb/Ref/nested-svg-as-img.html
Normal file
5
Tests/LibWeb/Ref/nested-svg-as-img.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<style>
|
||||
img { border: 1px solid black; }
|
||||
</style>
|
||||
<img src="./assets/nested-svg.svg">
|
||||
<link rel="match" href="reference/nested-svg-as-img-ref.html" />
|
8
Tests/LibWeb/Ref/reference/nested-svg-as-img-ref.html
Normal file
8
Tests/LibWeb/Ref/reference/nested-svg-as-img-ref.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
<svg width="22" height="22" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="5" y="5" width="12" height="12" fill="red" />
|
||||
</svg>
|
||||
<style>
|
||||
svg {
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
After Width: | Height: | Size: 186 B |
|
@ -133,11 +133,9 @@ RefPtr<Gfx::Bitmap> SVGDecodedImageData::render(Gfx::IntSize size) const
|
|||
|
||||
Painting::CommandList painting_commands;
|
||||
Painting::RecordingPainter recording_painter(painting_commands);
|
||||
PaintContext context(recording_painter, m_page_client->palette(), m_page_client->device_pixels_per_css_pixel());
|
||||
|
||||
m_document->paintable()->paint_all_phases(context);
|
||||
|
||||
Painting::CommandExecutorCPU executor { *bitmap };
|
||||
|
||||
m_document->navigable()->paint(recording_painter, {});
|
||||
painting_commands.execute(executor);
|
||||
|
||||
return bitmap;
|
||||
|
|
Loading…
Reference in a new issue