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
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2022-07-12 15:07:35 -03:00
|
|
|
#include <LibWeb/Geometry/DOMPoint.h>
|
2020-07-23 13:44:42 -03:00
|
|
|
#include <LibWeb/SVG/SVGGraphicsElement.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-11 09:32:55 -03:00
|
|
|
// https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement
|
2020-07-23 13:44:42 -03:00
|
|
|
class SVGGeometryElement : public SVGGraphicsElement {
|
2022-08-28 08:42:07 -03:00
|
|
|
WEB_PLATFORM_OBJECT(SVGGeometryElement, SVGGraphicsElement);
|
2020-10-02 16:57:28 -03:00
|
|
|
|
2022-08-28 08:42:07 -03:00
|
|
|
public:
|
2024-12-20 12:35:12 -03:00
|
|
|
virtual GC::Ptr<Layout::Node> create_layout_node(GC::Ref<CSS::ComputedProperties>) override;
|
2022-02-11 09:32:55 -03:00
|
|
|
|
2024-08-09 09:00:10 -03:00
|
|
|
virtual Gfx::Path get_path(CSSPixelSize viewport_size) = 0;
|
2022-02-11 09:32:55 -03:00
|
|
|
|
2022-07-12 15:07:35 -03:00
|
|
|
float get_total_length();
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ref<Geometry::DOMPoint> get_point_at_length(float distance);
|
2022-07-12 15:07:35 -03:00
|
|
|
|
2025-07-11 19:45:31 -03:00
|
|
|
GC::Ref<SVGAnimatedNumber> path_length();
|
|
|
|
|
|
2020-07-26 12:47:26 -03:00
|
|
|
protected:
|
2022-02-18 17:00:52 -03:00
|
|
|
SVGGeometryElement(DOM::Document& document, DOM::QualifiedName qualified_name);
|
2023-01-10 08:28:20 -03:00
|
|
|
|
2023-08-07 03:41:28 -03:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2025-07-11 19:45:31 -03:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
GC::Ptr<SVGAnimatedNumber> m_path_length;
|
2020-07-20 03:01:53 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|