2022-11-10 13:49:26 +01:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
2022-11-10 13:49:26 +01:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2023-02-15 08:43:44 +01:00
|
|
|
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
2022-11-10 13:49:26 +01:00
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2024-04-27 12:09:58 +12:00
|
|
|
#include <LibWeb/Bindings/SVGForeignObjectElementPrototype.h>
|
2023-03-19 15:44:12 +01:00
|
|
|
#include <LibWeb/CSS/Parser/Parser.h>
|
2022-11-10 13:49:26 +01:00
|
|
|
#include <LibWeb/Layout/BlockContainer.h>
|
2024-04-25 20:21:12 +02:00
|
|
|
#include <LibWeb/Layout/SVGForeignObjectBox.h>
|
2022-11-10 13:49:26 +01:00
|
|
|
#include <LibWeb/SVG/AttributeNames.h>
|
|
|
|
|
#include <LibWeb/SVG/SVGAnimatedLength.h>
|
|
|
|
|
#include <LibWeb/SVG/SVGForeignObjectElement.h>
|
|
|
|
|
#include <LibWeb/SVG/SVGLength.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::SVG {
|
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DEFINE_ALLOCATOR(SVGForeignObjectElement);
|
2023-11-19 19:47:52 +01:00
|
|
|
|
2022-11-10 13:49:26 +01:00
|
|
|
SVGForeignObjectElement::SVGForeignObjectElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
|
|
|
|
: SVGGraphicsElement(document, move(qualified_name))
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SVGForeignObjectElement::~SVGForeignObjectElement() = default;
|
|
|
|
|
|
2023-08-07 08:41:28 +02:00
|
|
|
void SVGForeignObjectElement::initialize(JS::Realm& realm)
|
2022-11-10 13:49:26 +01:00
|
|
|
{
|
2024-03-16 13:13:08 +01:00
|
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGForeignObjectElement);
|
2025-04-20 16:22:57 +02:00
|
|
|
Base::initialize(realm);
|
2022-11-10 13:49:26 +01:00
|
|
|
|
|
|
|
|
// FIXME: These never actually get updated!
|
2025-08-26 16:51:46 +02:00
|
|
|
m_x = fake_animated_length_fixme();
|
|
|
|
|
m_y = fake_animated_length_fixme();
|
|
|
|
|
m_width = fake_animated_length_fixme();
|
|
|
|
|
m_height = fake_animated_length_fixme();
|
2022-11-10 13:49:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SVGForeignObjectElement::visit_edges(Cell::Visitor& visitor)
|
|
|
|
|
{
|
|
|
|
|
Base::visit_edges(visitor);
|
|
|
|
|
visitor.visit(m_x);
|
|
|
|
|
visitor.visit(m_y);
|
|
|
|
|
visitor.visit(m_width);
|
|
|
|
|
visitor.visit(m_height);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-20 16:35:12 +01:00
|
|
|
GC::Ptr<Layout::Node> SVGForeignObjectElement::create_layout_node(GC::Ref<CSS::ComputedProperties> style)
|
2022-11-10 13:49:26 +01:00
|
|
|
{
|
2024-11-14 06:13:46 +13:00
|
|
|
return heap().allocate<Layout::SVGForeignObjectBox>(document(), *this, move(style));
|
2022-11-10 13:49:26 +01:00
|
|
|
}
|
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<SVG::SVGAnimatedLength> SVGForeignObjectElement::x()
|
2022-11-10 13:49:26 +01:00
|
|
|
{
|
|
|
|
|
return *m_x;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<SVG::SVGAnimatedLength> SVGForeignObjectElement::y()
|
2022-11-10 13:49:26 +01:00
|
|
|
{
|
|
|
|
|
return *m_y;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<SVG::SVGAnimatedLength> SVGForeignObjectElement::width()
|
2022-11-10 13:49:26 +01:00
|
|
|
{
|
|
|
|
|
return *m_width;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<SVG::SVGAnimatedLength> SVGForeignObjectElement::height()
|
2022-11-10 13:49:26 +01:00
|
|
|
{
|
|
|
|
|
return *m_height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|