| 
									
										
										
										
											2020-10-05 16:14:36 -07:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2021-04-22 16:53:07 -07:00
										 |  |  |  * Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org> | 
					
						
							| 
									
										
										
										
											2024-08-22 13:32:25 +02:00
										 |  |  |  * Copyright (c) 2022-2024, Andreas Kling <andreas@ladybird.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
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-19 15:44:12 +01:00
										 |  |  | #include <LibWeb/CSS/Parser/Parser.h>
 | 
					
						
							| 
									
										
										
										
											2024-08-22 13:32:25 +02:00
										 |  |  | #include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
 | 
					
						
							| 
									
										
										
										
											2022-03-18 22:13:26 +01:00
										 |  |  | #include <LibWeb/Layout/ReplacedBox.h>
 | 
					
						
							| 
									
										
										
										
											2022-07-11 12:25:01 +02:00
										 |  |  | #include <LibWeb/Layout/SVGGeometryBox.h>
 | 
					
						
							| 
									
										
										
										
											2022-03-10 22:38:08 +01:00
										 |  |  | #include <LibWeb/Painting/SVGSVGPaintable.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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  | GC_DEFINE_ALLOCATOR(SVGSVGBox); | 
					
						
							| 
									
										
										
										
											2024-04-06 10:16:04 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-20 16:35:12 +01:00
										 |  |  | SVGSVGBox::SVGSVGBox(DOM::Document& document, SVG::SVGSVGElement& element, GC::Ref<CSS::ComputedProperties> style) | 
					
						
							|  |  |  |     : ReplacedBox(document, element, style) | 
					
						
							| 
									
										
										
										
											2020-10-05 16:14:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  | GC::Ptr<Painting::Paintable> SVGSVGBox::create_paintable() const | 
					
						
							| 
									
										
										
										
											2022-03-10 22:38:08 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     return Painting::SVGSVGPaintable::create(*this); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-11 12:25:01 +02:00
										 |  |  | void SVGSVGBox::prepare_for_replaced_layout() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2024-11-26 12:30:11 +01: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 12:25:01 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-05 16:14:36 -07:00
										 |  |  | } |