| 
									
										
										
										
											2021-09-17 23:12:16 +02:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2024-10-04 13:19:50 +02:00
										 |  |  |  * Copyright (c) 2021, Andreas Kling <andreas@ladybird.org> | 
					
						
							| 
									
										
										
										
											2021-09-17 23:12:16 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <LibWeb/Forward.h>
 | 
					
						
							|  |  |  | #include <LibWeb/Layout/FormattingContext.h>
 | 
					
						
							| 
									
										
										
										
											2024-08-20 15:12:55 +01:00
										 |  |  | #include <LibWeb/Layout/SVGImageBox.h>
 | 
					
						
							| 
									
										
										
										
											2024-04-07 20:47:13 +01:00
										 |  |  | #include <LibWeb/Layout/SVGSVGBox.h>
 | 
					
						
							|  |  |  | #include <LibWeb/Layout/SVGTextBox.h>
 | 
					
						
							|  |  |  | #include <LibWeb/Layout/SVGTextPathBox.h>
 | 
					
						
							| 
									
										
										
										
											2021-09-17 23:12:16 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Web::Layout { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class SVGFormattingContext : public FormattingContext { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2024-09-11 01:03:02 +02:00
										 |  |  |     explicit SVGFormattingContext(LayoutState&, LayoutMode, Box const&, FormattingContext* parent, Gfx::AffineTransform parent_viewbox_transform = {}); | 
					
						
							| 
									
										
										
										
											2021-09-17 23:12:16 +02:00
										 |  |  |     ~SVGFormattingContext(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-11 01:03:02 +02:00
										 |  |  |     virtual void run(AvailableSpace const&) override; | 
					
						
							| 
									
										
										
										
											2023-03-19 09:57:31 +01:00
										 |  |  |     virtual CSSPixels automatic_content_width() const override; | 
					
						
							| 
									
										
										
										
											2022-11-23 17:46:10 +00:00
										 |  |  |     virtual CSSPixels automatic_content_height() const override; | 
					
						
							| 
									
										
										
										
											2024-01-27 16:23:22 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2024-04-07 20:47:13 +01:00
										 |  |  |     void layout_svg_element(Box const&); | 
					
						
							|  |  |  |     void layout_nested_viewport(Box const&); | 
					
						
							|  |  |  |     void layout_container_element(SVGBox const&); | 
					
						
							|  |  |  |     void layout_graphics_element(SVGGraphicsBox const&); | 
					
						
							|  |  |  |     void layout_path_like_element(SVGGraphicsBox const&); | 
					
						
							|  |  |  |     void layout_mask_or_clip(SVGBox const&); | 
					
						
							| 
									
										
										
										
											2024-08-20 15:12:55 +01:00
										 |  |  |     void layout_image_element(SVGImageBox const& image_box); | 
					
						
							| 
									
										
										
										
											2024-04-07 20:47:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-09 14:00:10 +02:00
										 |  |  |     [[nodiscard]] Gfx::Path compute_path_for_text(SVGTextBox const&); | 
					
						
							|  |  |  |     [[nodiscard]] Gfx::Path compute_path_for_text_path(SVGTextPathBox const&); | 
					
						
							| 
									
										
										
										
											2024-04-07 20:47:13 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-27 16:23:22 +00:00
										 |  |  |     Gfx::AffineTransform m_parent_viewbox_transform {}; | 
					
						
							| 
									
										
										
										
											2024-04-07 20:47:13 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     Optional<AvailableSpace> m_available_space {}; | 
					
						
							|  |  |  |     Gfx::AffineTransform m_current_viewbox_transform {}; | 
					
						
							|  |  |  |     CSSPixelSize m_viewport_size {}; | 
					
						
							|  |  |  |     CSSPixelPoint m_svg_offset {}; | 
					
						
							| 
									
										
										
										
											2021-09-17 23:12:16 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |