1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-10 12:52:07 +00:00
serenity/LibHTML/Layout/LayoutText.cpp
Andreas Kling c7cf6f00fc LibHTML: Let the layout tree own the style tree.
Each layout node is now constructed with an owning back-pointer to the style
tree node that originated it.
2019-07-03 07:19:29 +02:00

39 lines
681 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();
}