| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2024-10-04 13:19:50 +02:00
										 |  |  |  * Copyright (c) 2020-2024, Andreas Kling <andreas@ladybird.org> | 
					
						
							| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2021-04-22 01:24:48 -07:00
										 |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-06 19:48:02 +01:00
										 |  |  | #include <AK/Types.h>
 | 
					
						
							| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  | #include <LibWeb/Forward.h>
 | 
					
						
							| 
									
										
										
										
											2021-10-06 21:53:25 +02:00
										 |  |  | #include <LibWeb/Layout/BlockContainer.h>
 | 
					
						
							| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  | #include <LibWeb/Layout/FormattingContext.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::Layout { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class InlineFormattingContext final : public FormattingContext { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2024-09-11 01:03:02 +02:00
										 |  |  |     InlineFormattingContext(LayoutState&, LayoutMode, BlockContainer const& containing_block, LayoutState::UsedValues& containing_block_used_values, BlockFormattingContext& parent); | 
					
						
							| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  |     ~InlineFormattingContext(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-23 15:22:18 +01:00
										 |  |  |     BlockFormattingContext& parent(); | 
					
						
							|  |  |  |     BlockFormattingContext const& parent() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-06 21:53:25 +02:00
										 |  |  |     BlockContainer const& containing_block() const { return static_cast<BlockContainer const&>(context_box()); } | 
					
						
							| 
									
										
										
										
											2020-12-06 19:48:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-11 01:03:02 +02:00
										 |  |  |     virtual void run(AvailableSpace const&) override; | 
					
						
							| 
									
										
										
										
											2022-11-23 17:46:10 +00:00
										 |  |  |     virtual CSSPixels automatic_content_height() const override; | 
					
						
							|  |  |  |     virtual CSSPixels automatic_content_width() const override; | 
					
						
							| 
									
										
										
										
											2024-10-05 22:18:53 +02:00
										 |  |  |     StaticPositionRect calculate_static_position_rect(Box const&) const; | 
					
						
							| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-20 15:51:24 +01:00
										 |  |  |     void dimension_box_on_line(Box const&, LayoutMode); | 
					
						
							| 
									
										
										
										
											2022-01-17 15:07:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-29 11:32:59 +00:00
										 |  |  |     CSSPixels leftmost_inline_offset_at(CSSPixels y) const; | 
					
						
							| 
									
										
										
										
											2023-08-12 18:30:18 +02:00
										 |  |  |     AvailableSize available_space_for_line(CSSPixels y) const; | 
					
						
							| 
									
										
										
										
											2024-10-29 11:32:59 +00:00
										 |  |  |     bool any_floats_intrude_at_block_offset(CSSPixels block_offset) const; | 
					
						
							|  |  |  |     bool can_fit_new_line_at_block_offset(CSSPixels block_offset) const; | 
					
						
							| 
									
										
										
										
											2022-01-18 11:00:25 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-29 04:05:45 +00:00
										 |  |  |     CSSPixels vertical_float_clearance() const; | 
					
						
							|  |  |  |     void set_vertical_float_clearance(CSSPixels); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-01-19 11:59:44 +01:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2024-09-11 01:03:02 +02:00
										 |  |  |     void generate_line_boxes(); | 
					
						
							| 
									
										
										
										
											2022-07-09 20:56:59 +02:00
										 |  |  |     void apply_justification_to_fragments(CSS::TextJustify, LineBox&, bool is_last_line); | 
					
						
							| 
									
										
										
										
											2022-07-09 20:45:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 19:25:00 +01:00
										 |  |  |     LayoutState::UsedValues& m_containing_block_used_values; | 
					
						
							| 
									
										
										
										
											2022-09-27 15:29:17 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     Optional<AvailableSpace> m_available_space; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-03 17:48:46 +00:00
										 |  |  |     CSSPixels m_automatic_content_width { 0 }; | 
					
						
							|  |  |  |     CSSPixels m_automatic_content_height { 0 }; | 
					
						
							| 
									
										
										
										
											2023-07-29 04:05:45 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     CSSPixels m_vertical_float_clearance { 0 }; | 
					
						
							| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |