2020-10-05 20:14:36 -03:00
|
|
|
/*
|
2021-04-22 20:53:07 -03:00
|
|
|
* Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
|
2024-08-22 08:32:25 -03:00
|
|
|
* Copyright (c) 2022-2024, Andreas Kling <andreas@ladybird.org>
|
2020-10-05 20:14:36 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-10-05 20:14:36 -03:00
|
|
|
*/
|
|
|
|
|
|
2023-03-19 11:44:12 -03:00
|
|
|
#include <LibWeb/CSS/Parser/Parser.h>
|
2024-08-22 08:32:25 -03:00
|
|
|
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
|
2022-03-18 18:13:26 -03:00
|
|
|
#include <LibWeb/Layout/ReplacedBox.h>
|
2022-07-11 07:25:01 -03:00
|
|
|
#include <LibWeb/Layout/SVGGeometryBox.h>
|
2022-03-10 18:38:08 -03:00
|
|
|
#include <LibWeb/Painting/SVGSVGPaintable.h>
|
2020-10-05 20:14:36 -03:00
|
|
|
|
2020-11-22 11:53:01 -03:00
|
|
|
namespace Web::Layout {
|
2020-10-05 20:14:36 -03:00
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC_DEFINE_ALLOCATOR(SVGSVGBox);
|
2024-04-06 14:16:04 -03:00
|
|
|
|
2024-12-20 12:35:12 -03:00
|
|
|
SVGSVGBox::SVGSVGBox(DOM::Document& document, SVG::SVGSVGElement& element, GC::Ref<CSS::ComputedProperties> style)
|
|
|
|
|
: ReplacedBox(document, element, style)
|
2020-10-05 20:14:36 -03:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ptr<Painting::Paintable> SVGSVGBox::create_paintable() const
|
2022-03-10 18:38:08 -03:00
|
|
|
{
|
|
|
|
|
return Painting::SVGSVGPaintable::create(*this);
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-11 07:25:01 -03:00
|
|
|
void SVGSVGBox::prepare_for_replaced_layout()
|
|
|
|
|
{
|
2024-11-26 08:30:11 -03:00
|
|
|
auto natural_metrics = SVG::SVGSVGElement::negotiate_natural_metrics(dom_node());
|
|
|
|
|
set_natural_width(natural_metrics.width);
|
|
|
|
|
set_natural_height(natural_metrics.height);
|
|
|
|
|
set_natural_aspect_ratio(natural_metrics.aspect_ratio);
|
2022-07-11 07:25:01 -03:00
|
|
|
}
|
|
|
|
|
|
2020-10-05 20:14:36 -03:00
|
|
|
}
|