ladybird/Libraries/LibHTML/Layout/LayoutText.h
Andreas Kling 1b7aa00768 LibHTML: LayoutText should inherit from LayoutNode directly
There's no need for LayoutText to inherit from LayoutInline.
I had the wrong idea here: I was thinking that everything that can be
laid out inline should inherit from LayoutInline, but that's clearly
not sufficient for something like LayoutReplaced which can be laid out
in either way.
2019-10-06 11:26:31 +02:00

36 lines
958 B
C++

#pragma once
#include <LibHTML/DOM/Text.h>
#include <LibHTML/Layout/LayoutNode.h>
class Font;
class LineBoxFragment;
class LayoutText : public LayoutNode {
public:
explicit LayoutText(const Text&);
virtual ~LayoutText() override;
const Text& node() const { return static_cast<const Text&>(*LayoutNode::node()); }
const String& text_for_style(const StyleProperties&) const;
virtual const char* class_name() const override { return "LayoutText"; }
virtual bool is_text() const final { return true; }
void render_fragment(RenderingContext&, const LineBoxFragment&) const;
virtual void split_into_lines(LayoutBlock& container) override;
const StyleProperties& style() const { return parent()->style(); }
private:
template<typename Callback>
void for_each_word(Callback) const;
template<typename Callback>
void for_each_source_line(Callback) const;
void load_font();
RefPtr<Font> m_font;
};