2023-05-31 00:50:12 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2023, Preston Taylor <95388976+PrestonLTaylor@users.noreply.github.com>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/SVG/SVGGraphicsElement.h>
|
2024-01-27 16:23:22 +00:00
|
|
|
#include <LibWeb/SVG/SVGViewport.h>
|
2023-05-31 00:50:12 +01:00
|
|
|
|
|
|
|
|
namespace Web::SVG {
|
|
|
|
|
|
2024-01-27 16:23:22 +00:00
|
|
|
class SVGSymbolElement final : public SVGGraphicsElement
|
|
|
|
|
, public SVGViewport {
|
2023-05-31 00:50:12 +01:00
|
|
|
WEB_PLATFORM_OBJECT(SVGSymbolElement, SVGGraphicsElement);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(SVGSymbolElement);
|
2023-05-31 00:50:12 +01:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
virtual ~SVGSymbolElement() override = default;
|
|
|
|
|
|
|
|
|
|
void apply_presentational_hints(CSS::StyleProperties& style) const override;
|
|
|
|
|
|
2024-01-27 16:23:22 +00:00
|
|
|
virtual Optional<ViewBox> view_box() const override { return m_view_box; }
|
|
|
|
|
virtual Optional<PreserveAspectRatio> preserve_aspect_ratio() const override
|
|
|
|
|
{
|
|
|
|
|
// FIXME: Support the `preserveAspectRatio` attribute on <symbol>.
|
|
|
|
|
return {};
|
|
|
|
|
}
|
2023-07-31 18:37:44 +02:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<SVGAnimatedRect> view_box_for_bindings() { return *m_view_box_for_bindings; }
|
2024-07-20 18:32:53 +01:00
|
|
|
|
2023-05-31 00:50:12 +01:00
|
|
|
private:
|
|
|
|
|
SVGSymbolElement(DOM::Document&, DOM::QualifiedName);
|
|
|
|
|
|
2023-08-07 08:41:28 +02:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2024-07-20 18:32:53 +01:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
2023-05-31 00:50:12 +01:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
virtual GC::Ptr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
2023-08-19 19:42:31 +02:00
|
|
|
|
2023-05-31 00:50:12 +01:00
|
|
|
bool is_direct_child_of_use_shadow_tree() const;
|
2023-07-31 18:37:44 +02:00
|
|
|
|
2024-11-14 08:14:16 -05:00
|
|
|
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
|
2023-07-31 18:37:44 +02:00
|
|
|
|
|
|
|
|
Optional<ViewBox> m_view_box;
|
2024-07-20 18:32:53 +01:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<SVGAnimatedRect> m_view_box_for_bindings;
|
2023-05-31 00:50:12 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|