2020-07-19 23:01:53 -07:00
|
|
|
/*
|
2021-04-22 16:53:07 -07:00
|
|
|
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
|
2020-07-19 23:01:53 -07:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-07-19 23:01:53 -07:00
|
|
|
*/
|
|
|
|
|
2023-05-21 13:25:03 +02:00
|
|
|
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
2022-09-30 17:16:16 -06:00
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2022-10-08 12:25:01 +02:00
|
|
|
#include <LibWeb/HTML/DOMStringMap.h>
|
2020-07-23 09:44:42 -07:00
|
|
|
#include <LibWeb/SVG/SVGElement.h>
|
2020-07-19 23:01:53 -07:00
|
|
|
|
2020-07-23 09:44:42 -07:00
|
|
|
namespace Web::SVG {
|
2020-07-19 23:01:53 -07:00
|
|
|
|
2022-02-18 21:00:52 +01:00
|
|
|
SVGElement::SVGElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
2021-02-07 11:20:15 +01:00
|
|
|
: Element(document, move(qualified_name))
|
2020-07-23 09:44:42 -07:00
|
|
|
{
|
2023-01-10 06:28:20 -05:00
|
|
|
}
|
|
|
|
|
2023-01-28 12:33:35 -05:00
|
|
|
JS::ThrowCompletionOr<void> SVGElement::initialize(JS::Realm& realm)
|
2023-01-10 06:28:20 -05:00
|
|
|
{
|
2023-01-28 12:33:35 -05:00
|
|
|
MUST_OR_THROW_OOM(Base::initialize(realm));
|
2023-01-10 06:28:20 -05:00
|
|
|
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGElementPrototype>(realm, "SVGElement"));
|
2023-01-28 12:33:35 -05:00
|
|
|
|
2023-05-21 13:25:03 +02:00
|
|
|
m_dataset = TRY(Bindings::throw_dom_exception_if_needed(realm.vm(), [&]() {
|
|
|
|
return HTML::DOMStringMap::create(*this);
|
|
|
|
}));
|
|
|
|
|
2023-01-28 12:33:35 -05:00
|
|
|
return {};
|
2022-08-28 13:42:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void SVGElement::visit_edges(Cell::Visitor& visitor)
|
|
|
|
{
|
|
|
|
Base::visit_edges(visitor);
|
2023-05-21 13:25:03 +02:00
|
|
|
visitor.visit(m_dataset);
|
2020-07-23 09:44:42 -07:00
|
|
|
}
|
2020-07-19 23:01:53 -07:00
|
|
|
|
|
|
|
}
|