diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-10-28 20:51:45 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-10-28 20:51:45 +0100 |
commit | 98ff8ef0cf2bdfed37a1552a048a551e7b1b7d5b (patch) | |
tree | 10a1c449e2ce28f9e307429c868a2ec3a30e0d37 /Libraries/LibHTML/DOM | |
parent | d24164ac6a07afadd5efacafbcbc6aea2c5eb3e7 (diff) | |
download | serenity-98ff8ef0cf2bdfed37a1552a048a551e7b1b7d5b.zip |
LibHTML: Add Document::force_layout()
..for when you really need a layout to happen right now.
Also, automatically repaint the layout root after layout.
Diffstat (limited to 'Libraries/LibHTML/DOM')
-rw-r--r-- | Libraries/LibHTML/DOM/Document.cpp | 7 | ||||
-rw-r--r-- | Libraries/LibHTML/DOM/Document.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/Libraries/LibHTML/DOM/Document.cpp b/Libraries/LibHTML/DOM/Document.cpp index c0d1c524a4..da43fa7b15 100644 --- a/Libraries/LibHTML/DOM/Document.cpp +++ b/Libraries/LibHTML/DOM/Document.cpp @@ -181,6 +181,12 @@ URL Document::complete_url(const String& string) const return url; } +void Document::force_layout() +{ + m_layout_root = nullptr; + layout(); +} + void Document::layout() { if (!m_layout_root) { @@ -188,6 +194,7 @@ void Document::layout() m_layout_root = tree_builder.build(*this); } m_layout_root->layout(); + m_layout_root->set_needs_display(); } void Document::update_style() diff --git a/Libraries/LibHTML/DOM/Document.h b/Libraries/LibHTML/DOM/Document.h index c7c7541748..95046894fc 100644 --- a/Libraries/LibHTML/DOM/Document.h +++ b/Libraries/LibHTML/DOM/Document.h @@ -69,6 +69,7 @@ public: void set_visited_link_color(Color); void layout(); + void force_layout(); void update_style(); void update_layout(); |