2022-04-10 19:05:12 +02:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
2022-04-10 19:05:12 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
2022-09-30 17:16:16 -06:00
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2024-04-27 12:09:58 +12:00
|
|
|
#include <LibWeb/Bindings/SVGClipPathElementPrototype.h>
|
2024-03-27 00:13:16 +00:00
|
|
|
#include <LibWeb/SVG/AttributeNames.h>
|
2022-04-10 19:05:12 +02:00
|
|
|
#include <LibWeb/SVG/SVGClipPathElement.h>
|
|
|
|
|
|
|
|
namespace Web::SVG {
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DEFINE_ALLOCATOR(SVGClipPathElement);
|
2023-11-19 19:47:52 +01:00
|
|
|
|
2022-04-10 19:05:12 +02:00
|
|
|
SVGClipPathElement::SVGClipPathElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
2025-01-08 14:44:00 +11:00
|
|
|
: SVGGraphicsElement(document, move(qualified_name))
|
2022-04-10 19:05:12 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SVGClipPathElement::~SVGClipPathElement()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-08-07 08:41:28 +02:00
|
|
|
void SVGClipPathElement::initialize(JS::Realm& realm)
|
2023-01-10 06:28:20 -05:00
|
|
|
{
|
2024-03-16 13:13:08 +01:00
|
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGClipPathElement);
|
2025-04-20 16:22:57 +02:00
|
|
|
Base::initialize(realm);
|
2023-01-10 06:28:20 -05:00
|
|
|
}
|
|
|
|
|
2024-11-14 08:14:16 -05:00
|
|
|
void SVGClipPathElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
|
2024-03-27 00:13:16 +00:00
|
|
|
{
|
2024-11-14 08:14:16 -05:00
|
|
|
Base::attribute_changed(name, old_value, value, namespace_);
|
|
|
|
|
2024-03-27 00:13:16 +00:00
|
|
|
if (name == AttributeNames::clipPathUnits)
|
|
|
|
m_clip_path_units = AttributeParser::parse_units(value.value_or(String {}));
|
|
|
|
}
|
|
|
|
|
2024-12-20 16:35:12 +01:00
|
|
|
GC::Ptr<Layout::Node> SVGClipPathElement::create_layout_node(GC::Ref<CSS::ComputedProperties>)
|
2022-04-10 19:05:12 +02:00
|
|
|
{
|
2024-03-27 00:13:16 +00:00
|
|
|
// Clip paths are handled as a special case in the TreeBuilder.
|
2022-04-10 19:05:12 +02:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|