mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 07:42:43 +00:00 
			
		
		
		
	 3bd29ad98c
			
		
	
	
		3bd29ad98c
		
	
	
	
	
		
			
			After the splitting-into-lines pass, remove any trailing whitespace from all of a block's line boxes. This improves the appearance of text-align: justify/right :^)
		
			
				
	
	
		
			22 lines
		
	
	
	
		
			558 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
	
		
			558 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <AK/Vector.h>
 | |
| #include <LibHTML/Layout/LineBoxFragment.h>
 | |
| 
 | |
| class LineBox {
 | |
| public:
 | |
|     LineBox() {}
 | |
| 
 | |
|     float width() const { return m_width; }
 | |
| 
 | |
|     void add_fragment(const LayoutNode& layout_node, int start, int length, int width, int height);
 | |
| 
 | |
|     const Vector<LineBoxFragment>& fragments() const { return m_fragments; }
 | |
|     Vector<LineBoxFragment>& fragments() { return m_fragments; }
 | |
| 
 | |
|     void trim_trailing_whitespace();
 | |
| private:
 | |
|     friend class LayoutBlock;
 | |
|     Vector<LineBoxFragment> m_fragments;
 | |
|     float m_width { 0 };
 | |
| };
 |