/* * Copyright (c) 2020, Matthew Olsson * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include namespace Web::SVG { class SVGElement : public DOM::Element , public HTML::GlobalEventHandlers , public HTML::HTMLOrSVGElement { WEB_PLATFORM_OBJECT(SVGElement, DOM::Element); public: virtual bool requires_svg_container() const override { return true; } GC::Ref class_name(); GC::Ptr owner_svg_element(); GC::Ptr viewport_element(); bool should_include_in_accessibility_tree() const; virtual Optional default_role() const override; virtual bool is_presentational_hint(FlyString const&) const override; virtual void apply_presentational_hints(GC::Ref) const override; protected: SVGElement(DOM::Document&, DOM::QualifiedName); virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; virtual void attribute_changed(FlyString const& name, Optional const& old_value, Optional const& value, Optional const& namespace_) override; virtual WebIDL::ExceptionOr cloned(DOM::Node&, bool) const override; virtual void children_changed(ChildrenChangedMetadata const*) override; virtual void inserted() override; virtual void removed_from(Node* old_parent, Node& old_root) override; void update_use_elements_that_reference_this(); void remove_from_use_element_that_reference_this(); GC::Ref svg_animated_length_for_property(CSS::PropertyID) const; private: // ^HTML::GlobalEventHandlers virtual GC::Ptr global_event_handlers_to_event_target(FlyString const&) override { return *this; } virtual bool is_svg_element() const final { return true; } GC::Ptr m_class_name_animated_string; }; } namespace Web::DOM { template<> inline bool Node::fast_is() const { return is_svg_element(); } }