1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:37:36 +00:00

LibWeb: Stub out SVGMaskElement

Just enough that we stop creating layout nodes for mask elements, which
was making some SVG content look very wrong. :^)
This commit is contained in:
Andreas Kling 2023-08-10 09:55:15 +02:00
parent adf70b8a16
commit 9e22f01eba
10 changed files with 99 additions and 0 deletions

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2023, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/SVGMaskElementPrototype.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/SVG/SVGMaskElement.h>
namespace Web::SVG {
SVGMaskElement::SVGMaskElement(DOM::Document& document, DOM::QualifiedName tag_name)
: SVGGraphicsElement(document, move(tag_name))
{
}
SVGMaskElement::~SVGMaskElement() = default;
void SVGMaskElement::initialize(JS::Realm& realm)
{
Base::initialize(realm);
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGMaskElementPrototype>(realm, "SVGMaskElement"));
}
JS::GCPtr<Layout::Node> SVGMaskElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties>)
{
return nullptr;
}
}

View file

@ -0,0 +1,26 @@
/*
* Copyright (c) 2023, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/SVG/SVGGraphicsElement.h>
namespace Web::SVG {
class SVGMaskElement final : public SVGGraphicsElement {
WEB_PLATFORM_OBJECT(SVGMaskElement, SVGGraphicsElement);
public:
virtual ~SVGMaskElement() override;
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
private:
SVGMaskElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -0,0 +1,11 @@
[Exposed=Window]
interface SVGMaskElement : SVGElement {
// FIXME: readonly attribute SVGAnimatedEnumeration maskUnits;
// FIXME: readonly attribute SVGAnimatedEnumeration maskContentUnits;
// FIXME: readonly attribute SVGAnimatedLength x;
// FIXME: readonly attribute SVGAnimatedLength y;
// FIXME: readonly attribute SVGAnimatedLength width;
// FIXME: readonly attribute SVGAnimatedLength height;
};

View file

@ -31,6 +31,7 @@ namespace Web::SVG::TagNames {
__ENUMERATE_SVG_TAG(desc) \
__ENUMERATE_SVG_TAG(foreignObject) \
__ENUMERATE_SVG_TAG(linearGradient) \
__ENUMERATE_SVG_TAG(mask) \
__ENUMERATE_SVG_TAG(radialGradient) \
__ENUMERATE_SVG_TAG(script) \
__ENUMERATE_SVG_TAG(stop) \