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