| 
									
										
										
										
											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
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-22 15:53:01 +01:00
										 |  |  | #include <LibWeb/Layout/SVGSVGBox.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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-22 15:53:01 +01:00
										 |  |  | SVGSVGBox::SVGSVGBox(DOM::Document& document, SVG::SVGSVGElement& element, NonnullRefPtr<CSS::StyleProperties> properties) | 
					
						
							|  |  |  |     : SVGGraphicsBox(document, element, properties) | 
					
						
							| 
									
										
										
										
											2020-10-05 16:14:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-22 15:53:01 +01:00
										 |  |  | void SVGSVGBox::prepare_for_replaced_layout() | 
					
						
							| 
									
										
										
										
											2020-10-05 16:14:36 -07:00
										 |  |  | { | 
					
						
							|  |  |  |     set_has_intrinsic_width(true); | 
					
						
							|  |  |  |     set_has_intrinsic_height(true); | 
					
						
							| 
									
										
										
										
											2020-11-22 14:46:36 +01:00
										 |  |  |     set_intrinsic_width(dom_node().width()); | 
					
						
							|  |  |  |     set_intrinsic_height(dom_node().height()); | 
					
						
							| 
									
										
										
										
											2020-10-05 16:14:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-22 15:53:01 +01:00
										 |  |  | void SVGSVGBox::before_children_paint(PaintContext& context, PaintPhase phase) | 
					
						
							| 
									
										
										
										
											2020-10-05 16:14:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-11-22 15:53:01 +01:00
										 |  |  |     if (phase != PaintPhase::Foreground) | 
					
						
							| 
									
										
										
										
											2020-10-05 16:14:36 -07:00
										 |  |  |         return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (!context.has_svg_context()) | 
					
						
							|  |  |  |         context.set_svg_context(SVGContext()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-22 15:53:01 +01:00
										 |  |  |     SVGGraphicsBox::before_children_paint(context, phase); | 
					
						
							| 
									
										
										
										
											2020-10-05 16:14:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-22 15:53:01 +01:00
										 |  |  | void SVGSVGBox::after_children_paint(PaintContext& context, PaintPhase phase) | 
					
						
							| 
									
										
										
										
											2020-10-05 16:14:36 -07:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-11-22 15:53:01 +01:00
										 |  |  |     SVGGraphicsBox::after_children_paint(context, phase); | 
					
						
							|  |  |  |     if (phase != PaintPhase::Foreground) | 
					
						
							| 
									
										
										
										
											2020-10-05 16:14:36 -07:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2021-08-01 16:30:18 +02:00
										 |  |  |     context.clear_svg_context(); | 
					
						
							| 
									
										
										
										
											2020-10-05 16:14:36 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |