2020-10-05 16:14:36 -07:00
|
|
|
/*
|
2021-04-22 16:53:07 -07:00
|
|
|
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
|
2020-10-05 16:14:36 -07:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-10-05 16:14:36 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2020-11-22 15:53:01 +01:00
|
|
|
#include <LibWeb/Layout/SVGGraphicsBox.h>
|
2022-02-11 12:32:55 +00:00
|
|
|
#include <LibWeb/SVG/SVGGeometryElement.h>
|
2020-10-05 16:14:36 -07:00
|
|
|
|
2020-11-22 15:53:01 +01:00
|
|
|
namespace Web::Layout {
|
2020-10-05 16:14:36 -07:00
|
|
|
|
2022-02-11 12:37:22 +00:00
|
|
|
class SVGGeometryBox final : public SVGGraphicsBox {
|
2022-10-17 14:41:50 +02:00
|
|
|
JS_CELL(SVGGeometryBox, SVGGraphicsBox);
|
|
|
|
|
|
2020-10-05 16:14:36 -07:00
|
|
|
public:
|
2022-02-11 12:37:22 +00:00
|
|
|
SVGGeometryBox(DOM::Document&, SVG::SVGGeometryElement&, NonnullRefPtr<CSS::StyleProperties>);
|
|
|
|
|
virtual ~SVGGeometryBox() override = default;
|
2020-10-05 16:14:36 -07:00
|
|
|
|
2023-03-10 21:15:15 +01:00
|
|
|
SVG::SVGGeometryElement& dom_node() { return static_cast<SVG::SVGGeometryElement&>(SVGGraphicsBox::dom_node()); }
|
|
|
|
|
SVG::SVGGeometryElement const& dom_node() const { return static_cast<SVG::SVGGeometryElement const&>(SVGGraphicsBox::dom_node()); }
|
2020-10-05 16:14:36 -07:00
|
|
|
|
2023-04-10 12:32:55 +01:00
|
|
|
Gfx::AffineTransform layout_transform() const;
|
2022-02-27 21:00:04 +01:00
|
|
|
|
2023-01-11 12:51:49 +01:00
|
|
|
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
|
2022-03-10 22:38:08 +01:00
|
|
|
|
2021-10-18 16:26:05 +02:00
|
|
|
private:
|
2023-04-10 12:32:55 +01:00
|
|
|
CSSPixelPoint viewbox_origin() const;
|
|
|
|
|
|
2022-02-11 12:37:22 +00:00
|
|
|
virtual bool is_svg_geometry_box() const final { return true; }
|
2020-10-05 16:14:36 -07:00
|
|
|
};
|
|
|
|
|
|
2021-10-18 16:26:05 +02:00
|
|
|
template<>
|
2022-02-11 12:37:22 +00:00
|
|
|
inline bool Node::fast_is<SVGGeometryBox>() const { return is_svg_geometry_box(); }
|
2021-10-18 16:26:05 +02:00
|
|
|
|
2020-10-05 16:14:36 -07:00
|
|
|
}
|