summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-03-22 16:37:16 +0000
committerAndreas Kling <kling@serenityos.org>2022-03-22 22:33:17 +0100
commit1a3d6c68ef4978e3e471a8592a1f45f46bcd4f90 (patch)
tree6177c5b720379ec378e7998084d5a2c052dbee5f /Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp
parentb51ea3a67c640a564740438ceb19f9c7e0bb516e (diff)
downloadserenity-1a3d6c68ef4978e3e471a8592a1f45f46bcd4f90.zip
LibWeb: Expose SVGCircleElement attributes to JS
Diffstat (limited to 'Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp')
-rw-r--r--Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp
index 5516d78e71..265d362541 100644
--- a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp
+++ b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp
@@ -70,4 +70,34 @@ Gfx::Path& SVGCircleElement::get_path()
return m_path.value();
}
+// https://www.w3.org/TR/SVG11/shapes.html#CircleElementCXAttribute
+NonnullRefPtr<SVGAnimatedLength> SVGCircleElement::cx() const
+{
+ // FIXME: Populate the unit type when it is parsed (0 here is "unknown").
+ // FIXME: Create a proper animated value when animations are supported.
+ auto base_length = SVGLength::create(0, m_center_x.value_or(0));
+ auto anim_length = SVGLength::create(0, m_center_x.value_or(0));
+ return SVGAnimatedLength::create(move(base_length), move(anim_length));
+}
+
+// https://www.w3.org/TR/SVG11/shapes.html#CircleElementCYAttribute
+NonnullRefPtr<SVGAnimatedLength> SVGCircleElement::cy() const
+{
+ // FIXME: Populate the unit type when it is parsed (0 here is "unknown").
+ // FIXME: Create a proper animated value when animations are supported.
+ auto base_length = SVGLength::create(0, m_center_y.value_or(0));
+ auto anim_length = SVGLength::create(0, m_center_y.value_or(0));
+ return SVGAnimatedLength::create(move(base_length), move(anim_length));
+}
+
+// https://www.w3.org/TR/SVG11/shapes.html#CircleElementRAttribute
+NonnullRefPtr<SVGAnimatedLength> SVGCircleElement::r() const
+{
+ // FIXME: Populate the unit type when it is parsed (0 here is "unknown").
+ // FIXME: Create a proper animated value when animations are supported.
+ auto base_length = SVGLength::create(0, m_radius.value_or(0));
+ auto anim_length = SVGLength::create(0, m_radius.value_or(0));
+ return SVGAnimatedLength::create(move(base_length), move(anim_length));
+}
+
}