summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/DOM/Document.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibHTML/DOM/Document.cpp')
-rw-r--r--Libraries/LibHTML/DOM/Document.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/Libraries/LibHTML/DOM/Document.cpp b/Libraries/LibHTML/DOM/Document.cpp
index 4262bca329..9b0cde1ad0 100644
--- a/Libraries/LibHTML/DOM/Document.cpp
+++ b/Libraries/LibHTML/DOM/Document.cpp
@@ -98,10 +98,12 @@ String Document::title() const
void Document::attach_to_frame(Badge<Frame>, Frame& frame)
{
m_frame = frame.make_weak_ptr();
+ layout();
}
void Document::detach_from_frame(Badge<Frame>, Frame&)
{
+ m_layout_root = nullptr;
m_frame = nullptr;
}
@@ -149,8 +151,15 @@ URL Document::complete_url(const String& string) const
return url;
}
+void Document::layout()
+{
+ m_layout_root = create_layout_tree(style_resolver(), nullptr);
+ m_layout_root->layout();
+}
+
void Document::invalidate_layout()
{
+ layout();
if (on_invalidate_layout)
on_invalidate_layout();
}
@@ -174,3 +183,8 @@ void Document::set_visited_link_color(Color color)
{
m_visited_link_color = color;
}
+
+const LayoutDocument* Document::layout_node() const
+{
+ return static_cast<const LayoutDocument*>(Node::layout_node());
+}