2019-10-03 16:20:13 +03:00
|
|
|
#include <LibGUI/GPainter.h>
|
|
|
|
#include <LibHTML/Layout/LayoutText.h>
|
|
|
|
#include <LibHTML/Layout/LineBoxFragment.h>
|
|
|
|
#include <LibHTML/RenderingContext.h>
|
|
|
|
|
|
|
|
void LineBoxFragment::render(RenderingContext& context)
|
|
|
|
{
|
2019-10-09 22:25:29 +03:00
|
|
|
for (auto* ancestor = layout_node().parent(); ancestor; ancestor = ancestor->parent()) {
|
|
|
|
if (!ancestor->is_visible())
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-10-15 15:19:52 +03:00
|
|
|
if (is<LayoutText>(layout_node())) {
|
|
|
|
to<LayoutText>(layout_node()).render_fragment(context, *this);
|
2019-10-03 16:20:13 +03:00
|
|
|
}
|
|
|
|
}
|
2019-10-20 13:30:25 +03:00
|
|
|
|
|
|
|
bool LineBoxFragment::is_justifiable_whitespace() const
|
|
|
|
{
|
|
|
|
if (!is<LayoutText>(layout_node()))
|
|
|
|
return false;
|
|
|
|
auto& layout_text = to<LayoutText>(layout_node());
|
|
|
|
auto text = layout_text.node().data().substring_view(m_start, m_length);
|
|
|
|
return text == " ";
|
|
|
|
}
|