1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 09:05:07 +00:00
serenity/LibHTML/LayoutText.cpp

28 lines
512 B
C++

#include <LibHTML/LayoutText.h>
#include <ctype.h>
LayoutText::LayoutText(const Text& text)
: LayoutNode(&text)
{
}
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();
}