Skip to content

Truly independent web browser

LibWeb: Add SVGPreserveAspectRatio and SVGAnimatedPreserveAspectRatio

Andreas Kling7d66407b51a8
diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt
index 4110da8ed46..9af59b9bed0 100644
--- a/Libraries/LibWeb/CMakeLists.txt
+++ b/Libraries/LibWeb/CMakeLists.txt
@@ -864,6 +864,7 @@ set(SOURCES
SVG/SVGAnimatedLengthList.cpp
SVG/SVGAnimatedNumber.cpp
SVG/SVGAnimatedNumberList.cpp
+ SVG/SVGAnimatedPreserveAspectRatio.cpp
SVG/SVGAnimatedRect.cpp
SVG/SVGAnimatedString.cpp
SVG/SVGAnimatedTransformList.cpp
@@ -926,6 +927,7 @@ set(SOURCES
SVG/SVGPatternElement.cpp
SVG/SVGPolygonElement.cpp
SVG/SVGPolylineElement.cpp
+ SVG/SVGPreserveAspectRatio.cpp
SVG/SVGRadialGradientElement.cpp
SVG/SVGRectElement.cpp
SVG/SVGScriptElement.cpp
diff --git a/Libraries/LibWeb/SVG/SVGAnimatedPreserveAspectRatio.cpp b/Libraries/LibWeb/SVG/SVGAnimatedPreserveAspectRatio.cpp
new file mode 100644
index 00000000000..3e326e9ba26
--- /dev/null
+++ b/Libraries/LibWeb/SVG/SVGAnimatedPreserveAspectRatio.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibGC/Heap.h>
+#include <LibWeb/SVG/SVGAnimatedPreserveAspectRatio.h>
+
+namespace Web::SVG {
+
+GC_DEFINE_ALLOCATOR(SVGAnimatedPreserveAspectRatio);
+
+// https://svgwg.org/svg2-draft/coords.html#__svg__SVGAnimatedPreserveAspectRatio__baseVal
+GC::Ref<SVGAnimatedPreserveAspectRatio> SVGAnimatedPreserveAspectRatio::create(GC::Ref<SVGElement> element)
+{
+ // On getting baseVal or animVal, an SVGPreserveAspectRatio object is returned that reflects the base value of the
+ // ‘preserveAspectRatio’ attribute on the SVG element that the object with the reflecting IDL attribute of type
+ // SVGAnimatedPreserveAspectRatio was obtained from.
+ auto base_val = SVGPreserveAspectRatio::create(element, SVGPreserveAspectRatio::ReadOnly::No);
+ auto anim_val = SVGPreserveAspectRatio::create(element, SVGPreserveAspectRatio::ReadOnly::Yes);
+ return GC::Heap::the().allocate<SVGAnimatedPreserveAspectRatio>(base_val, anim_val);
+}
+
+SVGAnimatedPreserveAspectRatio::SVGAnimatedPreserveAspectRatio(GC::Ref<SVGPreserveAspectRatio> base_val, GC::Ref<SVGPreserveAspectRatio> anim_val)
+ : m_base_val(base_val)
+ , m_anim_val(anim_val)
+{
+}
+
+SVGAnimatedPreserveAspectRatio::~SVGAnimatedPreserveAspectRatio() = default;
+
+void SVGAnimatedPreserveAspectRatio::visit_edges(Cell::Visitor& visitor)
+{
+ Base::visit_edges(visitor);
+ visitor.visit(m_base_val);
+ visitor.visit(m_anim_val);
+}
+
+}
diff --git a/Libraries/LibWeb/SVG/SVGAnimatedPreserveAspectRatio.h b/Libraries/LibWeb/SVG/SVGAnimatedPreserveAspectRatio.h
new file mode 100644
index 00000000000..19293f3b377
--- /dev/null
+++ b/Libraries/LibWeb/SVG/SVGAnimatedPreserveAspectRatio.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <LibWeb/Bindings/Wrappable.h>
+#include <LibWeb/SVG/SVGPreserveAspectRatio.h>
+
+namespace Web::SVG {
+
+// https://svgwg.org/svg2-draft/coords.html#InterfaceSVGAnimatedPreserveAspectRatio
+class SVGAnimatedPreserveAspectRatio final : public Bindings::GCAllocatedWrappable {
+ WEB_WRAPPABLE(SVGAnimatedPreserveAspectRatio, Bindings::GCAllocatedWrappable);
+ GC_DECLARE_ALLOCATOR(SVGAnimatedPreserveAspectRatio);
+
+public:
+ [[nodiscard]] static GC::Ref<SVGAnimatedPreserveAspectRatio> create(GC::Ref<SVGElement>);
+ virtual ~SVGAnimatedPreserveAspectRatio() override;
+
+ GC::Ref<SVGPreserveAspectRatio> base_val() const { return m_base_val; }
+ GC::Ref<SVGPreserveAspectRatio> anim_val() const { return m_anim_val; }
+
+private:
+ SVGAnimatedPreserveAspectRatio(GC::Ref<SVGPreserveAspectRatio> base_val, GC::Ref<SVGPreserveAspectRatio> anim_val);
+
+ virtual void visit_edges(Cell::Visitor&) override;
+
+ GC::Ref<SVGPreserveAspectRatio> m_base_val;
+ GC::Ref<SVGPreserveAspectRatio> m_anim_val;
+};
+
+}
diff --git a/Libraries/LibWeb/SVG/SVGAnimatedPreserveAspectRatio.idl b/Libraries/LibWeb/SVG/SVGAnimatedPreserveAspectRatio.idl
new file mode 100644
index 00000000000..d405edc60cc
--- /dev/null
+++ b/Libraries/LibWeb/SVG/SVGAnimatedPreserveAspectRatio.idl
@@ -0,0 +1,6 @@
+// https://svgwg.org/svg2-draft/coords.html#InterfaceSVGAnimatedPreserveAspectRatio
+[Exposed=Window]
+interface SVGAnimatedPreserveAspectRatio {
+ [SameObject] readonly attribute SVGPreserveAspectRatio baseVal;
+ [SameObject] readonly attribute SVGPreserveAspectRatio animVal;
+};
diff --git a/Libraries/LibWeb/SVG/SVGFEImageElement.cpp b/Libraries/LibWeb/SVG/SVGFEImageElement.cpp
index 2e92ce3f278..a7066a0b8d9 100644
--- a/Libraries/LibWeb/SVG/SVGFEImageElement.cpp
+++ b/Libraries/LibWeb/SVG/SVGFEImageElement.cpp
@@ -27,6 +27,15 @@ void SVGFEImageElement::visit_edges(Cell::Visitor& visitor)
SVGFilterPrimitiveStandardAttributes::visit_edges(visitor);
SVGURIReferenceMixin::visit_edges(visitor);
visitor.visit(m_resource_request);
+ visitor.visit(m_preserve_aspect_ratio);
+}
+
+// https://drafts.fxtf.org/filter-effects/#dom-svgfeimageelement-preserveaspectratio
+GC::Ref<SVGAnimatedPreserveAspectRatio> SVGFEImageElement::preserve_aspect_ratio_for_bindings()
+{
+ if (!m_preserve_aspect_ratio)
+ m_preserve_aspect_ratio = SVGAnimatedPreserveAspectRatio::create(*this);
+ return *m_preserve_aspect_ratio;
}
void SVGFEImageElement::attribute_changed(Utf16FlyString const& name, Optional<Utf16String> const& old_value, Optional<Utf16String> const& value, Optional<Utf16FlyString> const& namespace_)
diff --git a/Libraries/LibWeb/SVG/SVGFEImageElement.h b/Libraries/LibWeb/SVG/SVGFEImageElement.h
index aea66cb8658..f9131807b17 100644
--- a/Libraries/LibWeb/SVG/SVGFEImageElement.h
+++ b/Libraries/LibWeb/SVG/SVGFEImageElement.h
@@ -8,6 +8,7 @@
#include <AK/Optional.h>
#include <LibWeb/Forward.h>
+#include <LibWeb/SVG/SVGAnimatedPreserveAspectRatio.h>
#include <LibWeb/SVG/SVGElement.h>
#include <LibWeb/SVG/SVGFilterPrimitiveStandardAttributes.h>
#include <LibWeb/SVG/SVGURIReference.h>
@@ -26,6 +27,8 @@ public:
GC::Ptr<HTML::DecodedImageData> image_data() const;
+ GC::Ref<SVGAnimatedPreserveAspectRatio> preserve_aspect_ratio_for_bindings();
+
private:
SVGFEImageElement(DOM::Document&, DOM::QualifiedName);
virtual void visit_edges(Cell::Visitor&) override;
@@ -37,6 +40,7 @@ private:
Optional<URL::URL> m_href;
GC::Ptr<HTML::SharedResourceRequest> m_resource_request;
+ GC::Ptr<SVGAnimatedPreserveAspectRatio> m_preserve_aspect_ratio;
};
};
diff --git a/Libraries/LibWeb/SVG/SVGFEImageElement.idl b/Libraries/LibWeb/SVG/SVGFEImageElement.idl
index 4fe1d6fad9b..8cfc9b7b99c 100644
--- a/Libraries/LibWeb/SVG/SVGFEImageElement.idl
+++ b/Libraries/LibWeb/SVG/SVGFEImageElement.idl
@@ -1,7 +1,7 @@
// https://drafts.csswg.org/filter-effects-1/#feImageElement
[Exposed=Window]
interface SVGFEImageElement : SVGElement {
- [FIXME] readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio;
+ [ImplementedAs=preserve_aspect_ratio_for_bindings] readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio;
[FIXME] readonly attribute SVGAnimatedString crossOrigin;
};
diff --git a/Libraries/LibWeb/SVG/SVGFitToViewBox.cpp b/Libraries/LibWeb/SVG/SVGFitToViewBox.cpp
index 548e7080bab..9e80ef1b4be 100644
--- a/Libraries/LibWeb/SVG/SVGFitToViewBox.cpp
+++ b/Libraries/LibWeb/SVG/SVGFitToViewBox.cpp
@@ -12,14 +12,16 @@
namespace Web::SVG {
-void SVGFitToViewBox::initialize_fit_to_view_box()
+void SVGFitToViewBox::initialize_fit_to_view_box(SVGElement& element)
{
m_view_box_for_bindings = SVGAnimatedRect::create();
+ m_preserve_aspect_ratio_for_bindings = SVGAnimatedPreserveAspectRatio::create(element);
}
void SVGFitToViewBox::visit_edges(JS::Cell::Visitor& visitor)
{
visitor.visit(m_view_box_for_bindings);
+ visitor.visit(m_preserve_aspect_ratio_for_bindings);
}
void SVGFitToViewBox::attribute_changed(DOM::Element& element, Utf16FlyString const& name, Optional<Utf16String> const& value)
diff --git a/Libraries/LibWeb/SVG/SVGFitToViewBox.h b/Libraries/LibWeb/SVG/SVGFitToViewBox.h
index ab515f0ed4e..0030ff3f115 100644
--- a/Libraries/LibWeb/SVG/SVGFitToViewBox.h
+++ b/Libraries/LibWeb/SVG/SVGFitToViewBox.h
@@ -9,6 +9,7 @@
#include <AK/Utf16FlyString.h>
#include <LibJS/Heap/Cell.h>
#include <LibWeb/SVG/AttributeParsing.h>
+#include <LibWeb/SVG/SVGAnimatedPreserveAspectRatio.h>
#include <LibWeb/SVG/SVGAnimatedString.h>
namespace Web::SVG {
@@ -18,11 +19,12 @@ public:
virtual ~SVGFitToViewBox() = default;
GC::Ref<SVGAnimatedRect> view_box_for_bindings() const { return *m_view_box_for_bindings; }
+ GC::Ref<SVGAnimatedPreserveAspectRatio> preserve_aspect_ratio_for_bindings() const { return *m_preserve_aspect_ratio_for_bindings; }
Optional<ViewBox> view_box() const { return m_view_box; }
Optional<PreserveAspectRatio> preserve_aspect_ratio() const { return m_preserve_aspect_ratio; }
protected:
- void initialize_fit_to_view_box();
+ void initialize_fit_to_view_box(SVGElement&);
void visit_edges(JS::Cell::Visitor&);
void attribute_changed(DOM::Element& element, Utf16FlyString const& name, Optional<Utf16String> const& value);
@@ -30,6 +32,7 @@ private:
Optional<ViewBox> m_view_box;
GC::Ptr<SVGAnimatedRect> m_view_box_for_bindings;
Optional<PreserveAspectRatio> m_preserve_aspect_ratio;
+ GC::Ptr<SVGAnimatedPreserveAspectRatio> m_preserve_aspect_ratio_for_bindings;
};
}
diff --git a/Libraries/LibWeb/SVG/SVGFitToViewBox.idl b/Libraries/LibWeb/SVG/SVGFitToViewBox.idl
index c554dfc42ca..8c410869f92 100644
--- a/Libraries/LibWeb/SVG/SVGFitToViewBox.idl
+++ b/Libraries/LibWeb/SVG/SVGFitToViewBox.idl
@@ -1,5 +1,5 @@
// https://svgwg.org/svg2-draft/types.html#InterfaceSVGFitToViewBox
interface mixin SVGFitToViewBox {
[SameObject, ImplementedAs=view_box_for_bindings] readonly attribute SVGAnimatedRect viewBox;
- [FIXME, SameObject] readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio;
+ [SameObject, ImplementedAs=preserve_aspect_ratio_for_bindings] readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio;
};
diff --git a/Libraries/LibWeb/SVG/SVGImageElement.cpp b/Libraries/LibWeb/SVG/SVGImageElement.cpp
index 7681b9ac2f0..a0c2b5e1000 100644
--- a/Libraries/LibWeb/SVG/SVGImageElement.cpp
+++ b/Libraries/LibWeb/SVG/SVGImageElement.cpp
@@ -44,6 +44,15 @@ void SVGImageElement::visit_edges(Cell::Visitor& visitor)
Base::visit_edges(visitor);
SVGURIReferenceMixin::visit_edges(visitor);
visitor.visit(m_resource_request);
+ visitor.visit(m_preserve_aspect_ratio);
+}
+
+// https://svgwg.org/svg2-draft/embedded.html#__svg__SVGImageElement__preserveAspectRatio
+GC::Ref<SVGAnimatedPreserveAspectRatio> SVGImageElement::preserve_aspect_ratio_for_bindings()
+{
+ if (!m_preserve_aspect_ratio)
+ m_preserve_aspect_ratio = SVGAnimatedPreserveAspectRatio::create(*this);
+ return *m_preserve_aspect_ratio;
}
void SVGImageElement::adopted_from(DOM::Document& old_document)
diff --git a/Libraries/LibWeb/SVG/SVGImageElement.h b/Libraries/LibWeb/SVG/SVGImageElement.h
index 4c6fd027aa0..7d457c1f0b0 100644
--- a/Libraries/LibWeb/SVG/SVGImageElement.h
+++ b/Libraries/LibWeb/SVG/SVGImageElement.h
@@ -10,6 +10,7 @@
#include <LibWeb/DOM/DocumentLoadEventDelayer.h>
#include <LibWeb/HTML/DecodedImageData.h>
#include <LibWeb/Layout/ImageProvider.h>
+#include <LibWeb/SVG/SVGAnimatedPreserveAspectRatio.h>
#include <LibWeb/SVG/SVGGraphicsElement.h>
namespace Web::SVG {
@@ -43,6 +44,8 @@ public:
// https://w3c.github.io/svgwg/svg2-draft/embedded.html#__svg__SVGImageElement__height
REFLECT_ANIMATED_LENGTH_ATTRIBUTE(height, Vertical, SVGLengthValue::number(0));
+ GC::Ref<SVGAnimatedPreserveAspectRatio> preserve_aspect_ratio_for_bindings();
+
// ^Layout::ImageProvider
virtual GC::Ptr<HTML::DecodedImageData> decoded_image_data() const override;
@@ -66,6 +69,7 @@ private:
GC::Ptr<HTML::SharedResourceRequest> m_resource_request;
Optional<DOM::DocumentLoadEventDelayer> m_load_event_delayer;
+ GC::Ptr<SVGAnimatedPreserveAspectRatio> m_preserve_aspect_ratio;
};
}
diff --git a/Libraries/LibWeb/SVG/SVGImageElement.idl b/Libraries/LibWeb/SVG/SVGImageElement.idl
index 954c2cd5435..c95533b2c18 100644
--- a/Libraries/LibWeb/SVG/SVGImageElement.idl
+++ b/Libraries/LibWeb/SVG/SVGImageElement.idl
@@ -5,7 +5,7 @@ interface SVGImageElement : SVGGraphicsElement {
[SameObject] readonly attribute SVGAnimatedLength y;
[SameObject] readonly attribute SVGAnimatedLength width;
[SameObject] readonly attribute SVGAnimatedLength height;
- [FIXME, SameObject] readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio;
+ [SameObject, ImplementedAs=preserve_aspect_ratio_for_bindings] readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio;
[Reflect=crossorigin, Enumerated=CORSSettingsAttribute] attribute DOMString? crossOrigin;
};
diff --git a/Libraries/LibWeb/SVG/SVGMarkerElement.cpp b/Libraries/LibWeb/SVG/SVGMarkerElement.cpp
index 90a5856065f..43ccb4b8cf4 100644
--- a/Libraries/LibWeb/SVG/SVGMarkerElement.cpp
+++ b/Libraries/LibWeb/SVG/SVGMarkerElement.cpp
@@ -18,7 +18,7 @@ SVGMarkerElement::SVGMarkerElement(DOM::Document& document, DOM::QualifiedName q
void SVGMarkerElement::initialize_element()
{
- SVGFitToViewBox::initialize_fit_to_view_box();
+ SVGFitToViewBox::initialize_fit_to_view_box(*this);
}
void SVGMarkerElement::visit_edges(Cell::Visitor& visitor)
diff --git a/Libraries/LibWeb/SVG/SVGPatternElement.cpp b/Libraries/LibWeb/SVG/SVGPatternElement.cpp
index 15f1d980037..bd7369c9989 100644
--- a/Libraries/LibWeb/SVG/SVGPatternElement.cpp
+++ b/Libraries/LibWeb/SVG/SVGPatternElement.cpp
@@ -28,7 +28,7 @@ SVGPatternElement::SVGPatternElement(DOM::Document& document, DOM::QualifiedName
void SVGPatternElement::initialize_element()
{
- SVGFitToViewBox::initialize_fit_to_view_box();
+ SVGFitToViewBox::initialize_fit_to_view_box(*this);
}
void SVGPatternElement::visit_edges(Cell::Visitor& visitor)
diff --git a/Libraries/LibWeb/SVG/SVGPreserveAspectRatio.cpp b/Libraries/LibWeb/SVG/SVGPreserveAspectRatio.cpp
new file mode 100644
index 00000000000..8b13dad3cbc
--- /dev/null
+++ b/Libraries/LibWeb/SVG/SVGPreserveAspectRatio.cpp
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <LibGC/Heap.h>
+#include <LibWeb/SVG/AttributeNames.h>
+#include <LibWeb/SVG/SVGElement.h>
+#include <LibWeb/SVG/SVGPreserveAspectRatio.h>
+
+namespace Web::SVG {
+
+GC_DEFINE_ALLOCATOR(SVGPreserveAspectRatio);
+
+static constexpr Array<StringView, 10> align_keywords {
+ "none"sv,
+ "xMinYMin"sv,
+ "xMidYMin"sv,
+ "xMaxYMin"sv,
+ "xMinYMid"sv,
+ "xMidYMid"sv,
+ "xMaxYMid"sv,
+ "xMinYMax"sv,
+ "xMidYMax"sv,
+ "xMaxYMax"sv,
+};
+
+static StringView meet_or_slice_keyword(u16 meet_or_slice)
+{
+ return meet_or_slice == SVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE ? "slice"sv : "meet"sv;
+}
+
+GC::Ref<SVGPreserveAspectRatio> SVGPreserveAspectRatio::create(GC::Ref<SVGElement> element, ReadOnly read_only)
+{
+ return GC::Heap::the().allocate<SVGPreserveAspectRatio>(element, read_only);
+}
+
+SVGPreserveAspectRatio::SVGPreserveAspectRatio(GC::Ref<SVGElement> element, ReadOnly read_only)
+ : m_element(element)
+ , m_read_only(read_only)
+{
+}
+
+SVGPreserveAspectRatio::~SVGPreserveAspectRatio() = default;
+
+void SVGPreserveAspectRatio::visit_edges(Cell::Visitor& visitor)
+{
+ Base::visit_edges(visitor);
+ visitor.visit(m_element);
+}
+
+PreserveAspectRatio SVGPreserveAspectRatio::value() const
+{
+ // NB: An attribute that is not present or invalid takes its initial value, which is "xMidYMid meet".
+ return parse_preserve_aspect_ratio(m_element->get_attribute_value(AttributeNames::preserveAspectRatio)).value_or({});
+}
+
+// https://svgwg.org/svg2-draft/coords.html#__svg__SVGPreserveAspectRatio__align
+u16 SVGPreserveAspectRatio::align() const
+{
+ // 1. Let value reflect the base value of a ‘preserveAspectRatio’ attribute. value is the current non-animated value
+ // of the attribute (using the attribute's initial value if it is not present or invalid).
+ auto value = this->value();
+
+ // 2. Return the constant value as specified in the alignment constant table above for the alignment keyword in
+ // value.
+ return to_underlying(value.align) + SVG_PRESERVEASPECTRATIO_NONE;
+}
+
+// https://svgwg.org/svg2-draft/coords.html#__svg__SVGPreserveAspectRatio__align
+WebIDL::ExceptionOr<void> SVGPreserveAspectRatio::set_align(u16 value)
+{
+ // 1. If the SVGPreserveAspectRatio is read only, then throw a NoModificationAllowedError.
+ if (m_read_only == ReadOnly::Yes)
+ return WebIDL::NoModificationAllowedError::create("Cannot modify a read-only SVGPreserveAspectRatio"_utf16);
+
+ // 2. If value is SVG_PRESERVEASPECTRATIO_UNKNOWN or does not have a corresponding entry in the alignment keyword
+ // table above, then throw a TypeError.
+ if (value == SVG_PRESERVEASPECTRATIO_UNKNOWN || value > SVG_PRESERVEASPECTRATIO_XMAXYMAX)
+ return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid alignment value"_utf16 };
+
+ // 3. Let string be the corresponding keyword in the alignment keyword table above for value.
+ StringBuilder string;
+ string.append(align_keywords[value - SVG_PRESERVEASPECTRATIO_NONE]);
+
+ // 4. Append a single U+0020 SPACE character to string.
+ string.append(' ');
+
+ // 5. Let meet or slice be the value that would be returned from the meetOrSlice member on this
+ // SVGPreserveAspectRatio.
+ auto meet_or_slice = this->meet_or_slice();
+
+ // 6. Append to string the corresponding keyword in the meet-or-slice keyword table above for meet or slice.
+ string.append(meet_or_slice_keyword(meet_or_slice));
+
+ // 7. Set the reflected ‘preserveAspectRatio’ attribute to string.
+ m_element->set_attribute_value(AttributeNames::preserveAspectRatio, Utf16String::from_utf8(string.string_view()));
+ return {};
+}
+
+// https://svgwg.org/svg2-draft/coords.html#__svg__SVGPreserveAspectRatio__meetOrSlice
+u16 SVGPreserveAspectRatio::meet_or_slice() const
+{
+ // 1. Let value be a ‘preserveAspectRatio’ value that reflects the base value of a ‘preserveAspectRatio’ attribute
+ // value is the current non-animated value of the attribute.
+ auto value = this->value();
+
+ // 2. If the meet-or-slice value is not present in value, then return SVG_MEETORSLICE_MEET.
+ // 3. Otherwise, the meet-or-slice value is present. Return the constant value as specified in the meet-or-slice
+ // constant table above for the meet-or-slice keyword in value.
+ // NB: A missing meet-or-slice value parses as meet.
+ return value.meet_or_slice == PreserveAspectRatio::MeetOrSlice::Slice ? SVG_MEETORSLICE_SLICE : SVG_MEETORSLICE_MEET;
+}
+
+// https://svgwg.org/svg2-draft/coords.html#__svg__SVGPreserveAspectRatio__meetOrSlice
+WebIDL::ExceptionOr<void> SVGPreserveAspectRatio::set_meet_or_slice(u16 value)
+{
+ // 1. If the SVGPreserveAspectRatio is read only, then throw a NoModificationAllowedError.
+ if (m_read_only == ReadOnly::Yes)
+ return WebIDL::NoModificationAllowedError::create("Cannot modify a read-only SVGPreserveAspectRatio"_utf16);
+
+ // 2. If value is SVG_MEETORSLICE_UNKNOWN or does not have a corresponding entry in the meet-or-slice keyword table
+ // above, then throw a TypeError.
+ if (value == SVG_MEETORSLICE_UNKNOWN || value > SVG_MEETORSLICE_SLICE)
+ return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid meet-or-slice value"_utf16 };
+
+ // 3. Let align be the value that would be returned from the align member on this SVGPreserveAspectRatio.
+ auto align = this->align();
+
+ // 4. Let string be the corresponding keyword in the alignment keyword table above for align.
+ StringBuilder string;
+ string.append(align_keywords[align - SVG_PRESERVEASPECTRATIO_NONE]);
+
+ // 5. Append a single U+0020 SPACE character to string.
+ string.append(' ');
+
+ // 6. Append to string the corresponding keyword in the meet-or-slice keyword table above for value.
+ string.append(meet_or_slice_keyword(value));
+
+ // 7. Set the reflected ‘preserveAspectRatio’ attribute to string.
+ m_element->set_attribute_value(AttributeNames::preserveAspectRatio, Utf16String::from_utf8(string.string_view()));
+ return {};
+}
+
+}
diff --git a/Libraries/LibWeb/SVG/SVGPreserveAspectRatio.h b/Libraries/LibWeb/SVG/SVGPreserveAspectRatio.h
new file mode 100644
index 00000000000..975c9535bbd
--- /dev/null
+++ b/Libraries/LibWeb/SVG/SVGPreserveAspectRatio.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <LibWeb/Bindings/Wrappable.h>
+#include <LibWeb/Forward.h>
+#include <LibWeb/SVG/AttributeParsing.h>
+#include <LibWeb/WebIDL/ExceptionOr.h>
+
+namespace Web::SVG {
+
+// https://svgwg.org/svg2-draft/coords.html#InterfaceSVGPreserveAspectRatio
+class SVGPreserveAspectRatio final : public Bindings::GCAllocatedWrappable {
+ WEB_WRAPPABLE(SVGPreserveAspectRatio, Bindings::GCAllocatedWrappable);
+ GC_DECLARE_ALLOCATOR(SVGPreserveAspectRatio);
+
+public:
+ static constexpr u16 SVG_PRESERVEASPECTRATIO_UNKNOWN = 0;
+ static constexpr u16 SVG_PRESERVEASPECTRATIO_NONE = 1;
+ static constexpr u16 SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10;
+
+ static constexpr u16 SVG_MEETORSLICE_UNKNOWN = 0;
+ static constexpr u16 SVG_MEETORSLICE_MEET = 1;
+ static constexpr u16 SVG_MEETORSLICE_SLICE = 2;
+
+ enum class ReadOnly : u8 {
+ Yes,
+ No,
+ };
+
+ [[nodiscard]] static GC::Ref<SVGPreserveAspectRatio> create(GC::Ref<SVGElement>, ReadOnly);
+ virtual ~SVGPreserveAspectRatio() override;
+
+ u16 align() const;
+ WebIDL::ExceptionOr<void> set_align(u16);
+
+ u16 meet_or_slice() const;
+ WebIDL::ExceptionOr<void> set_meet_or_slice(u16);
+
+private:
+ SVGPreserveAspectRatio(GC::Ref<SVGElement>, ReadOnly);
+
+ virtual void visit_edges(Cell::Visitor&) override;
+
+ PreserveAspectRatio value() const;
+
+ GC::Ref<SVGElement> m_element;
+ ReadOnly m_read_only;
+};
+
+}
diff --git a/Libraries/LibWeb/SVG/SVGPreserveAspectRatio.idl b/Libraries/LibWeb/SVG/SVGPreserveAspectRatio.idl
new file mode 100644
index 00000000000..496c30e18bb
--- /dev/null
+++ b/Libraries/LibWeb/SVG/SVGPreserveAspectRatio.idl
@@ -0,0 +1,25 @@
+// https://svgwg.org/svg2-draft/coords.html#InterfaceSVGPreserveAspectRatio
+[Exposed=Window]
+interface SVGPreserveAspectRatio {
+
+ // Alignment Types
+ const unsigned short SVG_PRESERVEASPECTRATIO_UNKNOWN = 0;
+ const unsigned short SVG_PRESERVEASPECTRATIO_NONE = 1;
+ const unsigned short SVG_PRESERVEASPECTRATIO_XMINYMIN = 2;
+ const unsigned short SVG_PRESERVEASPECTRATIO_XMIDYMIN = 3;
+ const unsigned short SVG_PRESERVEASPECTRATIO_XMAXYMIN = 4;
+ const unsigned short SVG_PRESERVEASPECTRATIO_XMINYMID = 5;
+ const unsigned short SVG_PRESERVEASPECTRATIO_XMIDYMID = 6;
+ const unsigned short SVG_PRESERVEASPECTRATIO_XMAXYMID = 7;
+ const unsigned short SVG_PRESERVEASPECTRATIO_XMINYMAX = 8;
+ const unsigned short SVG_PRESERVEASPECTRATIO_XMIDYMAX = 9;
+ const unsigned short SVG_PRESERVEASPECTRATIO_XMAXYMAX = 10;
+
+ // Meet-or-slice Types
+ const unsigned short SVG_MEETORSLICE_UNKNOWN = 0;
+ const unsigned short SVG_MEETORSLICE_MEET = 1;
+ const unsigned short SVG_MEETORSLICE_SLICE = 2;
+
+ attribute unsigned short align;
+ attribute unsigned short meetOrSlice;
+};
diff --git a/Libraries/LibWeb/SVG/SVGSVGElement.cpp b/Libraries/LibWeb/SVG/SVGSVGElement.cpp
index 83c786d2d9a..a37c83ac879 100644
--- a/Libraries/LibWeb/SVG/SVGSVGElement.cpp
+++ b/Libraries/LibWeb/SVG/SVGSVGElement.cpp
@@ -36,7 +36,7 @@ SVGSVGElement::SVGSVGElement(DOM::Document& document, DOM::QualifiedName qualifi
void SVGSVGElement::initialize_element()
{
- SVGFitToViewBox::initialize_fit_to_view_box();
+ SVGFitToViewBox::initialize_fit_to_view_box(*this);
}
void SVGSVGElement::visit_edges(Visitor& visitor)
diff --git a/Libraries/LibWeb/SVG/SVGSymbolElement.cpp b/Libraries/LibWeb/SVG/SVGSymbolElement.cpp
index 4123d100f83..dcb1e4d68d0 100644
--- a/Libraries/LibWeb/SVG/SVGSymbolElement.cpp
+++ b/Libraries/LibWeb/SVG/SVGSymbolElement.cpp
@@ -22,7 +22,7 @@ SVGSymbolElement::SVGSymbolElement(DOM::Document& document, DOM::QualifiedName q
void SVGSymbolElement::initialize_element()
{
- SVGFitToViewBox::initialize_fit_to_view_box();
+ SVGFitToViewBox::initialize_fit_to_view_box(*this);
}
void SVGSymbolElement::visit_edges(Cell::Visitor& visitor)
diff --git a/Libraries/LibWeb/SVG/SVGViewElement.cpp b/Libraries/LibWeb/SVG/SVGViewElement.cpp
index 385102b67a2..682fc02a60e 100644
--- a/Libraries/LibWeb/SVG/SVGViewElement.cpp
+++ b/Libraries/LibWeb/SVG/SVGViewElement.cpp
@@ -22,7 +22,7 @@ SVGViewElement::SVGViewElement(DOM::Document& document, DOM::QualifiedName quali
void SVGViewElement::initialize_element()
{
- SVGFitToViewBox::initialize_fit_to_view_box();
+ SVGFitToViewBox::initialize_fit_to_view_box(*this);
}
void SVGViewElement::visit_edges(Visitor& visitor)
diff --git a/Libraries/LibWeb/idl_files.cmake b/Libraries/LibWeb/idl_files.cmake
index 8ff445f9d22..5cf32f50193 100644
--- a/Libraries/LibWeb/idl_files.cmake
+++ b/Libraries/LibWeb/idl_files.cmake
@@ -502,6 +502,7 @@ libweb_js_bindings(SVG/SVGAnimatedLength)
libweb_js_bindings(SVG/SVGAnimatedLengthList)
libweb_js_bindings(SVG/SVGAnimatedNumber)
libweb_js_bindings(SVG/SVGAnimatedNumberList)
+libweb_js_bindings(SVG/SVGAnimatedPreserveAspectRatio)
libweb_js_bindings(SVG/SVGAnimatedRect)
libweb_js_bindings(SVG/SVGAnimatedString)
libweb_js_bindings(SVG/SVGAnimatedTransformList)
@@ -561,6 +562,7 @@ libweb_js_bindings(SVG/SVGPathElement)
libweb_js_bindings(SVG/SVGPatternElement)
libweb_js_bindings(SVG/SVGPolygonElement)
libweb_js_bindings(SVG/SVGPolylineElement)
+libweb_js_bindings(SVG/SVGPreserveAspectRatio)
libweb_js_bindings(SVG/SVGRadialGradientElement)
libweb_js_bindings(SVG/SVGRectElement)
libweb_js_bindings(SVG/SVGScriptElement)
diff --git a/Tests/LibWeb/Text/expected/all-window-properties.txt b/Tests/LibWeb/Text/expected/all-window-properties.txt
index da57430b598..eb4820f77ef 100644
--- a/Tests/LibWeb/Text/expected/all-window-properties.txt
+++ b/Tests/LibWeb/Text/expected/all-window-properties.txt
@@ -411,6 +411,7 @@ SVGAnimatedLength
SVGAnimatedLengthList
SVGAnimatedNumber
SVGAnimatedNumberList
+SVGAnimatedPreserveAspectRatio
SVGAnimatedRect
SVGAnimatedString
SVGAnimatedTransformList
@@ -469,6 +470,7 @@ SVGPatternElement
SVGPoint
SVGPolygonElement
SVGPolylineElement
+SVGPreserveAspectRatio
SVGRadialGradientElement
SVGRect
SVGRectElement
diff --git a/Tests/LibWeb/Text/expected/wpt-import/svg/idlharness.window.txt b/Tests/LibWeb/Text/expected/wpt-import/svg/idlharness.window.txt
index 4b491997c01..615c7023ba8 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/svg/idlharness.window.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/svg/idlharness.window.txt
@@ -2,8 +2,8 @@ Harness status: OK
Found 1780 tests
-1322 Pass
-458 Fail
+1400 Pass
+380 Fail
Pass idl_test setup
Pass idl_test validation
Pass Partial interface Document: original interface defined
@@ -436,7 +436,7 @@ Pass SVGSVGElement interface: operation animationsPaused()
Pass SVGSVGElement interface: operation getCurrentTime()
Pass SVGSVGElement interface: operation setCurrentTime(float)
Pass SVGSVGElement interface: attribute viewBox
-Fail SVGSVGElement interface: attribute preserveAspectRatio
+Pass SVGSVGElement interface: attribute preserveAspectRatio
Pass SVGSVGElement must be primary interface of objects.svg
Pass Stringification of objects.svg
Pass SVGSVGElement interface: objects.svg must inherit property "x" with the proper type
@@ -478,7 +478,7 @@ Pass SVGSVGElement interface: objects.svg must inherit property "getCurrentTime(
Pass SVGSVGElement interface: objects.svg must inherit property "setCurrentTime(float)" with the proper type
Pass SVGSVGElement interface: calling setCurrentTime(float) on objects.svg with too few arguments must throw TypeError
Pass SVGSVGElement interface: objects.svg must inherit property "viewBox" with the proper type
-Fail SVGSVGElement interface: objects.svg must inherit property "preserveAspectRatio" with the proper type
+Pass SVGSVGElement interface: objects.svg must inherit property "preserveAspectRatio" with the proper type
Pass SVGGraphicsElement interface: objects.svg must inherit property "transform" with the proper type
Pass SVGGraphicsElement interface: objects.svg must inherit property "getBBox(optional SVGBoundingBoxOptions)" with the proper type
Pass SVGGraphicsElement interface: calling getBBox(optional SVGBoundingBoxOptions) on objects.svg with too few arguments must throw TypeError
@@ -577,11 +577,11 @@ Pass SVGSymbolElement interface: existence and properties of interface prototype
Pass SVGSymbolElement interface: existence and properties of interface prototype object's "constructor" property
Pass SVGSymbolElement interface: existence and properties of interface prototype object's @@unscopables property
Pass SVGSymbolElement interface: attribute viewBox
-Fail SVGSymbolElement interface: attribute preserveAspectRatio
+Pass SVGSymbolElement interface: attribute preserveAspectRatio
Pass SVGSymbolElement must be primary interface of objects.symbol
Pass Stringification of objects.symbol
Pass SVGSymbolElement interface: objects.symbol must inherit property "viewBox" with the proper type
-Fail SVGSymbolElement interface: objects.symbol must inherit property "preserveAspectRatio" with the proper type
+Pass SVGSymbolElement interface: objects.symbol must inherit property "preserveAspectRatio" with the proper type
Pass SVGGraphicsElement interface: objects.symbol must inherit property "transform" with the proper type
Pass SVGGraphicsElement interface: objects.symbol must inherit property "getBBox(optional SVGBoundingBoxOptions)" with the proper type
Pass SVGGraphicsElement interface: calling getBBox(optional SVGBoundingBoxOptions) on objects.symbol with too few arguments must throw TypeError
@@ -784,72 +784,72 @@ Fail SVGAnimatedTransformList must be primary interface of objects.pattern.patte
Fail Stringification of objects.pattern.patternTransform
Fail SVGAnimatedTransformList interface: objects.pattern.patternTransform must inherit property "baseVal" with the proper type
Fail SVGAnimatedTransformList interface: objects.pattern.patternTransform must inherit property "animVal" with the proper type
-Fail SVGPreserveAspectRatio interface: existence and properties of interface object
-Fail SVGPreserveAspectRatio interface object length
-Fail SVGPreserveAspectRatio interface object name
-Fail SVGPreserveAspectRatio interface: existence and properties of interface prototype object
-Fail SVGPreserveAspectRatio interface: existence and properties of interface prototype object's "constructor" property
-Fail SVGPreserveAspectRatio interface: existence and properties of interface prototype object's @@unscopables property
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_UNKNOWN on interface object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_UNKNOWN on interface prototype object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_NONE on interface object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_NONE on interface prototype object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMINYMIN on interface object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMINYMIN on interface prototype object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMIDYMIN on interface object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMIDYMIN on interface prototype object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMAXYMIN on interface object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMAXYMIN on interface prototype object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMINYMID on interface object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMINYMID on interface prototype object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMIDYMID on interface object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMIDYMID on interface prototype object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMAXYMID on interface object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMAXYMID on interface prototype object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMINYMAX on interface object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMINYMAX on interface prototype object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMIDYMAX on interface object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMIDYMAX on interface prototype object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMAXYMAX on interface object
-Fail SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMAXYMAX on interface prototype object
-Fail SVGPreserveAspectRatio interface: constant SVG_MEETORSLICE_UNKNOWN on interface object
-Fail SVGPreserveAspectRatio interface: constant SVG_MEETORSLICE_UNKNOWN on interface prototype object
-Fail SVGPreserveAspectRatio interface: constant SVG_MEETORSLICE_MEET on interface object
-Fail SVGPreserveAspectRatio interface: constant SVG_MEETORSLICE_MEET on interface prototype object
-Fail SVGPreserveAspectRatio interface: constant SVG_MEETORSLICE_SLICE on interface object
-Fail SVGPreserveAspectRatio interface: constant SVG_MEETORSLICE_SLICE on interface prototype object
-Fail SVGPreserveAspectRatio interface: attribute align
-Fail SVGPreserveAspectRatio interface: attribute meetOrSlice
-Fail SVGPreserveAspectRatio must be primary interface of objects.image.preserveAspectRatio.baseVal
-Fail Stringification of objects.image.preserveAspectRatio.baseVal
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_UNKNOWN" with the proper type
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_NONE" with the proper type
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMINYMIN" with the proper type
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMIDYMIN" with the proper type
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMAXYMIN" with the proper type
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMINYMID" with the proper type
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMIDYMID" with the proper type
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMAXYMID" with the proper type
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMINYMAX" with the proper type
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMIDYMAX" with the proper type
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMAXYMAX" with the proper type
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_MEETORSLICE_UNKNOWN" with the proper type
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_MEETORSLICE_MEET" with the proper type
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_MEETORSLICE_SLICE" with the proper type
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "align" with the proper type
-Fail SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "meetOrSlice" with the proper type
-Fail SVGAnimatedPreserveAspectRatio interface: existence and properties of interface object
-Fail SVGAnimatedPreserveAspectRatio interface object length
-Fail SVGAnimatedPreserveAspectRatio interface object name
-Fail SVGAnimatedPreserveAspectRatio interface: existence and properties of interface prototype object
-Fail SVGAnimatedPreserveAspectRatio interface: existence and properties of interface prototype object's "constructor" property
-Fail SVGAnimatedPreserveAspectRatio interface: existence and properties of interface prototype object's @@unscopables property
-Fail SVGAnimatedPreserveAspectRatio interface: attribute baseVal
-Fail SVGAnimatedPreserveAspectRatio interface: attribute animVal
-Fail SVGAnimatedPreserveAspectRatio must be primary interface of objects.image.preserveAspectRatio
-Fail Stringification of objects.image.preserveAspectRatio
-Fail SVGAnimatedPreserveAspectRatio interface: objects.image.preserveAspectRatio must inherit property "baseVal" with the proper type
-Fail SVGAnimatedPreserveAspectRatio interface: objects.image.preserveAspectRatio must inherit property "animVal" with the proper type
+Pass SVGPreserveAspectRatio interface: existence and properties of interface object
+Pass SVGPreserveAspectRatio interface object length
+Pass SVGPreserveAspectRatio interface object name
+Pass SVGPreserveAspectRatio interface: existence and properties of interface prototype object
+Pass SVGPreserveAspectRatio interface: existence and properties of interface prototype object's "constructor" property
+Pass SVGPreserveAspectRatio interface: existence and properties of interface prototype object's @@unscopables property
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_UNKNOWN on interface object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_UNKNOWN on interface prototype object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_NONE on interface object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_NONE on interface prototype object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMINYMIN on interface object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMINYMIN on interface prototype object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMIDYMIN on interface object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMIDYMIN on interface prototype object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMAXYMIN on interface object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMAXYMIN on interface prototype object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMINYMID on interface object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMINYMID on interface prototype object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMIDYMID on interface object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMIDYMID on interface prototype object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMAXYMID on interface object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMAXYMID on interface prototype object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMINYMAX on interface object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMINYMAX on interface prototype object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMIDYMAX on interface object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMIDYMAX on interface prototype object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMAXYMAX on interface object
+Pass SVGPreserveAspectRatio interface: constant SVG_PRESERVEASPECTRATIO_XMAXYMAX on interface prototype object
+Pass SVGPreserveAspectRatio interface: constant SVG_MEETORSLICE_UNKNOWN on interface object
+Pass SVGPreserveAspectRatio interface: constant SVG_MEETORSLICE_UNKNOWN on interface prototype object
+Pass SVGPreserveAspectRatio interface: constant SVG_MEETORSLICE_MEET on interface object
+Pass SVGPreserveAspectRatio interface: constant SVG_MEETORSLICE_MEET on interface prototype object
+Pass SVGPreserveAspectRatio interface: constant SVG_MEETORSLICE_SLICE on interface object
+Pass SVGPreserveAspectRatio interface: constant SVG_MEETORSLICE_SLICE on interface prototype object
+Pass SVGPreserveAspectRatio interface: attribute align
+Pass SVGPreserveAspectRatio interface: attribute meetOrSlice
+Pass SVGPreserveAspectRatio must be primary interface of objects.image.preserveAspectRatio.baseVal
+Pass Stringification of objects.image.preserveAspectRatio.baseVal
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_UNKNOWN" with the proper type
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_NONE" with the proper type
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMINYMIN" with the proper type
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMIDYMIN" with the proper type
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMAXYMIN" with the proper type
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMINYMID" with the proper type
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMIDYMID" with the proper type
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMAXYMID" with the proper type
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMINYMAX" with the proper type
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMIDYMAX" with the proper type
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_PRESERVEASPECTRATIO_XMAXYMAX" with the proper type
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_MEETORSLICE_UNKNOWN" with the proper type
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_MEETORSLICE_MEET" with the proper type
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "SVG_MEETORSLICE_SLICE" with the proper type
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "align" with the proper type
+Pass SVGPreserveAspectRatio interface: objects.image.preserveAspectRatio.baseVal must inherit property "meetOrSlice" with the proper type
+Pass SVGAnimatedPreserveAspectRatio interface: existence and properties of interface object
+Pass SVGAnimatedPreserveAspectRatio interface object length
+Pass SVGAnimatedPreserveAspectRatio interface object name
+Pass SVGAnimatedPreserveAspectRatio interface: existence and properties of interface prototype object
+Pass SVGAnimatedPreserveAspectRatio interface: existence and properties of interface prototype object's "constructor" property
+Pass SVGAnimatedPreserveAspectRatio interface: existence and properties of interface prototype object's @@unscopables property
+Pass SVGAnimatedPreserveAspectRatio interface: attribute baseVal
+Pass SVGAnimatedPreserveAspectRatio interface: attribute animVal
+Pass SVGAnimatedPreserveAspectRatio must be primary interface of objects.image.preserveAspectRatio
+Pass Stringification of objects.image.preserveAspectRatio
+Pass SVGAnimatedPreserveAspectRatio interface: objects.image.preserveAspectRatio must inherit property "baseVal" with the proper type
+Pass SVGAnimatedPreserveAspectRatio interface: objects.image.preserveAspectRatio must inherit property "animVal" with the proper type
Pass SVGRectElement interface: existence and properties of interface object
Pass SVGRectElement interface object length
Pass SVGRectElement interface object name
@@ -1295,7 +1295,7 @@ Pass SVGImageElement interface: attribute x
Pass SVGImageElement interface: attribute y
Pass SVGImageElement interface: attribute width
Pass SVGImageElement interface: attribute height
-Fail SVGImageElement interface: attribute preserveAspectRatio
+Pass SVGImageElement interface: attribute preserveAspectRatio
Pass SVGImageElement interface: attribute crossOrigin
Pass SVGImageElement interface: attribute href
Pass SVGImageElement must be primary interface of objects.image
@@ -1304,7 +1304,7 @@ Pass SVGImageElement interface: objects.image must inherit property "x" with the
Pass SVGImageElement interface: objects.image must inherit property "y" with the proper type
Pass SVGImageElement interface: objects.image must inherit property "width" with the proper type
Pass SVGImageElement interface: objects.image must inherit property "height" with the proper type
-Fail SVGImageElement interface: objects.image must inherit property "preserveAspectRatio" with the proper type
+Pass SVGImageElement interface: objects.image must inherit property "preserveAspectRatio" with the proper type
Pass SVGImageElement interface: objects.image must inherit property "crossOrigin" with the proper type
Pass SVGImageElement interface: objects.image must inherit property "href" with the proper type
Pass SVGGraphicsElement interface: objects.image must inherit property "transform" with the proper type
@@ -1378,7 +1378,7 @@ Pass SVGMarkerElement interface: attribute orient
Pass SVGMarkerElement interface: operation setOrientToAuto()
Pass SVGMarkerElement interface: operation setOrientToAngle(SVGAngle)
Pass SVGMarkerElement interface: attribute viewBox
-Fail SVGMarkerElement interface: attribute preserveAspectRatio
+Pass SVGMarkerElement interface: attribute preserveAspectRatio
Pass SVGMarkerElement must be primary interface of objects.marker
Pass Stringification of objects.marker
Pass SVGMarkerElement interface: objects.marker must inherit property "SVG_MARKERUNITS_UNKNOWN" with the proper type
@@ -1400,7 +1400,7 @@ Pass SVGMarkerElement interface: objects.marker must inherit property "setOrient
Pass SVGMarkerElement interface: objects.marker must inherit property "setOrientToAngle(SVGAngle)" with the proper type
Pass SVGMarkerElement interface: calling setOrientToAngle(SVGAngle) on objects.marker with too few arguments must throw TypeError
Pass SVGMarkerElement interface: objects.marker must inherit property "viewBox" with the proper type
-Fail SVGMarkerElement interface: objects.marker must inherit property "preserveAspectRatio" with the proper type
+Pass SVGMarkerElement interface: objects.marker must inherit property "preserveAspectRatio" with the proper type
Pass SVGElement interface: objects.marker must inherit property "className" with the proper type
Pass SVGElement interface: objects.marker must inherit property "ownerSVGElement" with the proper type
Pass SVGElement interface: objects.marker must inherit property "viewportElement" with the proper type
@@ -1515,7 +1515,7 @@ Pass SVGPatternElement interface: attribute y
Pass SVGPatternElement interface: attribute width
Pass SVGPatternElement interface: attribute height
Pass SVGPatternElement interface: attribute viewBox
-Fail SVGPatternElement interface: attribute preserveAspectRatio
+Pass SVGPatternElement interface: attribute preserveAspectRatio
Pass SVGPatternElement interface: attribute href
Pass SVGPatternElement must be primary interface of objects.pattern
Pass Stringification of objects.pattern
@@ -1527,7 +1527,7 @@ Pass SVGPatternElement interface: objects.pattern must inherit property "y" with
Pass SVGPatternElement interface: objects.pattern must inherit property "width" with the proper type
Pass SVGPatternElement interface: objects.pattern must inherit property "height" with the proper type
Pass SVGPatternElement interface: objects.pattern must inherit property "viewBox" with the proper type
-Fail SVGPatternElement interface: objects.pattern must inherit property "preserveAspectRatio" with the proper type
+Pass SVGPatternElement interface: objects.pattern must inherit property "preserveAspectRatio" with the proper type
Pass SVGPatternElement interface: objects.pattern must inherit property "href" with the proper type
Pass SVGElement interface: objects.pattern must inherit property "className" with the proper type
Pass SVGElement interface: objects.pattern must inherit property "ownerSVGElement" with the proper type
@@ -1618,11 +1618,11 @@ Pass SVGViewElement interface: existence and properties of interface prototype o
Pass SVGViewElement interface: existence and properties of interface prototype object's "constructor" property
Pass SVGViewElement interface: existence and properties of interface prototype object's @@unscopables property
Pass SVGViewElement interface: attribute viewBox
-Fail SVGViewElement interface: attribute preserveAspectRatio
+Pass SVGViewElement interface: attribute preserveAspectRatio
Pass SVGViewElement must be primary interface of objects.view
Pass Stringification of objects.view
Pass SVGViewElement interface: objects.view must inherit property "viewBox" with the proper type
-Fail SVGViewElement interface: objects.view must inherit property "preserveAspectRatio" with the proper type
+Pass SVGViewElement interface: objects.view must inherit property "preserveAspectRatio" with the proper type
Pass SVGElement interface: objects.view must inherit property "className" with the proper type
Pass SVGElement interface: objects.view must inherit property "ownerSVGElement" with the proper type
Pass SVGElement interface: objects.view must inherit property "viewportElement" with the proper type