| 
									
										
										
										
											2022-09-03 21:32:14 +02:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2022, Andreas Kling <kling@serenityos.org> | 
					
						
							| 
									
										
										
										
											2022-10-06 15:25:08 +01:00
										 |  |  |  * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org> | 
					
						
							| 
									
										
										
										
											2022-09-03 21:32:14 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-25 18:03:02 -06:00
										 |  |  | #include <LibWeb/Bindings/Intrinsics.h>
 | 
					
						
							| 
									
										
										
										
											2022-09-03 21:32:14 +02:00
										 |  |  | #include <LibWeb/Geometry/DOMPoint.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::Geometry { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-19 19:47:52 +01:00
										 |  |  | JS_DEFINE_ALLOCATOR(DOMPoint); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-15 13:16:09 +02:00
										 |  |  | JS::NonnullGCPtr<DOMPoint> DOMPoint::construct_impl(JS::Realm& realm, double x, double y, double z, double w) | 
					
						
							| 
									
										
										
										
											2022-09-25 18:03:02 -06:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2023-08-13 13:05:26 +02:00
										 |  |  |     return realm.heap().allocate<DOMPoint>(realm, realm, x, y, z, w); | 
					
						
							| 
									
										
										
										
											2022-09-25 18:03:02 -06:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | DOMPoint::DOMPoint(JS::Realm& realm, double x, double y, double z, double w) | 
					
						
							|  |  |  |     : DOMPointReadOnly(realm, x, y, z, w) | 
					
						
							| 
									
										
										
										
											2022-09-03 21:32:14 +02:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-06 15:25:08 +01:00
										 |  |  | // https://drafts.fxtf.org/geometry/#dom-dompoint-frompoint
 | 
					
						
							|  |  |  | JS::NonnullGCPtr<DOMPoint> DOMPoint::from_point(JS::VM& vm, DOMPointInit const& other) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     // The fromPoint(other) static method on DOMPoint must create a DOMPoint from the dictionary other.
 | 
					
						
							| 
									
										
										
										
											2023-08-15 13:16:09 +02:00
										 |  |  |     return construct_impl(*vm.current_realm(), other.x, other.y, other.z, other.w); | 
					
						
							| 
									
										
										
										
											2022-10-06 15:25:08 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-03 21:32:14 +02:00
										 |  |  | DOMPoint::~DOMPoint() = default; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 08:41:28 +02:00
										 |  |  | void DOMPoint::initialize(JS::Realm& realm) | 
					
						
							| 
									
										
										
										
											2023-01-10 06:28:20 -05:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2023-08-07 08:41:28 +02:00
										 |  |  |     Base::initialize(realm); | 
					
						
							| 
									
										
										
										
											2023-01-10 06:28:20 -05:00
										 |  |  |     set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMPointPrototype>(realm, "DOMPoint")); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-03 21:32:14 +02:00
										 |  |  | } |