1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 14:54:59 +00:00
serenity/Libraries/LibHTML/Layout/LayoutText.h
Sergey Bugaev fd0aa5dd43 LibHTML: Get rid of the style tree
We now create a layout tree directly from the DOM tree.
This way we don't actually lose text nodes ^)
2019-09-28 18:29:42 +02:00

30 lines
690 B
C++

#pragma once
#include <LibHTML/DOM/Text.h>
#include <LibHTML/Layout/LayoutNode.h>
class LayoutText : public LayoutNode {
public:
LayoutText(const Text&, StyleProperties&&);
virtual ~LayoutText() override;
const Text& node() const { return static_cast<const Text&>(*LayoutNode::node()); }
const String& text() const;
virtual const char* class_name() const override { return "LayoutText"; }
virtual bool is_text() const final { return true; }
virtual void layout() override;
struct Run {
Point pos;
String text;
};
const Vector<Run>& runs() const { return m_runs; }
private:
void compute_runs();
Vector<Run> m_runs;
};