LibWeb/SVG: Implement the SVGAElement.target attribute

This commit is contained in:
Tim Ledbetter 2025-07-12 02:06:51 +01:00 committed by Jelle Raaijmakers
commit d86f0a1b29
Notes: github-actions[bot] 2025-07-12 09:06:57 +00:00
4 changed files with 22 additions and 9 deletions

View file

@ -32,6 +32,7 @@ void SVGAElement::visit_edges(Cell::Visitor& visitor)
Base::visit_edges(visitor);
SVGURIReferenceMixin::visit_edges(visitor);
visitor.visit(m_rel_list);
visitor.visit(m_target);
}
void SVGAElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
@ -61,6 +62,14 @@ i32 SVGAElement::default_tab_index_value() const
return 0;
}
// https://svgwg.org/svg2-draft/linking.html#__svg__SVGAElement__target
GC::Ref<SVGAnimatedString> SVGAElement::target()
{
if (!m_target)
m_target = SVGAnimatedString::create(realm(), *this, HTML::AttributeNames::target);
return *m_target;
}
// https://svgwg.org/svg2-draft/linking.html#__svg__SVGAElement__relList
GC::Ref<DOM::DOMTokenList> SVGAElement::rel_list()
{

View file

@ -21,6 +21,8 @@ class SVGAElement final
public:
virtual ~SVGAElement() override;
GC::Ref<SVGAnimatedString> target();
GC::Ref<DOM::DOMTokenList> rel_list();
virtual GC::Ptr<Layout::Node> create_layout_node(GC::Ref<CSS::ComputedProperties>) override;
@ -38,6 +40,8 @@ private:
virtual i32 default_tab_index_value() const override;
GC::Ptr<DOM::DOMTokenList> m_rel_list;
GC::Ptr<SVGAnimatedString> m_target;
};
}

View file

@ -6,7 +6,7 @@
[Exposed=Window]
interface SVGAElement : SVGGraphicsElement {
[FIXME, SameObject] readonly attribute SVGAnimatedString target;
[SameObject] readonly attribute SVGAnimatedString target;
[Reflect] attribute DOMString download;
[Reflect] attribute USVString ping;
[Reflect] attribute DOMString rel;

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 1781 tests
934 Pass
847 Fail
940 Pass
841 Fail
Pass idl_test setup
Pass idl_test validation
Pass Partial interface Document: original interface defined
@ -346,10 +346,10 @@ Pass SVGAnimatedString interface: existence and properties of interface prototyp
Pass SVGAnimatedString interface: existence and properties of interface prototype object's @@unscopables property
Pass SVGAnimatedString interface: attribute baseVal
Pass SVGAnimatedString interface: attribute animVal
Fail SVGAnimatedString must be primary interface of objects.a.target
Fail Stringification of objects.a.target
Fail SVGAnimatedString interface: objects.a.target must inherit property "baseVal" with the proper type
Fail SVGAnimatedString interface: objects.a.target must inherit property "animVal" with the proper type
Pass SVGAnimatedString must be primary interface of objects.a.target
Pass Stringification of objects.a.target
Pass SVGAnimatedString interface: objects.a.target must inherit property "baseVal" with the proper type
Pass SVGAnimatedString interface: objects.a.target must inherit property "animVal" with the proper type
Pass SVGAnimatedRect interface: existence and properties of interface object
Pass SVGAnimatedRect interface object length
Pass SVGAnimatedRect interface object name
@ -1552,7 +1552,7 @@ Pass SVGAElement interface object name
Pass SVGAElement interface: existence and properties of interface prototype object
Pass SVGAElement interface: existence and properties of interface prototype object's "constructor" property
Pass SVGAElement interface: existence and properties of interface prototype object's @@unscopables property
Fail SVGAElement interface: attribute target
Pass SVGAElement interface: attribute target
Pass SVGAElement interface: attribute download
Pass SVGAElement interface: attribute ping
Pass SVGAElement interface: attribute rel
@ -1574,7 +1574,7 @@ Fail SVGAElement interface: attribute hash
Pass SVGAElement interface: attribute href
Pass SVGAElement must be primary interface of objects.a
Pass Stringification of objects.a
Fail SVGAElement interface: objects.a must inherit property "target" with the proper type
Pass SVGAElement interface: objects.a must inherit property "target" with the proper type
Pass SVGAElement interface: objects.a must inherit property "download" with the proper type
Pass SVGAElement interface: objects.a must inherit property "ping" with the proper type
Pass SVGAElement interface: objects.a must inherit property "rel" with the proper type