#pragma once #include #include class LineBoxFragment; class LayoutText : public LayoutNode { public: explicit LayoutText(const Text&); virtual ~LayoutText() override; const Text& node() const { return static_cast(*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 void for_each_word(Callback) const; template void for_each_source_line(Callback) const; String m_text_for_rendering; }; template<> inline bool is(const LayoutNode& node) { return node.is_text(); }