mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:37:43 +00:00
LibWeb: Make SVG <g> elements generate a SVGGraphicsPaintable
...instead of defaulting to a PaintableBox. This way it gets the same behavior as other SVG boxes during paint.
This commit is contained in:
parent
0e8ef1b886
commit
ec5d5918c4
4 changed files with 15 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibWeb/Layout/SVGGraphicsBox.h>
|
#include <LibWeb/Layout/SVGGraphicsBox.h>
|
||||||
|
#include <LibWeb/Painting/SVGGraphicsPaintable.h>
|
||||||
#include <LibWeb/Painting/StackingContext.h>
|
#include <LibWeb/Painting/StackingContext.h>
|
||||||
|
|
||||||
namespace Web::Layout {
|
namespace Web::Layout {
|
||||||
|
@ -14,4 +15,9 @@ SVGGraphicsBox::SVGGraphicsBox(DOM::Document& document, SVG::SVGGraphicsElement&
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JS::GCPtr<Painting::Paintable> SVGGraphicsBox::create_paintable() const
|
||||||
|
{
|
||||||
|
return Painting::SVGGraphicsPaintable::create(*this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ public:
|
||||||
|
|
||||||
SVG::SVGGraphicsElement& dom_node() { return verify_cast<SVG::SVGGraphicsElement>(SVGBox::dom_node()); }
|
SVG::SVGGraphicsElement& dom_node() { return verify_cast<SVG::SVGGraphicsElement>(SVGBox::dom_node()); }
|
||||||
SVG::SVGGraphicsElement const& dom_node() const { return verify_cast<SVG::SVGGraphicsElement>(SVGBox::dom_node()); }
|
SVG::SVGGraphicsElement const& dom_node() const { return verify_cast<SVG::SVGGraphicsElement>(SVGBox::dom_node()); }
|
||||||
|
|
||||||
|
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,11 @@
|
||||||
|
|
||||||
namespace Web::Painting {
|
namespace Web::Painting {
|
||||||
|
|
||||||
|
JS::NonnullGCPtr<SVGGraphicsPaintable> SVGGraphicsPaintable::create(Layout::SVGGraphicsBox const& layout_box)
|
||||||
|
{
|
||||||
|
return layout_box.heap().allocate_without_realm<SVGGraphicsPaintable>(layout_box);
|
||||||
|
}
|
||||||
|
|
||||||
SVGGraphicsPaintable::SVGGraphicsPaintable(Layout::SVGGraphicsBox const& layout_box)
|
SVGGraphicsPaintable::SVGGraphicsPaintable(Layout::SVGGraphicsBox const& layout_box)
|
||||||
: SVGPaintable(layout_box)
|
: SVGPaintable(layout_box)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,6 +15,8 @@ class SVGGraphicsPaintable : public SVGPaintable {
|
||||||
JS_CELL(SVGGraphicsPaintable, SVGPaintable);
|
JS_CELL(SVGGraphicsPaintable, SVGPaintable);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static JS::NonnullGCPtr<SVGGraphicsPaintable> create(Layout::SVGGraphicsBox const&);
|
||||||
|
|
||||||
virtual void before_children_paint(PaintContext&, PaintPhase) const override;
|
virtual void before_children_paint(PaintContext&, PaintPhase) const override;
|
||||||
|
|
||||||
Layout::SVGGraphicsBox const& layout_box() const;
|
Layout::SVGGraphicsBox const& layout_box() const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue