Serenity Operating System
1/*
2 * Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#pragma once
8
9#include <LibWeb/Layout/SVGGraphicsBox.h>
10#include <LibWeb/SVG/SVGGeometryElement.h>
11
12namespace Web::Layout {
13
14class SVGGeometryBox final : public SVGGraphicsBox {
15 JS_CELL(SVGGeometryBox, SVGGraphicsBox);
16
17public:
18 SVGGeometryBox(DOM::Document&, SVG::SVGGeometryElement&, NonnullRefPtr<CSS::StyleProperties>);
19 virtual ~SVGGeometryBox() override = default;
20
21 SVG::SVGGeometryElement& dom_node() { return static_cast<SVG::SVGGeometryElement&>(SVGGraphicsBox::dom_node()); }
22 SVG::SVGGeometryElement const& dom_node() const { return static_cast<SVG::SVGGeometryElement const&>(SVGGraphicsBox::dom_node()); }
23
24 float viewbox_scaling() const;
25 CSSPixelPoint viewbox_origin() const;
26
27 virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
28
29private:
30 virtual bool is_svg_geometry_box() const final { return true; }
31};
32
33template<>
34inline bool Node::fast_is<SVGGeometryBox>() const { return is_svg_geometry_box(); }
35
36}