/src/serenity/Userland/Libraries/LibWeb/SVG/SVGStyleElement.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2023, Preston Taylor <PrestonLeeTaylor@proton.me> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibWeb/Bindings/SVGStyleElementPrototype.h> |
8 | | #include <LibWeb/SVG/SVGStyleElement.h> |
9 | | |
10 | | namespace Web::SVG { |
11 | | |
12 | | JS_DEFINE_ALLOCATOR(SVGStyleElement); |
13 | | |
14 | | SVGStyleElement::SVGStyleElement(DOM::Document& document, DOM::QualifiedName qualified_name) |
15 | 0 | : SVGElement(document, move(qualified_name)) |
16 | 0 | { |
17 | 0 | } |
18 | | |
19 | 0 | SVGStyleElement::~SVGStyleElement() = default; |
20 | | |
21 | | void SVGStyleElement::initialize(JS::Realm& realm) |
22 | 0 | { |
23 | 0 | Base::initialize(realm); |
24 | 0 | WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGStyleElement); |
25 | 0 | } |
26 | | |
27 | | void SVGStyleElement::visit_edges(Cell::Visitor& visitor) |
28 | 0 | { |
29 | 0 | Base::visit_edges(visitor); |
30 | 0 | m_style_element_utils.visit_edges(visitor); |
31 | 0 | } |
32 | | |
33 | | void SVGStyleElement::children_changed() |
34 | 0 | { |
35 | 0 | m_style_element_utils.update_a_style_block(*this); |
36 | 0 | Base::children_changed(); |
37 | 0 | } |
38 | | |
39 | | void SVGStyleElement::inserted() |
40 | 0 | { |
41 | 0 | m_style_element_utils.update_a_style_block(*this); |
42 | 0 | Base::inserted(); |
43 | 0 | } |
44 | | |
45 | | void SVGStyleElement::removed_from(Node* old_parent) |
46 | 0 | { |
47 | 0 | m_style_element_utils.update_a_style_block(*this); |
48 | 0 | Base::removed_from(old_parent); |
49 | 0 | } |
50 | | |
51 | | // https://www.w3.org/TR/cssom/#dom-linkstyle-sheet |
52 | | CSS::CSSStyleSheet* SVGStyleElement::sheet() |
53 | 0 | { |
54 | | // The sheet attribute must return the associated CSS style sheet for the node or null if there is no associated CSS style sheet. |
55 | 0 | return m_style_element_utils.sheet(); |
56 | 0 | } |
57 | | |
58 | | // https://www.w3.org/TR/cssom/#dom-linkstyle-sheet |
59 | | CSS::CSSStyleSheet const* SVGStyleElement::sheet() const |
60 | 0 | { |
61 | | // The sheet attribute must return the associated CSS style sheet for the node or null if there is no associated CSS style sheet. |
62 | 0 | return m_style_element_utils.sheet(); |
63 | 0 | } |
64 | | |
65 | | } |