2023-06-08 12:46:44 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2024-04-26 21:09:58 -03:00
|
|
|
#include <LibWeb/Bindings/SVGTitleElementPrototype.h>
|
2023-06-08 12:46:44 -03:00
|
|
|
#include <LibWeb/DOM/Document.h>
|
2023-09-19 14:16:50 -03:00
|
|
|
#include <LibWeb/Page/Page.h>
|
2023-06-08 12:46:44 -03:00
|
|
|
#include <LibWeb/SVG/SVGTitleElement.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::SVG {
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC_DEFINE_ALLOCATOR(SVGTitleElement);
|
2023-11-19 15:47:52 -03:00
|
|
|
|
2023-06-08 12:46:44 -03:00
|
|
|
SVGTitleElement::SVGTitleElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
|
|
|
|
: SVGElement(document, move(qualified_name))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-07 03:41:28 -03:00
|
|
|
void SVGTitleElement::initialize(JS::Realm& realm)
|
2023-06-08 12:46:44 -03:00
|
|
|
{
|
2024-03-16 09:13:08 -03:00
|
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTitleElement);
|
2025-04-20 11:22:57 -03:00
|
|
|
Base::initialize(realm);
|
2023-06-08 12:46:44 -03:00
|
|
|
}
|
|
|
|
|
|
2024-12-20 12:35:12 -03:00
|
|
|
GC::Ptr<Layout::Node> SVGTitleElement::create_layout_node(GC::Ref<CSS::ComputedProperties>)
|
2023-06-08 12:46:44 -03:00
|
|
|
{
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-26 09:16:33 -03:00
|
|
|
void SVGTitleElement::children_changed(ChildrenChangedMetadata const* metadata)
|
2023-06-08 12:46:44 -03:00
|
|
|
{
|
2025-01-26 09:16:33 -03:00
|
|
|
Base::children_changed(metadata);
|
2023-06-08 12:46:44 -03:00
|
|
|
|
2023-12-15 11:41:28 -03:00
|
|
|
auto& page = document().page();
|
|
|
|
|
if (document().browsing_context() != &page.top_level_browsing_context())
|
2023-06-08 12:46:44 -03:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
auto* document_element = document().document_element();
|
|
|
|
|
|
|
|
|
|
if (document_element == parent() && is<SVGElement>(document_element))
|
2025-07-28 17:51:01 -03:00
|
|
|
page.client().page_did_change_title(document().title());
|
2023-06-08 12:46:44 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|