| 
									
										
										
										
											2023-12-17 18:35:21 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2023, MacDue <macdue@dueutil.tech> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-18 16:22:27 +13:00
										 |  |  | #include <LibURL/URL.h>
 | 
					
						
							| 
									
										
										
										
											2024-04-27 12:09:58 +12:00
										 |  |  | #include <LibWeb/Bindings/SVGTextPathElementPrototype.h>
 | 
					
						
							| 
									
										
										
										
											2023-12-17 18:35:21 +00:00
										 |  |  | #include <LibWeb/Layout/SVGTextPathBox.h>
 | 
					
						
							|  |  |  | #include <LibWeb/SVG/AttributeNames.h>
 | 
					
						
							|  |  |  | #include <LibWeb/SVG/SVGTextPathElement.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::SVG { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  | GC_DEFINE_ALLOCATOR(SVGTextPathElement); | 
					
						
							| 
									
										
										
										
											2023-12-17 18:35:21 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | SVGTextPathElement::SVGTextPathElement(DOM::Document& document, DOM::QualifiedName qualified_name) | 
					
						
							|  |  |  |     : SVGTextContentElement(document, move(qualified_name)) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-15 04:01:23 +13:00
										 |  |  | GC::Ptr<SVGGeometryElement const> SVGTextPathElement::path_or_shape() const | 
					
						
							| 
									
										
										
										
											2023-12-17 18:35:21 +00:00
										 |  |  | { | 
					
						
							|  |  |  |     auto href = get_attribute(AttributeNames::href); | 
					
						
							|  |  |  |     if (!href.has_value()) | 
					
						
							|  |  |  |         return {}; | 
					
						
							|  |  |  |     auto url = document().url().complete_url(*href); | 
					
						
							|  |  |  |     return try_resolve_url_to<SVGGeometryElement const>(url); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void SVGTextPathElement::initialize(JS::Realm& realm) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Base::initialize(realm); | 
					
						
							| 
									
										
										
										
											2024-03-16 13:13:08 +01:00
										 |  |  |     WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTextPathElement); | 
					
						
							| 
									
										
										
										
											2023-12-17 18:35:21 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-14 00:20:44 +00:00
										 |  |  | void SVGTextPathElement::visit_edges(Cell::Visitor& visitor) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Base::visit_edges(visitor); | 
					
						
							|  |  |  |     SVGURIReferenceMixin::visit_edges(visitor); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-20 16:35:12 +01:00
										 |  |  | GC::Ptr<Layout::Node> SVGTextPathElement::create_layout_node(GC::Ref<CSS::ComputedProperties> style) | 
					
						
							| 
									
										
										
										
											2023-12-17 18:35:21 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2024-11-14 06:13:46 +13:00
										 |  |  |     return heap().allocate<Layout::SVGTextPathBox>(document(), *this, move(style)); | 
					
						
							| 
									
										
										
										
											2023-12-17 18:35:21 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | }; |