| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											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-05 20:10:39 +01:00
										 |  |  | #include <AK/Vector.h>
 | 
					
						
							| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  | #include <LibWeb/Forward.h>
 | 
					
						
							|  |  |  | #include <LibWeb/Layout/FormattingContext.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::Layout { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class BlockFormattingContext : public FormattingContext { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-11-25 20:08:52 +01:00
										 |  |  |     explicit BlockFormattingContext(Box&, FormattingContext* parent); | 
					
						
							| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  |     ~BlockFormattingContext(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-06 19:48:02 +01:00
										 |  |  |     virtual void run(Box&, LayoutMode) override; | 
					
						
							| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     bool is_initial() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-05 20:10:39 +01:00
										 |  |  |     const Vector<Box*>& left_floating_boxes() const { return m_left_floating_boxes; } | 
					
						
							|  |  |  |     const Vector<Box*>& right_floating_boxes() const { return m_right_floating_boxes; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-30 21:57:13 +02:00
										 |  |  |     static float compute_theoretical_height(const Box&); | 
					
						
							| 
									
										
										
										
											2020-11-22 15:53:01 +01:00
										 |  |  |     void compute_width(Box&); | 
					
						
							| 
									
										
										
										
											2021-05-30 21:57:13 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  |     static void compute_height(Box&); | 
					
						
							| 
									
										
										
										
											2021-03-29 12:04:26 -04:00
										 |  |  |     void compute_position(Box&); | 
					
						
							| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2020-12-05 20:10:39 +01:00
										 |  |  |     virtual bool is_block_formatting_context() const final { return true; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-06 01:08:14 +01:00
										 |  |  |     void compute_width_for_floating_box(Box&); | 
					
						
							| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-11 22:27:09 +01:00
										 |  |  |     void compute_width_for_block_level_replaced_element_in_normal_flow(ReplacedBox&); | 
					
						
							| 
									
										
										
										
											2021-03-08 22:49:34 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  |     void layout_initial_containing_block(LayoutMode); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-06 19:48:02 +01:00
										 |  |  |     void layout_block_level_children(Box&, LayoutMode); | 
					
						
							|  |  |  |     void layout_inline_children(Box&, LayoutMode); | 
					
						
							| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-06 19:48:02 +01:00
										 |  |  |     void place_block_level_replaced_element_in_normal_flow(Box& child, Box& container); | 
					
						
							|  |  |  |     void place_block_level_non_replaced_element_in_normal_flow(Box& child, Box& container); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void layout_floating_child(Box&, Box& containing_block); | 
					
						
							| 
									
										
										
										
											2020-12-05 20:10:39 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     Vector<Box*> m_left_floating_boxes; | 
					
						
							|  |  |  |     Vector<Box*> m_right_floating_boxes; | 
					
						
							| 
									
										
										
										
											2020-11-22 13:38:18 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |