mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibWeb: Stub SVGGraphicsElement
methods/attributes
This stubs the `SVGGraphicsElement.getBBox()` method and the `.transform` attribute.
This commit is contained in:
parent
329262d54f
commit
5739ea9ba1
Notes:
sideshowbarker
2024-07-17 01:53:23 +09:00
Author: https://github.com/MacDue
Commit: 5739ea9ba1
Pull-request: https://github.com/SerenityOS/serenity/pull/23793
Reviewed-by: https://github.com/shannonbooth
3 changed files with 37 additions and 1 deletions
|
@ -244,4 +244,18 @@ Optional<float> SVGGraphicsElement::stroke_width() const
|
|||
return width.to_px(*layout_node(), scaled_viewport_size).to_double();
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<Geometry::DOMRect> SVGGraphicsElement::get_b_box(Optional<SVGBoundingBoxOptions>)
|
||||
{
|
||||
dbgln("(STUBBED) SVGGraphicsElement::get_b_box(). Called on: {}", debug_description());
|
||||
return Geometry::DOMRect::create(realm());
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<SVGAnimatedTransformList> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <LibGfx/Path.h>
|
||||
#include <LibWeb/DOM/Node.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
#include <LibWeb/SVG/SVGAnimatedTransformList.h>
|
||||
#include <LibWeb/SVG/SVGElement.h>
|
||||
#include <LibWeb/SVG/SVGGradientElement.h>
|
||||
#include <LibWeb/SVG/TagNames.h>
|
||||
|
@ -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<Gfx::PaintStyle const&> stroke_paint_style(SVGPaintContext const&) const;
|
||||
|
||||
JS::GCPtr<SVG::SVGMaskElement const> mask() const;
|
||||
|
||||
JS::GCPtr<SVG::SVGClipPathElement const> clip_path() const;
|
||||
|
||||
JS::NonnullGCPtr<Geometry::DOMRect> get_b_box(Optional<SVGBoundingBoxOptions>);
|
||||
JS::NonnullGCPtr<SVGAnimatedTransformList> transform() const;
|
||||
|
||||
protected:
|
||||
SVGGraphicsElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
|
|
|
@ -1,7 +1,19 @@
|
|||
#import <SVG/SVGElement.idl>
|
||||
#import <Geometry/DOMRectReadOnly.idl>
|
||||
|
||||
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();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue