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
|
|
|
|
|
|
2022-03-18 22:13:26 +01:00
|
|
|
#include <LibWeb/Layout/ReplacedBox.h>
|
2020-10-05 16:14:36 -07:00
|
|
|
#include <LibWeb/SVG/SVGSVGElement.h>
|
|
|
|
|
|
2020-11-22 15:53:01 +01:00
|
|
|
namespace Web::Layout {
|
2020-10-05 16:14:36 -07:00
|
|
|
|
2022-03-18 22:13:26 +01:00
|
|
|
class SVGSVGBox final : public ReplacedBox {
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_CELL(SVGSVGBox, ReplacedBox);
|
|
|
|
|
GC_DECLARE_ALLOCATOR(SVGSVGBox);
|
2022-10-17 14:41:50 +02:00
|
|
|
|
2020-10-05 16:14:36 -07:00
|
|
|
public:
|
2024-12-20 16:35:12 +01:00
|
|
|
SVGSVGBox(DOM::Document&, SVG::SVGSVGElement&, GC::Ref<CSS::ComputedProperties>);
|
2020-11-22 15:53:01 +01:00
|
|
|
virtual ~SVGSVGBox() override = default;
|
2020-10-05 16:14:36 -07:00
|
|
|
|
2025-01-21 09:12:05 -05:00
|
|
|
SVG::SVGSVGElement& dom_node() { return as<SVG::SVGSVGElement>(ReplacedBox::dom_node()); }
|
|
|
|
|
SVG::SVGSVGElement const& dom_node() const { return as<SVG::SVGSVGElement>(ReplacedBox::dom_node()); }
|
2020-10-05 16:14:36 -07:00
|
|
|
|
2020-11-29 15:29:10 +01:00
|
|
|
virtual bool can_have_children() const override { return true; }
|
2022-03-10 22:38:08 +01:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
|
2022-07-11 12:25:01 +02:00
|
|
|
|
|
|
|
|
virtual void prepare_for_replaced_layout() override;
|
2023-03-10 21:16:18 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
virtual bool is_svg_svg_box() const final { return true; }
|
2023-05-19 18:14:37 +02:00
|
|
|
|
2023-09-03 17:33:58 -05:00
|
|
|
[[nodiscard]] Optional<CSSPixelFraction> calculate_intrinsic_aspect_ratio() const;
|
2020-10-05 16:14:36 -07:00
|
|
|
};
|
|
|
|
|
|
2023-03-10 21:16:18 +01:00
|
|
|
template<>
|
|
|
|
|
inline bool Node::fast_is<SVGSVGBox>() const { return is_svg_svg_box(); }
|
|
|
|
|
|
2020-10-05 16:14:36 -07:00
|
|
|
}
|