ladybird/Userland/Libraries/LibWeb/SVG/SVGDefsElement.h
MacDue 163b6bb401 LibWeb: Special case SVG masks during layout
Rather than try to lay out masks normally, this updates the TreeBuilder
to create layout nodes for masks as a child of their user (i.e. the
masked element). This allows each use of a mask to be laid out
differently, which makes supporting `maskContentUnits=objectBoundingBox`
fairly easy.

The `SVGFormattingContext` is then updated to lay out masks last (as
their sizing may depend on their parent), and treats them like
viewports.

This is pretty ad-hoc, but the SVG specification does not give any
guidance on how to actually implement this.
2024-03-12 08:51:50 +01:00

32 lines
654 B
C++

/*
* Copyright (c) 2022, Simon Danner <danner.simon@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/SVG/SVGGraphicsElement.h>
namespace Web::SVG {
class SVGDefsElement final : public SVGGraphicsElement {
WEB_PLATFORM_OBJECT(SVGDefsElement, SVGGraphicsElement);
JS_DECLARE_ALLOCATOR(SVGDefsElement);
public:
virtual ~SVGDefsElement();
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override
{
return nullptr;
}
private:
SVGDefsElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
};
}