| 
									
										
										
										
											2020-01-18 09:38:21 +01:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-04-22 01:24:48 -07:00
										 |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							| 
									
										
										
										
											2020-01-18 09:38:21 +01:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-03 15:20:13 +02:00
										 |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <AK/Vector.h>
 | 
					
						
							| 
									
										
										
										
											2020-03-07 10:32:51 +01:00
										 |  |  | #include <LibWeb/Layout/LineBoxFragment.h>
 | 
					
						
							| 
									
										
										
										
											2019-10-03 15:20:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-22 15:53:01 +01:00
										 |  |  | namespace Web::Layout { | 
					
						
							| 
									
										
										
										
											2020-03-07 10:27:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-03 15:20:13 +02:00
										 |  |  | class LineBox { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-06-10 10:42:29 +02:00
										 |  |  |     LineBox() { } | 
					
						
							| 
									
										
										
										
											2019-10-03 15:20:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-20 12:30:25 +02:00
										 |  |  |     float width() const { return m_width; } | 
					
						
							| 
									
										
										
										
											2019-10-03 15:20:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-26 09:24:40 +01:00
										 |  |  |     void add_fragment(Node const& layout_node, int start, int length, float leading_size, float trailing_size, float content_width, float content_height, float border_box_top, float border_box_bottom, LineBoxFragment::Type = LineBoxFragment::Type::Normal); | 
					
						
							| 
									
										
										
										
											2019-10-03 15:20:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-27 10:32:00 +01:00
										 |  |  |     Vector<LineBoxFragment> const& fragments() const { return m_fragments; } | 
					
						
							|  |  |  |     Vector<LineBoxFragment>& fragments() { return m_fragments; } | 
					
						
							| 
									
										
										
										
											2019-10-03 15:20:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-20 17:18:28 +02:00
										 |  |  |     void trim_trailing_whitespace(); | 
					
						
							| 
									
										
										
										
											2020-06-10 10:42:29 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-17 20:17:29 +01:00
										 |  |  |     bool is_empty_or_ends_in_whitespace() const; | 
					
						
							| 
									
										
										
										
											2022-01-22 10:32:49 +01:00
										 |  |  |     bool is_empty() const { return m_fragments.is_empty(); } | 
					
						
							| 
									
										
										
										
											2020-06-13 14:59:17 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-03 15:20:13 +02:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2021-10-06 20:02:41 +02:00
										 |  |  |     friend class BlockContainer; | 
					
						
							| 
									
										
										
										
											2020-11-22 15:53:01 +01:00
										 |  |  |     friend class InlineFormattingContext; | 
					
						
							| 
									
										
										
										
											2022-01-19 11:57:58 +01:00
										 |  |  |     friend class LineBuilder; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-27 10:32:00 +01:00
										 |  |  |     Vector<LineBoxFragment> m_fragments; | 
					
						
							| 
									
										
										
										
											2019-10-20 12:30:25 +02:00
										 |  |  |     float m_width { 0 }; | 
					
						
							| 
									
										
										
										
											2019-10-03 15:20:13 +02:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2020-03-07 10:27:02 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | } |