/src/serenity/Userland/Libraries/LibWeb/SVG/SVGScriptElement.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2023, Shannon Booth <shannon@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibWeb/SVG/SVGElement.h> |
10 | | #include <LibWeb/SVG/SVGURIReference.h> |
11 | | |
12 | | namespace Web::SVG { |
13 | | |
14 | | // https://www.w3.org/TR/SVG/interact.html#InterfaceSVGScriptElement |
15 | | class SVGScriptElement |
16 | | : public SVGElement |
17 | | , public SVGURIReferenceMixin<SupportsXLinkHref::Yes> { |
18 | | WEB_PLATFORM_OBJECT(SVGScriptElement, SVGElement); |
19 | | JS_DECLARE_ALLOCATOR(SVGScriptElement); |
20 | | |
21 | | public: |
22 | | void process_the_script_element(); |
23 | | |
24 | 0 | void set_source_line_number(Badge<HTML::HTMLParser>, size_t source_line_number) { m_source_line_number = source_line_number; } |
25 | | |
26 | | protected: |
27 | | SVGScriptElement(DOM::Document&, DOM::QualifiedName); |
28 | | |
29 | | virtual void initialize(JS::Realm&) override; |
30 | | |
31 | | private: |
32 | 0 | virtual bool is_svg_script_element() const final { return true; } |
33 | | |
34 | | virtual void visit_edges(Cell::Visitor&) override; |
35 | | |
36 | | bool m_already_processed { false }; |
37 | | |
38 | | JS::GCPtr<HTML::ClassicScript> m_script; |
39 | | |
40 | | size_t m_source_line_number { 1 }; |
41 | | }; |
42 | | |
43 | | } |
44 | | |
45 | | namespace Web::DOM { |
46 | | |
47 | | template<> |
48 | 0 | inline bool Node::fast_is<SVG::SVGScriptElement>() const { return is_svg_script_element(); } |
49 | | |
50 | | } |