diff --git a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp index 6a08699d864..d4e29f29602 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp @@ -244,4 +244,18 @@ Optional SVGGraphicsElement::stroke_width() const return width.to_px(*layout_node(), scaled_viewport_size).to_double(); } +JS::NonnullGCPtr SVGGraphicsElement::get_b_box(Optional) +{ + dbgln("(STUBBED) SVGGraphicsElement::get_b_box(). Called on: {}", debug_description()); + return Geometry::DOMRect::create(realm()); +} + +JS::NonnullGCPtr SVGGraphicsElement::transform() const +{ + dbgln("(STUBBED) SVGGraphicsElement::transform(). Called on: {}", debug_description()); + auto base_val = SVGTransformList::create(realm()); + auto anim_val = SVGTransformList::create(realm()); + return SVGAnimatedTransformList::create(realm(), base_val, anim_val); +} + } diff --git a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h index ba32cde2d02..cf6f3f772b9 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -18,6 +19,13 @@ namespace Web::SVG { +struct SVGBoundingBoxOptions { + bool fill { true }; + bool stroke { false }; + bool markers { false }; + bool clipped { false }; +}; + class SVGGraphicsElement : public SVGElement { WEB_PLATFORM_OBJECT(SVGGraphicsElement, SVGElement); @@ -46,9 +54,11 @@ public: Optional stroke_paint_style(SVGPaintContext const&) const; JS::GCPtr mask() const; - JS::GCPtr clip_path() const; + JS::NonnullGCPtr get_b_box(Optional); + JS::NonnullGCPtr transform() const; + protected: SVGGraphicsElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.idl b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.idl index 49cea98a238..14c9b9efe37 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.idl +++ b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.idl @@ -1,7 +1,19 @@ #import +#import + +dictionary SVGBoundingBoxOptions { + boolean fill = true; + boolean stroke = false; + boolean markers = false; + boolean clipped = false; +}; // https://svgwg.org/svg2-draft/types.html#InterfaceSVGGraphicsElement [Exposed=Window] interface SVGGraphicsElement : SVGElement { + [SameObject] readonly attribute SVGAnimatedTransformList transform; + DOMRect getBBox(optional SVGBoundingBoxOptions options = {}); + // FIXME: DOMMatrix? getCTM(); + // FIXME: DOMMatrix? getScreenCTM(); };