mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-11-04 15:20:58 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			682 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			682 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#include <LibHTML/Layout/LayoutText.h>
 | 
						|
#include <ctype.h>
 | 
						|
 | 
						|
LayoutText::LayoutText(const Text& text, const StyledNode& styled_node)
 | 
						|
    : LayoutNode(&text, &styled_node)
 | 
						|
{
 | 
						|
}
 | 
						|
 | 
						|
LayoutText::~LayoutText()
 | 
						|
{
 | 
						|
}
 | 
						|
 | 
						|
static bool is_all_whitespace(const String& string)
 | 
						|
{
 | 
						|
    for (int i = 0; i < string.length(); ++i) {
 | 
						|
        if (!isspace(string[i]))
 | 
						|
            return false;
 | 
						|
    }
 | 
						|
    return true;
 | 
						|
}
 | 
						|
 | 
						|
const String& LayoutText::text() const
 | 
						|
{
 | 
						|
    static String one_space = " ";
 | 
						|
    if (is_all_whitespace(node().data()))
 | 
						|
        return one_space;
 | 
						|
    return node().data();
 | 
						|
}
 | 
						|
 | 
						|
void LayoutText::compute_runs()
 | 
						|
{
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
void LayoutText::layout()
 | 
						|
{
 | 
						|
    ASSERT(!has_children());
 | 
						|
    compute_runs();
 | 
						|
}
 |