summaryrefslogtreecommitdiff
path: root/LibHTML/Layout
diff options
context:
space:
mode:
Diffstat (limited to 'LibHTML/Layout')
-rw-r--r--LibHTML/Layout/LayoutBlock.cpp7
-rw-r--r--LibHTML/Layout/LayoutBlock.h2
-rw-r--r--LibHTML/Layout/LayoutNode.h4
-rw-r--r--LibHTML/Layout/LayoutText.cpp11
-rw-r--r--LibHTML/Layout/LayoutText.h11
5 files changed, 35 insertions, 0 deletions
diff --git a/LibHTML/Layout/LayoutBlock.cpp b/LibHTML/Layout/LayoutBlock.cpp
index 45191bcbe4..9495ffd280 100644
--- a/LibHTML/Layout/LayoutBlock.cpp
+++ b/LibHTML/Layout/LayoutBlock.cpp
@@ -9,3 +9,10 @@ LayoutBlock::LayoutBlock(Element& element)
LayoutBlock::~LayoutBlock()
{
}
+
+void LayoutBlock::layout()
+{
+ LayoutNode::layout();
+
+
+}
diff --git a/LibHTML/Layout/LayoutBlock.h b/LibHTML/Layout/LayoutBlock.h
index 3b039c537e..47981eead3 100644
--- a/LibHTML/Layout/LayoutBlock.h
+++ b/LibHTML/Layout/LayoutBlock.h
@@ -11,5 +11,7 @@ public:
virtual const char* class_name() const override { return "LayoutBlock"; }
+ virtual void layout() override;
+
private:
};
diff --git a/LibHTML/Layout/LayoutNode.h b/LibHTML/Layout/LayoutNode.h
index ce1e040a8b..64341d86c5 100644
--- a/LibHTML/Layout/LayoutNode.h
+++ b/LibHTML/Layout/LayoutNode.h
@@ -25,6 +25,8 @@ public:
bool is_anonymous() const { return !m_node; }
const Node* node() const { return m_node; }
+ const LayoutNode* parent_layout_node() const { return m_parent_node; }
+
LayoutNode* next_sibling() { return m_next_sibling; }
LayoutNode* previous_sibling() { return m_previous_sibling; }
LayoutNode* first_child() { return m_first_child; }
@@ -34,6 +36,8 @@ public:
const LayoutNode* first_child() const { return m_first_child; }
const LayoutNode* last_child() const { return m_last_child; }
+ bool has_children() const { return m_first_child; }
+
void append_child(Retained<LayoutNode>);
void set_next_sibling(LayoutNode* node) { m_next_sibling = node; }
diff --git a/LibHTML/Layout/LayoutText.cpp b/LibHTML/Layout/LayoutText.cpp
index 4682220ba2..bddac63e39 100644
--- a/LibHTML/Layout/LayoutText.cpp
+++ b/LibHTML/Layout/LayoutText.cpp
@@ -26,3 +26,14 @@ const String& LayoutText::text() const
return one_space;
return node().data();
}
+
+void LayoutText::compute_runs()
+{
+
+}
+
+void LayoutText::layout()
+{
+ ASSERT(!has_children());
+ compute_runs();
+}
diff --git a/LibHTML/Layout/LayoutText.h b/LibHTML/Layout/LayoutText.h
index 8169dd17c3..01022d6175 100644
--- a/LibHTML/Layout/LayoutText.h
+++ b/LibHTML/Layout/LayoutText.h
@@ -14,6 +14,17 @@ public:
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;
};