mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 01:40:46 +00:00
LibWeb: Implement the SVGGeometryElement.pathLength
attribute
This commit is contained in:
parent
410e82c9fd
commit
caf45f2317
Notes:
github-actions[bot]
2025-07-11 23:50:23 +00:00
Author: https://github.com/tcl3
Commit: caf45f2317
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5410
Reviewed-by: https://github.com/shannonbooth
6 changed files with 54 additions and 10 deletions
|
@ -22,6 +22,12 @@ void SVGGeometryElement::initialize(JS::Realm& realm)
|
|||
Base::initialize(realm);
|
||||
}
|
||||
|
||||
void SVGGeometryElement::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_path_length);
|
||||
}
|
||||
|
||||
GC::Ptr<Layout::Node> SVGGeometryElement::create_layout_node(GC::Ref<CSS::ComputedProperties> style)
|
||||
{
|
||||
return heap().allocate<Layout::SVGGeometryBox>(document(), *this, move(style));
|
||||
|
@ -38,4 +44,11 @@ GC::Ref<Geometry::DOMPoint> SVGGeometryElement::get_point_at_length(float distan
|
|||
return Geometry::DOMPoint::construct_impl(realm(), 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
GC::Ref<SVGAnimatedNumber> SVGGeometryElement::path_length()
|
||||
{
|
||||
if (!m_path_length)
|
||||
m_path_length = SVGAnimatedNumber::create(realm(), *this, AttributeNames::pathLength, 0.f);
|
||||
return *m_path_length;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,10 +23,16 @@ public:
|
|||
float get_total_length();
|
||||
GC::Ref<Geometry::DOMPoint> get_point_at_length(float distance);
|
||||
|
||||
GC::Ref<SVGAnimatedNumber> path_length();
|
||||
|
||||
protected:
|
||||
SVGGeometryElement(DOM::Document& document, DOM::QualifiedName qualified_name);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
private:
|
||||
GC::Ptr<SVGAnimatedNumber> m_path_length;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement
|
||||
[Exposed=Window]
|
||||
interface SVGGeometryElement : SVGGraphicsElement {
|
||||
[FIXME, SameObject] readonly attribute SVGAnimatedNumber pathLength;
|
||||
[SameObject] readonly attribute SVGAnimatedNumber pathLength;
|
||||
|
||||
[FIXME] boolean isPointInFill(optional DOMPointInit point = {});
|
||||
[FIXME] boolean isPointInStroke(optional DOMPointInit point = {});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue