/src/serenity/Userland/Libraries/LibWeb/SVG/SVGTitleElement.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibWeb/Bindings/Intrinsics.h> |
8 | | #include <LibWeb/Bindings/SVGTitleElementPrototype.h> |
9 | | #include <LibWeb/DOM/Document.h> |
10 | | #include <LibWeb/Page/Page.h> |
11 | | #include <LibWeb/SVG/SVGTitleElement.h> |
12 | | |
13 | | namespace Web::SVG { |
14 | | |
15 | | JS_DEFINE_ALLOCATOR(SVGTitleElement); |
16 | | |
17 | | SVGTitleElement::SVGTitleElement(DOM::Document& document, DOM::QualifiedName qualified_name) |
18 | 0 | : SVGElement(document, move(qualified_name)) |
19 | 0 | { |
20 | 0 | } |
21 | | |
22 | | void SVGTitleElement::initialize(JS::Realm& realm) |
23 | 0 | { |
24 | 0 | Base::initialize(realm); |
25 | 0 | WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTitleElement); |
26 | 0 | } |
27 | | |
28 | | JS::GCPtr<Layout::Node> SVGTitleElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties>) |
29 | 0 | { |
30 | 0 | return nullptr; |
31 | 0 | } |
32 | | |
33 | | void SVGTitleElement::children_changed() |
34 | 0 | { |
35 | 0 | Base::children_changed(); |
36 | |
|
37 | 0 | auto& page = document().page(); |
38 | 0 | if (document().browsing_context() != &page.top_level_browsing_context()) |
39 | 0 | return; |
40 | | |
41 | 0 | auto* document_element = document().document_element(); |
42 | |
|
43 | 0 | if (document_element == parent() && is<SVGElement>(document_element)) |
44 | 0 | page.client().page_did_change_title(document().title().to_byte_string()); |
45 | 0 | } |
46 | | |
47 | | } |