2020-07-20 03:01:53 -03:00
|
|
|
/*
|
2021-04-22 20:53:07 -03:00
|
|
|
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
|
2020-07-20 03:01:53 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-07-20 03:01:53 -03:00
|
|
|
*/
|
|
|
|
|
|
2022-09-25 21:04:39 -03:00
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2024-04-26 21:09:58 -03:00
|
|
|
#include <LibWeb/Bindings/SVGGeometryElementPrototype.h>
|
2022-02-11 09:37:22 -03:00
|
|
|
#include <LibWeb/Layout/SVGGeometryBox.h>
|
2020-07-23 13:44:42 -03:00
|
|
|
#include <LibWeb/SVG/SVGGeometryElement.h>
|
2020-07-20 03:01:53 -03:00
|
|
|
|
2020-07-23 13:44:42 -03:00
|
|
|
namespace Web::SVG {
|
2020-07-20 03:01:53 -03:00
|
|
|
|
2022-02-18 17:00:52 -03:00
|
|
|
SVGGeometryElement::SVGGeometryElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
2021-02-07 07:20:15 -03:00
|
|
|
: SVGGraphicsElement(document, move(qualified_name))
|
2020-07-23 13:44:42 -03:00
|
|
|
{
|
2023-01-10 08:28:20 -03:00
|
|
|
}
|
|
|
|
|
|
2023-08-07 03:41:28 -03:00
|
|
|
void SVGGeometryElement::initialize(JS::Realm& realm)
|
2023-01-10 08:28:20 -03:00
|
|
|
{
|
2024-03-16 09:13:08 -03:00
|
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGGeometryElement);
|
2025-04-20 11:22:57 -03:00
|
|
|
Base::initialize(realm);
|
2020-07-23 13:44:42 -03:00
|
|
|
}
|
2020-07-20 03:01:53 -03:00
|
|
|
|
2025-07-11 19:45:31 -03:00
|
|
|
void SVGGeometryElement::visit_edges(Cell::Visitor& visitor)
|
|
|
|
|
{
|
|
|
|
|
Base::visit_edges(visitor);
|
|
|
|
|
visitor.visit(m_path_length);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-20 12:35:12 -03:00
|
|
|
GC::Ptr<Layout::Node> SVGGeometryElement::create_layout_node(GC::Ref<CSS::ComputedProperties> style)
|
2022-02-11 09:32:55 -03:00
|
|
|
{
|
2024-11-13 14:13:46 -03:00
|
|
|
return heap().allocate<Layout::SVGGeometryBox>(document(), *this, move(style));
|
2022-02-11 09:32:55 -03:00
|
|
|
}
|
|
|
|
|
|
2022-07-12 15:07:35 -03:00
|
|
|
float SVGGeometryElement::get_total_length()
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ref<Geometry::DOMPoint> SVGGeometryElement::get_point_at_length(float distance)
|
2022-07-12 15:07:35 -03:00
|
|
|
{
|
|
|
|
|
(void)distance;
|
2023-08-15 08:16:09 -03:00
|
|
|
return Geometry::DOMPoint::construct_impl(realm(), 0, 0, 0, 0);
|
2022-07-12 15:07:35 -03:00
|
|
|
}
|
|
|
|
|
|
2025-07-11 19:45:31 -03:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-20 03:01:53 -03:00
|
|
|
}
|