| 
									
										
										
										
											2021-04-04 00:14:39 +02:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2021-04-22 22:51:19 +02:00
										 |  |  |  * Copyright (c) 2021, Linus Groh <linusg@serenityos.org> | 
					
						
							| 
									
										
										
										
											2021-04-04 00:14:39 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-04-22 01:24:48 -07:00
										 |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							| 
									
										
										
										
											2021-04-04 00:14:39 +02:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <LibGfx/Rect.h>
 | 
					
						
							| 
									
										
										
										
											2022-08-31 18:52:54 +02:00
										 |  |  | #include <LibWeb/Bindings/PlatformObject.h>
 | 
					
						
							| 
									
										
										
										
											2021-04-04 00:14:39 +02:00
										 |  |  | #include <LibWeb/Forward.h>
 | 
					
						
							| 
									
										
										
										
											2022-03-07 23:08:26 +01:00
										 |  |  | #include <LibWeb/HTML/Window.h>
 | 
					
						
							| 
									
										
										
										
											2021-04-04 00:14:39 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace Web::CSS { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-31 18:52:54 +02:00
										 |  |  | class Screen final : public Bindings::PlatformObject { | 
					
						
							|  |  |  |     WEB_PLATFORM_OBJECT(Screen, Bindings::PlatformObject); | 
					
						
							| 
									
										
										
										
											2021-04-04 00:14:39 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2022-08-31 18:52:54 +02:00
										 |  |  |     static JS::NonnullGCPtr<Screen> create(HTML::Window&); | 
					
						
							| 
									
										
										
										
											2021-04-04 00:14:39 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     i32 width() const { return screen_rect().width(); } | 
					
						
							|  |  |  |     i32 height() const { return screen_rect().height(); } | 
					
						
							|  |  |  |     i32 avail_width() const { return screen_rect().width(); } | 
					
						
							|  |  |  |     i32 avail_height() const { return screen_rect().height(); } | 
					
						
							|  |  |  |     u32 color_depth() const { return 24; } | 
					
						
							|  |  |  |     u32 pixel_depth() const { return 24; } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2022-03-07 23:08:26 +01:00
										 |  |  |     explicit Screen(HTML::Window&); | 
					
						
							| 
									
										
										
										
											2021-04-04 00:14:39 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-10 06:28:20 -05:00
										 |  |  |     virtual void initialize(JS::Realm&) override; | 
					
						
							| 
									
										
										
										
											2022-08-31 18:52:54 +02:00
										 |  |  |     virtual void visit_edges(Cell::Visitor&) override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-28 13:42:07 +02:00
										 |  |  |     HTML::Window const& window() const { return *m_window; } | 
					
						
							| 
									
										
										
										
											2021-04-04 00:14:39 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-09 15:47:48 +01:00
										 |  |  |     Gfx::IntRect screen_rect() const; | 
					
						
							| 
									
										
										
										
											2022-08-28 13:42:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-31 18:52:54 +02:00
										 |  |  |     JS::NonnullGCPtr<HTML::Window> m_window; | 
					
						
							| 
									
										
										
										
											2021-04-04 00:14:39 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |